Apply PHP-CS-Fixer fixes

This commit is contained in:
Yassine Guedidi 2024-01-01 19:11:01 +01:00
parent e938cc8687
commit 0a117958c9
68 changed files with 67 additions and 519 deletions

View file

@ -1,13 +1,14 @@
<?php
$config = new PhpCsFixer\Config();
return $config
->setRiskyAllowed(true)
->setRules([
'@Symfony' => true,
'@Symfony:risky' => true,
'array_syntax' => [
'syntax' => 'short'
'syntax' => 'short',
],
'combine_consecutive_unsets' => true,
'heredoc_to_nowdoc' => true,
@ -21,21 +22,23 @@ return $config
'use',
'parenthesis_brace_block',
'square_brace_block',
'curly_brace_block'
'curly_brace_block',
],
],
'no_unreachable_default_argument_value' => true,
'no_useless_concat_operator' => false,
'no_useless_else' => true,
'no_useless_return' => true,
'ordered_class_elements' => true,
'ordered_imports' => true,
'php_unit_strict' => true,
'phpdoc_order' => true,
'phpdoc_separation' => false,
// 'psr_autoloading' => true,
'strict_comparison' => true,
'strict_param' => true,
'concat_space' => [
'spacing' => 'one'
'spacing' => 'one',
],
])
->setFinder(
@ -44,7 +47,7 @@ return $config
'node_modules',
'vendor',
'var',
'web'
'web',
])
->in(__DIR__)
)

View file

@ -116,7 +116,7 @@ class AppKernel extends Kernel
$scheme = 'sqlite';
break;
default:
throw new \RuntimeException('Unsupported database driver: ' . $container->getParameter('database_driver'));
throw new RuntimeException('Unsupported database driver: ' . $container->getParameter('database_driver'));
}
$container->setParameter('database_scheme', $scheme);

View file

@ -27,12 +27,12 @@ class Version20170511211659 extends WallabagMigration
$this->addSql(<<<EOD
CREATE TEMPORARY TABLE __temp__wallabag_annotation AS
SELECT id, user_id, entry_id, text, created_at, updated_at, quote, ranges
FROM ${annotationTableName}
FROM {$annotationTableName}
EOD
);
$this->addSql('DROP TABLE ' . $annotationTableName);
$this->addSql(<<<EOD
CREATE TABLE ${annotationTableName}
CREATE TABLE {$annotationTableName}
(
id INTEGER PRIMARY KEY NOT NULL,
user_id INTEGER DEFAULT NULL,
@ -42,16 +42,16 @@ CREATE TABLE ${annotationTableName}
updated_at DATETIME NOT NULL,
quote CLOB NOT NULL,
ranges CLOB NOT NULL,
CONSTRAINT FK_A7AED006A76ED395 FOREIGN KEY (user_id) REFERENCES ${userTableName} (id),
CONSTRAINT FK_A7AED006BA364942 FOREIGN KEY (entry_id) REFERENCES ${entryTableName} (id) ON DELETE CASCADE
CONSTRAINT FK_A7AED006A76ED395 FOREIGN KEY (user_id) REFERENCES {$userTableName} (id),
CONSTRAINT FK_A7AED006BA364942 FOREIGN KEY (entry_id) REFERENCES {$entryTableName} (id) ON DELETE CASCADE
);
CREATE INDEX IDX_A7AED006A76ED395 ON ${annotationTableName} (user_id);
CREATE INDEX IDX_A7AED006BA364942 ON ${annotationTableName} (entry_id);
CREATE INDEX IDX_A7AED006A76ED395 ON {$annotationTableName} (user_id);
CREATE INDEX IDX_A7AED006BA364942 ON {$annotationTableName} (entry_id);
EOD
);
$this->addSql(<<<EOD
INSERT INTO ${annotationTableName} (id, user_id, entry_id, text, created_at, updated_at, quote, ranges)
INSERT INTO {$annotationTableName} (id, user_id, entry_id, text, created_at, updated_at, quote, ranges)
SELECT id, user_id, entry_id, text, created_at, updated_at, quote, ranges
FROM __temp__wallabag_annotation;
EOD

View file

@ -13,9 +13,6 @@ use Wallabag\UserBundle\Entity\User;
class AnnotationFixtures extends Fixture implements DependentFixtureInterface
{
/**
* {@inheritdoc}
*/
public function load(ObjectManager $manager)
{
$annotation1 = new Annotation($this->getReference('admin-user', User::class));
@ -48,9 +45,6 @@ class AnnotationFixtures extends Fixture implements DependentFixtureInterface
$manager->flush();
}
/**
* {@inheritdoc}
*/
public function getDependencies()
{
return [

View file

@ -7,9 +7,6 @@ use Symfony\Component\Config\Definition\ConfigurationInterface;
class Configuration implements ConfigurationInterface
{
/**
* {@inheritdoc}
*/
public function getConfigTreeBuilder()
{
return new TreeBuilder('wallabag_annotation');

View file

@ -7,9 +7,6 @@ use Symfony\Component\HttpKernel\DependencyInjection\Extension;
class WallabagAnnotationExtension extends Extension
{
/**
* {@inheritdoc}
*/
public function load(array $configs, ContainerBuilder $container)
{
$configuration = new Configuration();

View file

@ -137,10 +137,6 @@ class AnnotationRepository extends ServiceEntityRepository
/**
* Find all annotations related to archived entries.
*
* @param $userId
*
* @return mixed
*/
public function findAllArchivedEntriesByUser($userId)
{

View file

@ -103,8 +103,7 @@ class DeveloperController extends AbstractController
*/
public function howtoFirstAppAction()
{
return $this->render('@WallabagCore/Developer/howto_app.html.twig',
[
return $this->render('@WallabagCore/Developer/howto_app.html.twig', [
'wallabag_url' => $this->getParameter('domain_name'),
]);
}

View file

@ -118,8 +118,6 @@ class WallabagRestController extends AbstractFOSRestController
/**
* Shortcut to send data serialized in json.
*
* @param mixed $data
*
* @return JsonResponse
*/
protected function sendResponse($data)

View file

@ -12,9 +12,6 @@ use Symfony\Component\Config\Definition\ConfigurationInterface;
*/
class Configuration implements ConfigurationInterface
{
/**
* {@inheritdoc}
*/
public function getConfigTreeBuilder()
{
return new TreeBuilder('wallabag_api');

View file

@ -30,10 +30,10 @@ class CleanDownloadedImagesCommand extends Command
->setName('wallabag:clean-downloaded-images')
->setDescription('Cleans downloaded images which are no more associated to an entry')
->addOption(
'dry-run',
null,
InputOption::VALUE_NONE,
'Do not remove images, just dump counters'
'dry-run',
null,
InputOption::VALUE_NONE,
'Do not remove images, just dump counters'
);
}

View file

@ -66,10 +66,10 @@ class InstallCommand extends Command
->setName('wallabag:install')
->setDescription('wallabag installer.')
->addOption(
'reset',
null,
InputOption::VALUE_NONE,
'Reset current database'
'reset',
null,
InputOption::VALUE_NONE,
'Reset current database'
)
;
}
@ -125,8 +125,8 @@ class InstallCommand extends Command
try {
$conn->connect();
} catch (\Exception $e) {
if (false === strpos($e->getMessage(), 'Unknown database')
&& false === strpos($e->getMessage(), 'database "' . $this->databaseName . '" does not exist')) {
if (!str_contains($e->getMessage(), 'Unknown database')
&& !str_contains($e->getMessage(), 'database "' . $this->databaseName . '" does not exist')) {
$fulfilled = false;
$status = '<error>ERROR!</error>';
$help = 'Can\'t connect to the database: ' . $e->getMessage();
@ -381,12 +381,12 @@ class InstallCommand extends Command
$schemaManager = $connection->createSchemaManager();
} catch (\Exception $exception) {
// mysql & sqlite
if (false !== strpos($exception->getMessage(), sprintf("Unknown database '%s'", $databaseName))) {
if (str_contains($exception->getMessage(), sprintf("Unknown database '%s'", $databaseName))) {
return false;
}
// pgsql
if (false !== strpos($exception->getMessage(), sprintf('database "%s" does not exist', $databaseName))) {
if (str_contains($exception->getMessage(), sprintf('database "%s" does not exist', $databaseName))) {
return false;
}

View file

@ -34,9 +34,9 @@ class TagAllCommand extends Command
->setName('wallabag:tag:all')
->setDescription('Tag all entries using the tagging rules.')
->addArgument(
'username',
InputArgument::REQUIRED,
'User to tag entries for.'
'username',
InputArgument::REQUIRED,
'User to tag entries for.'
)
;
}

View file

@ -674,7 +674,7 @@ class ConfigController extends AbstractController
*/
public function setLocaleAction(Request $request, ValidatorInterface $validator, $language = null)
{
$errors = $validator->validate($language, (new LocaleConstraint(['canonicalize' => true])));
$errors = $validator->validate($language, new LocaleConstraint(['canonicalize' => true]));
if (0 === \count($errors)) {
$request->getSession()->set('_locale', $language);

View file

@ -80,7 +80,7 @@ class EntryController extends AbstractController
});
foreach ($labels as $label) {
$remove = false;
if (0 === strpos($label, '-')) {
if (str_starts_with($label, '-')) {
$label = substr($label, 1);
$remove = true;
}

View file

@ -89,9 +89,9 @@ class ExportController extends AbstractController
$currentRoute = (null !== $request->query->get('currentRoute') ? $request->query->get('currentRoute') : '');
$entries = $entryRepository->getBuilderForSearchByUser(
$this->getUser()->getId(),
$searchTerm,
$currentRoute
$this->getUser()->getId(),
$searchTerm,
$currentRoute
)->getQuery()
->getResult();

View file

@ -34,8 +34,6 @@ class FeedController extends AbstractController
*
* @ParamConverter("user", class="Wallabag\UserBundle\Entity\User", converter="username_feed_token_converter")
*
* @param $page
*
* @return Response
*/
public function showUnreadFeedAction(User $user, $page)
@ -50,8 +48,6 @@ class FeedController extends AbstractController
*
* @ParamConverter("user", class="Wallabag\UserBundle\Entity\User", converter="username_feed_token_converter")
*
* @param $page
*
* @return Response
*/
public function showArchiveFeedAction(User $user, $page)
@ -66,8 +62,6 @@ class FeedController extends AbstractController
*
* @ParamConverter("user", class="Wallabag\UserBundle\Entity\User", converter="username_feed_token_converter")
*
* @param $page
*
* @return Response
*/
public function showStarredFeedAction(User $user, $page)
@ -241,8 +235,6 @@ class FeedController extends AbstractController
'domainName' => $this->getParameter('domain_name'),
'version' => $this->getParameter('wallabag_core.version'),
'updated' => $this->prepareFeedUpdatedDate($entries),
],
new Response('', 200, ['Content-Type' => 'application/atom+xml'])
);
], new Response('', 200, ['Content-Type' => 'application/atom+xml']));
}
}

View file

@ -11,9 +11,6 @@ use Wallabag\UserBundle\Entity\User;
class ConfigFixtures extends Fixture implements DependentFixtureInterface
{
/**
* {@inheritdoc}
*/
public function load(ObjectManager $manager): void
{
$adminConfig = new Config($this->getReference('admin-user', User::class));
@ -59,9 +56,6 @@ class ConfigFixtures extends Fixture implements DependentFixtureInterface
$manager->flush();
}
/**
* {@inheritdoc}
*/
public function getDependencies()
{
return [

View file

@ -12,9 +12,6 @@ use Wallabag\UserBundle\Entity\User;
class EntryFixtures extends Fixture implements DependentFixtureInterface
{
/**
* {@inheritdoc}
*/
public function load(ObjectManager $manager): void
{
$now = new \DateTime();
@ -144,9 +141,6 @@ class EntryFixtures extends Fixture implements DependentFixtureInterface
$manager->flush();
}
/**
* {@inheritdoc}
*/
public function getDependencies()
{
return [

View file

@ -20,9 +20,6 @@ class IgnoreOriginInstanceRuleFixtures extends Fixture implements ContainerAware
$this->container = $container;
}
/**
* {@inheritdoc}
*/
public function load(ObjectManager $manager): void
{
foreach ($this->container->getParameter('wallabag_core.default_ignore_origin_instance_rules') as $ignore_origin_instance_rule) {

View file

@ -11,9 +11,6 @@ use Wallabag\UserBundle\Entity\User;
class IgnoreOriginUserRuleFixtures extends Fixture implements DependentFixtureInterface
{
/**
* {@inheritdoc}
*/
public function load(ObjectManager $manager): void
{
$rule = new IgnoreOriginUserRule();
@ -25,9 +22,6 @@ class IgnoreOriginUserRuleFixtures extends Fixture implements DependentFixtureIn
$manager->flush();
}
/**
* {@inheritdoc}
*/
public function getDependencies()
{
return [

View file

@ -20,9 +20,6 @@ class InternalSettingFixtures extends Fixture implements ContainerAwareInterface
$this->container = $container;
}
/**
* {@inheritdoc}
*/
public function load(ObjectManager $manager): void
{
foreach ($this->container->getParameter('wallabag_core.default_internal_settings') as $setting) {

View file

@ -24,9 +24,6 @@ class SiteCredentialFixtures extends Fixture implements DependentFixtureInterfac
$this->container = $container;
}
/**
* {@inheritdoc}
*/
public function load(ObjectManager $manager): void
{
$credential = new SiteCredential($this->getReference('admin-user', User::class));
@ -46,9 +43,6 @@ class SiteCredentialFixtures extends Fixture implements DependentFixtureInterfac
$manager->flush();
}
/**
* {@inheritdoc}
*/
public function getDependencies()
{
return [

View file

@ -8,13 +8,10 @@ use Wallabag\CoreBundle\Entity\Tag;
class TagFixtures extends Fixture
{
/**
* {@inheritdoc}
*/
public function load(ObjectManager $manager): void
{
$tags = [
'foo-bar-tag' => 'foo bar', //tag used for EntryControllerTest
'foo-bar-tag' => 'foo bar', // tag used for EntryControllerTest
'bar-tag' => 'bar',
'baz-tag' => 'baz', // tag used for ExportControllerTest
'foo-tag' => 'foo',

View file

@ -10,9 +10,6 @@ use Wallabag\CoreBundle\Entity\TaggingRule;
class TaggingRuleFixtures extends Fixture implements DependentFixtureInterface
{
/**
* {@inheritdoc}
*/
public function load(ObjectManager $manager): void
{
$tr1 = new TaggingRule();
@ -61,9 +58,6 @@ class TaggingRuleFixtures extends Fixture implements DependentFixtureInterface
$manager->flush();
}
/**
* {@inheritdoc}
*/
public function getDependencies()
{
return [

View file

@ -14,9 +14,6 @@ use Doctrine\DBAL\Types\JsonType;
*/
class JsonArrayType extends JsonType
{
/**
* {@inheritdoc}
*/
public function convertToPHPValue($value, AbstractPlatform $platform)
{
if (null === $value || '' === $value) {
@ -28,17 +25,11 @@ class JsonArrayType extends JsonType
return json_decode($value, true);
}
/**
* {@inheritdoc}
*/
public function getName()
{
return 'json_array';
}
/**
* {@inheritdoc}
*/
public function requiresSQLCommentHint(AbstractPlatform $platform)
{
return true;

View file

@ -183,8 +183,8 @@ class Config
private $taggingRules;
/**
@var ArrayCollection<IgnoreOriginUserRule>
* @var ArrayCollection<IgnoreOriginUserRule>
*
* @ORM\OneToMany(targetEntity="Wallabag\CoreBundle\Entity\IgnoreOriginUserRule", mappedBy="config", cascade={"remove"})
* @ORM\OrderBy({"id" = "ASC"})
*/
@ -261,8 +261,6 @@ class Config
/**
* Set user.
*
* @param User $user
*
* @return Config
*/
public function setUser(User $user = null)
@ -433,9 +431,6 @@ class Config
return $this;
}
/**
* @return string
*/
public function getFont(): ?string
{
return $this->font;
@ -451,9 +446,6 @@ class Config
return $this;
}
/**
* @return float
*/
public function getFontsize(): ?float
{
return $this->fontsize;
@ -469,9 +461,6 @@ class Config
return $this;
}
/**
* @return float
*/
public function getLineHeight(): ?float
{
return $this->lineHeight;
@ -487,9 +476,6 @@ class Config
return $this;
}
/**
* @return float
*/
public function getMaxWidth(): ?float
{
return $this->maxWidth;

View file

@ -138,7 +138,7 @@ class Entry
*
* @Groups({"entries_for_user", "export_all"})
*/
private $archivedAt = null;
private $archivedAt;
/**
* @var bool
@ -203,7 +203,7 @@ class Entry
*
* @Groups({"entries_for_user", "export_all"})
*/
private $starredAt = null;
private $starredAt;
/**
* @ORM\OneToMany(targetEntity="Wallabag\AnnotationBundle\Entity\Annotation", mappedBy="entry", cascade={"persist", "remove"})
@ -1007,8 +1007,6 @@ class Entry
}
/**
* @param mixed $hashedUrl
*
* @return Entry
*/
public function setHashedUrl($hashedUrl)

View file

@ -42,9 +42,6 @@ class GrabySiteConfigBuilder implements SiteConfigBuilder
$this->token = $token;
}
/**
* {@inheritdoc}
*/
public function buildForHost($host)
{
$user = $this->getUser();
@ -119,7 +116,7 @@ class GrabySiteConfigBuilder implements SiteConfigBuilder
$extraFields = [];
foreach ($extraFieldsStrings as $extraField) {
if (false === strpos($extraField, '=')) {
if (!str_contains($extraField, '=')) {
continue;
}

View file

@ -98,7 +98,7 @@ class ContentProxy
$errors = $this->validator->validate(
$value,
(new LocaleConstraint(['canonicalize' => true]))
new LocaleConstraint(['canonicalize' => true])
);
if (0 === \count($errors)) {
@ -119,7 +119,7 @@ class ContentProxy
{
$errors = $this->validator->validate(
$value,
(new UrlConstraint())
new UrlConstraint()
);
if (0 === \count($errors)) {
@ -207,8 +207,6 @@ class ContentProxy
* If the title from the fetched content comes from a PDF, then its very possible that the character encoding is not
* UTF-8. This methods tries to identify the character encoding and translate the title to UTF-8.
*
* @param $title
*
* @return string (maybe contains invalid UTF-8 character)
*/
private function convertPdfEncodingToUTF8($title)

View file

@ -162,7 +162,7 @@ class DownloadImages
$cleanSVG = $sanitizer->sanitize((string) $res->getBody());
// add an extra validation by checking about `<svg `
if (false === $cleanSVG || false === strpos($cleanSVG, '<svg ')) {
if (false === $cleanSVG || !str_contains($cleanSVG, '<svg ')) {
$this->logger->error('DownloadImages: Bad SVG given', ['path' => $imagePath]);
return false;
@ -373,7 +373,7 @@ class DownloadImages
$bytes = substr((string) $res->getBody(), 0, 8);
foreach ($types as $type => $header) {
if (0 === strpos($bytes, $header)) {
if (str_starts_with($bytes, $header)) {
$ext = $type;
break;
}

View file

@ -44,8 +44,8 @@ class Redirect
return $url;
}
if (!$ignoreActionMarkAsRead &&
Config::REDIRECT_TO_HOMEPAGE === $user->getConfig()->getActionMarkAsRead()) {
if (!$ignoreActionMarkAsRead
&& Config::REDIRECT_TO_HOMEPAGE === $user->getConfig()->getActionMarkAsRead()) {
return $this->router->generate('homepage');
}

View file

@ -63,7 +63,7 @@ class EntryRepository extends ServiceEntityRepository
return $this
->getSortedQueryBuilderByUser($userId)
->andWhere('e.isArchived = false')
;
;
}
/**
@ -78,7 +78,7 @@ class EntryRepository extends ServiceEntityRepository
return $this
->getQueryBuilderByUser($userId)
->andWhere('e.isArchived = false')
;
;
}
/**
@ -225,7 +225,7 @@ class EntryRepository extends ServiceEntityRepository
return $this
->getSortedQueryBuilderByUser($userId)
->innerJoin('e.annotations', 'a')
;
;
}
/**
@ -240,7 +240,7 @@ class EntryRepository extends ServiceEntityRepository
return $this
->getQueryBuilderByUser($userId)
->innerJoin('e.annotations', 'a')
;
;
}
/**

View file

@ -7,9 +7,6 @@ use PhpAmqpLib\Message\AMQPMessage;
class AMQPEntryConsumer extends AbstractConsumer implements ConsumerInterface
{
/**
* {@inheritdoc}
*/
public function execute(AMQPMessage $msg)
{
return $this->handleMessage($msg->body);

View file

@ -33,9 +33,6 @@ class ChromeController extends BrowserController
return parent::indexAction($request, $translator);
}
/**
* {@inheritdoc}
*/
protected function getImportService()
{
if ($this->craueConfig->get('import_with_rabbitmq')) {
@ -47,9 +44,6 @@ class ChromeController extends BrowserController
return $this->chromeImport;
}
/**
* {@inheritdoc}
*/
protected function getImportTemplate()
{
return '@WallabagImport/Chrome/index.html.twig';

View file

@ -33,9 +33,6 @@ class ElcuratorController extends WallabagController
return parent::indexAction($request, $translator);
}
/**
* {@inheritdoc}
*/
protected function getImportService()
{
if ($this->craueConfig->get('import_with_rabbitmq')) {
@ -47,9 +44,6 @@ class ElcuratorController extends WallabagController
return $this->elcuratorImport;
}
/**
* {@inheritdoc}
*/
protected function getImportTemplate()
{
return '@WallabagImport/Elcurator/index.html.twig';

View file

@ -33,9 +33,6 @@ class FirefoxController extends BrowserController
return parent::indexAction($request, $translator);
}
/**
* {@inheritdoc}
*/
protected function getImportService()
{
if ($this->craueConfig->get('import_with_rabbitmq')) {
@ -47,9 +44,6 @@ class FirefoxController extends BrowserController
return $this->firefoxImport;
}
/**
* {@inheritdoc}
*/
protected function getImportTemplate()
{
return '@WallabagImport/Firefox/index.html.twig';

View file

@ -33,9 +33,6 @@ class PocketHtmlController extends HtmlController
return parent::indexAction($request, $translator);
}
/**
* {@inheritdoc}
*/
protected function getImportService()
{
if ($this->craueConfig->get('import_with_rabbitmq')) {
@ -47,9 +44,6 @@ class PocketHtmlController extends HtmlController
return $this->pocketHtmlImport;
}
/**
* {@inheritdoc}
*/
protected function getImportTemplate()
{
return '@WallabagImport/PocketHtml/index.html.twig';

View file

@ -33,9 +33,6 @@ class ShaarliController extends HtmlController
return parent::indexAction($request, $translator);
}
/**
* {@inheritdoc}
*/
protected function getImportService()
{
if ($this->craueConfig->get('import_with_rabbitmq')) {
@ -47,9 +44,6 @@ class ShaarliController extends HtmlController
return $this->shaarliImport;
}
/**
* {@inheritdoc}
*/
protected function getImportTemplate()
{
return '@WallabagImport/Shaarli/index.html.twig';

View file

@ -33,9 +33,6 @@ class WallabagV1Controller extends WallabagController
return parent::indexAction($request, $translator);
}
/**
* {@inheritdoc}
*/
protected function getImportService()
{
if ($this->craueConfig->get('import_with_rabbitmq')) {
@ -47,9 +44,6 @@ class WallabagV1Controller extends WallabagController
return $this->wallabagImport;
}
/**
* {@inheritdoc}
*/
protected function getImportTemplate()
{
return '@WallabagImport/WallabagV1/index.html.twig';

View file

@ -33,9 +33,6 @@ class WallabagV2Controller extends WallabagController
return parent::indexAction($request, $translator);
}
/**
* {@inheritdoc}
*/
protected function getImportService()
{
if ($this->craueConfig->get('import_with_rabbitmq')) {
@ -47,9 +44,6 @@ class WallabagV2Controller extends WallabagController
return $this->wallabagImport;
}
/**
* {@inheritdoc}
*/
protected function getImportTemplate()
{
return '@WallabagImport/WallabagV2/index.html.twig';

View file

@ -92,9 +92,6 @@ abstract class AbstractImport implements ImportInterface
return $this;
}
/**
* {@inheritdoc}
*/
public function getSummary()
{
return [

View file

@ -9,24 +9,12 @@ abstract class BrowserImport extends AbstractImport
{
protected $filepath;
/**
* {@inheritdoc}
*/
abstract public function getName();
/**
* {@inheritdoc}
*/
abstract public function getUrl();
/**
* {@inheritdoc}
*/
abstract public function getDescription();
/**
* {@inheritdoc}
*/
public function import()
{
if (!$this->user) {
@ -72,9 +60,6 @@ abstract class BrowserImport extends AbstractImport
return $this;
}
/**
* {@inheritdoc}
*/
public function parseEntry(array $importedEntry)
{
if ((!\array_key_exists('guid', $importedEntry) || (!\array_key_exists('id', $importedEntry))) && \is_array(reset($importedEntry))) {
@ -218,9 +203,6 @@ abstract class BrowserImport extends AbstractImport
}
}
/**
* {@inheritdoc}
*/
protected function setEntryAsRead(array $importedEntry)
{
$importedEntry['is_archived'] = 1;

View file

@ -6,33 +6,21 @@ class ChromeImport extends BrowserImport
{
protected $filepath;
/**
* {@inheritdoc}
*/
public function getName()
{
return 'Chrome';
}
/**
* {@inheritdoc}
*/
public function getUrl()
{
return 'import_chrome';
}
/**
* {@inheritdoc}
*/
public function getDescription()
{
return 'import.chrome.description';
}
/**
* {@inheritdoc}
*/
public function validateEntry(array $importedEntry)
{
if (empty($importedEntry['url'])) {
@ -42,9 +30,6 @@ class ChromeImport extends BrowserImport
return true;
}
/**
* {@inheritdoc}
*/
protected function prepareEntry(array $entry = [])
{
$data = [

View file

@ -8,25 +8,16 @@ class DeliciousImport extends AbstractImport
{
private $filepath;
/**
* {@inheritdoc}
*/
public function getName()
{
return 'Delicious';
}
/**
* {@inheritdoc}
*/
public function getUrl()
{
return 'import_delicious';
}
/**
* {@inheritdoc}
*/
public function getDescription()
{
return 'import.delicious.description';
@ -44,9 +35,6 @@ class DeliciousImport extends AbstractImport
return $this;
}
/**
* {@inheritdoc}
*/
public function import()
{
if (!$this->user) {
@ -80,9 +68,6 @@ class DeliciousImport extends AbstractImport
return true;
}
/**
* {@inheritdoc}
*/
public function validateEntry(array $importedEntry)
{
if (empty($importedEntry['url'])) {
@ -92,9 +77,6 @@ class DeliciousImport extends AbstractImport
return true;
}
/**
* {@inheritdoc}
*/
public function parseEntry(array $importedEntry)
{
$existingEntry = $this->em
@ -141,9 +123,6 @@ class DeliciousImport extends AbstractImport
return $entry;
}
/**
* {@inheritdoc}
*/
protected function setEntryAsRead(array $importedEntry)
{
return $importedEntry;

View file

@ -4,33 +4,21 @@ namespace Wallabag\ImportBundle\Import;
class ElcuratorImport extends WallabagImport
{
/**
* {@inheritdoc}
*/
public function getName()
{
return 'elcurator';
}
/**
* {@inheritdoc}
*/
public function getUrl()
{
return 'import_elcurator';
}
/**
* {@inheritdoc}
*/
public function getDescription()
{
return 'import.elcurator.description';
}
/**
* {@inheritdoc}
*/
protected function prepareEntry($entry = [])
{
return [
@ -42,9 +30,6 @@ class ElcuratorImport extends WallabagImport
] + $entry;
}
/**
* {@inheritdoc}
*/
protected function setEntryAsRead(array $importedEntry)
{
$importedEntry['is_archived'] = 1;

View file

@ -6,33 +6,21 @@ class FirefoxImport extends BrowserImport
{
protected $filepath;
/**
* {@inheritdoc}
*/
public function getName()
{
return 'Firefox';
}
/**
* {@inheritdoc}
*/
public function getUrl()
{
return 'import_firefox';
}
/**
* {@inheritdoc}
*/
public function getDescription()
{
return 'import.firefox.description';
}
/**
* {@inheritdoc}
*/
public function validateEntry(array $importedEntry)
{
if (empty($importedEntry['uri'])) {
@ -42,9 +30,6 @@ class FirefoxImport extends BrowserImport
return true;
}
/**
* {@inheritdoc}
*/
protected function prepareEntry(array $entry = [])
{
$data = [

View file

@ -9,24 +9,12 @@ abstract class HtmlImport extends AbstractImport
{
protected $filepath;
/**
* {@inheritdoc}
*/
abstract public function getName();
/**
* {@inheritdoc}
*/
abstract public function getUrl();
/**
* {@inheritdoc}
*/
abstract public function getDescription();
/**
* {@inheritdoc}
*/
public function import()
{
if (!$this->user) {
@ -86,9 +74,6 @@ abstract class HtmlImport extends AbstractImport
return $this;
}
/**
* {@inheritdoc}
*/
public function parseEntry(array $importedEntry)
{
$url = $importedEntry['url'];
@ -196,9 +181,6 @@ abstract class HtmlImport extends AbstractImport
}
}
/**
* {@inheritdoc}
*/
protected function setEntryAsRead(array $importedEntry)
{
$importedEntry['is_archived'] = 1;

View file

@ -8,25 +8,16 @@ class InstapaperImport extends AbstractImport
{
private $filepath;
/**
* {@inheritdoc}
*/
public function getName()
{
return 'Instapaper';
}
/**
* {@inheritdoc}
*/
public function getUrl()
{
return 'import_instapaper';
}
/**
* {@inheritdoc}
*/
public function getDescription()
{
return 'import.instapaper.description';
@ -44,9 +35,6 @@ class InstapaperImport extends AbstractImport
return $this;
}
/**
* {@inheritdoc}
*/
public function import()
{
if (!$this->user) {
@ -108,9 +96,6 @@ class InstapaperImport extends AbstractImport
return true;
}
/**
* {@inheritdoc}
*/
public function validateEntry(array $importedEntry)
{
if (empty($importedEntry['url'])) {
@ -120,9 +105,6 @@ class InstapaperImport extends AbstractImport
return true;
}
/**
* {@inheritdoc}
*/
public function parseEntry(array $importedEntry)
{
$existingEntry = $this->em
@ -159,9 +141,6 @@ class InstapaperImport extends AbstractImport
return $entry;
}
/**
* {@inheritdoc}
*/
protected function setEntryAsRead(array $importedEntry)
{
$importedEntry['is_archived'] = 1;

View file

@ -8,25 +8,16 @@ class PinboardImport extends AbstractImport
{
private $filepath;
/**
* {@inheritdoc}
*/
public function getName()
{
return 'Pinboard';
}
/**
* {@inheritdoc}
*/
public function getUrl()
{
return 'import_pinboard';
}
/**
* {@inheritdoc}
*/
public function getDescription()
{
return 'import.pinboard.description';
@ -44,9 +35,6 @@ class PinboardImport extends AbstractImport
return $this;
}
/**
* {@inheritdoc}
*/
public function import()
{
if (!$this->user) {
@ -80,9 +68,6 @@ class PinboardImport extends AbstractImport
return true;
}
/**
* {@inheritdoc}
*/
public function validateEntry(array $importedEntry)
{
if (empty($importedEntry['href'])) {
@ -92,9 +77,6 @@ class PinboardImport extends AbstractImport
return true;
}
/**
* {@inheritdoc}
*/
public function parseEntry(array $importedEntry)
{
$existingEntry = $this->em
@ -141,9 +123,6 @@ class PinboardImport extends AbstractImport
return $entry;
}
/**
* {@inheritdoc}
*/
protected function setEntryAsRead(array $importedEntry)
{
$importedEntry['toread'] = 'no';

View file

@ -6,33 +6,21 @@ class PocketHtmlImport extends HtmlImport
{
protected $filepath;
/**
* {@inheritdoc}
*/
public function getName()
{
return 'Pocket HTML';
}
/**
* {@inheritdoc}
*/
public function getUrl()
{
return 'import_pocket_html';
}
/**
* {@inheritdoc}
*/
public function getDescription()
{
return 'import.pocket_html.description';
}
/**
* {@inheritdoc}
*/
public function validateEntry(array $importedEntry)
{
if (empty($importedEntry['url'])) {
@ -89,9 +77,6 @@ class PocketHtmlImport extends HtmlImport
return true;
}
/**
* {@inheritdoc}
*/
protected function prepareEntry(array $entry = [])
{
$data = [

View file

@ -32,25 +32,16 @@ class PocketImport extends AbstractImport
return $this->accessToken;
}
/**
* {@inheritdoc}
*/
public function getName()
{
return 'Pocket';
}
/**
* {@inheritdoc}
*/
public function getUrl()
{
return 'import_pocket';
}
/**
* {@inheritdoc}
*/
public function getDescription()
{
return 'import.pocket.description';
@ -105,9 +96,6 @@ class PocketImport extends AbstractImport
return true;
}
/**
* {@inheritdoc}
*/
public function import($offset = 0)
{
static $run = 0;
@ -158,9 +146,6 @@ class PocketImport extends AbstractImport
$this->client = new HttpMethodsClient(new PluginClient($client, [new ErrorPlugin()]), $requestFactory ?: Psr17FactoryDiscovery::findRequestFactory(), $streamFactory ?: Psr17FactoryDiscovery::findStreamFactory());
}
/**
* {@inheritdoc}
*/
public function validateEntry(array $importedEntry)
{
if (empty($importedEntry['resolved_url']) && empty($importedEntry['given_url'])) {
@ -171,8 +156,6 @@ class PocketImport extends AbstractImport
}
/**
* {@inheritdoc}
*
* @see https://getpocket.com/developer/docs/v3/retrieve
*/
public function parseEntry(array $importedEntry)
@ -233,9 +216,6 @@ class PocketImport extends AbstractImport
return $entry;
}
/**
* {@inheritdoc}
*/
protected function setEntryAsRead(array $importedEntry)
{
$importedEntry['status'] = '1';

View file

@ -8,25 +8,16 @@ class ReadabilityImport extends AbstractImport
{
private $filepath;
/**
* {@inheritdoc}
*/
public function getName()
{
return 'Readability';
}
/**
* {@inheritdoc}
*/
public function getUrl()
{
return 'import_readability';
}
/**
* {@inheritdoc}
*/
public function getDescription()
{
return 'import.readability.description';
@ -44,9 +35,6 @@ class ReadabilityImport extends AbstractImport
return $this;
}
/**
* {@inheritdoc}
*/
public function import()
{
if (!$this->user) {
@ -80,9 +68,6 @@ class ReadabilityImport extends AbstractImport
return true;
}
/**
* {@inheritdoc}
*/
public function validateEntry(array $importedEntry)
{
if (empty($importedEntry['article__url'])) {
@ -92,9 +77,6 @@ class ReadabilityImport extends AbstractImport
return true;
}
/**
* {@inheritdoc}
*/
public function parseEntry(array $importedEntry)
{
$existingEntry = $this->em
@ -133,9 +115,6 @@ class ReadabilityImport extends AbstractImport
return $entry;
}
/**
* {@inheritdoc}
*/
protected function setEntryAsRead(array $importedEntry)
{
$importedEntry['archive'] = 1;

View file

@ -6,33 +6,21 @@ class ShaarliImport extends HtmlImport
{
protected $filepath;
/**
* {@inheritdoc}
*/
public function getName()
{
return 'Shaarli';
}
/**
* {@inheritdoc}
*/
public function getUrl()
{
return 'import_shaarli';
}
/**
* {@inheritdoc}
*/
public function getDescription()
{
return 'import.shaarli.description';
}
/**
* {@inheritdoc}
*/
public function validateEntry(array $importedEntry)
{
if (empty($importedEntry['url'])) {
@ -42,9 +30,6 @@ class ShaarliImport extends HtmlImport
return true;
}
/**
* {@inheritdoc}
*/
protected function prepareEntry(array $entry = [])
{
$data = [

View file

@ -23,24 +23,12 @@ abstract class WallabagImport extends AbstractImport
'',
];
/**
* {@inheritdoc}
*/
abstract public function getName();
/**
* {@inheritdoc}
*/
abstract public function getUrl();
/**
* {@inheritdoc}
*/
abstract public function getDescription();
/**
* {@inheritdoc}
*/
public function import()
{
if (!$this->user) {
@ -86,9 +74,6 @@ abstract class WallabagImport extends AbstractImport
return $this;
}
/**
* {@inheritdoc}
*/
public function validateEntry(array $importedEntry)
{
if (empty($importedEntry['url'])) {
@ -98,9 +83,6 @@ abstract class WallabagImport extends AbstractImport
return true;
}
/**
* {@inheritdoc}
*/
public function parseEntry(array $importedEntry)
{
$existingEntry = $this->em

View file

@ -21,33 +21,21 @@ class WallabagV1Import extends WallabagImport
parent::__construct($em, $contentProxy, $tagsAssigner, $eventDispatcher, $logger);
}
/**
* {@inheritdoc}
*/
public function getName()
{
return 'wallabag v1';
}
/**
* {@inheritdoc}
*/
public function getUrl()
{
return 'import_wallabag_v1';
}
/**
* {@inheritdoc}
*/
public function getDescription()
{
return 'import.wallabag_v1.description';
}
/**
* {@inheritdoc}
*/
protected function prepareEntry($entry = [])
{
$data = [
@ -75,9 +63,6 @@ class WallabagV1Import extends WallabagImport
return $data;
}
/**
* {@inheritdoc}
*/
protected function setEntryAsRead(array $importedEntry)
{
$importedEntry['is_read'] = 1;

View file

@ -4,33 +4,21 @@ namespace Wallabag\ImportBundle\Import;
class WallabagV2Import extends WallabagImport
{
/**
* {@inheritdoc}
*/
public function getName()
{
return 'wallabag v2';
}
/**
* {@inheritdoc}
*/
public function getUrl()
{
return 'import_wallabag_v2';
}
/**
* {@inheritdoc}
*/
public function getDescription()
{
return 'import.wallabag_v2.description';
}
/**
* {@inheritdoc}
*/
protected function prepareEntry($entry = [])
{
return [
@ -43,9 +31,6 @@ class WallabagV2Import extends WallabagImport
] + $entry;
}
/**
* {@inheritdoc}
*/
protected function setEntryAsRead(array $importedEntry)
{
$importedEntry['is_archived'] = 1;

View file

@ -8,9 +8,6 @@ use Wallabag\UserBundle\Entity\User;
class UserFixtures extends Fixture
{
/**
* {@inheritdoc}
*/
public function load(ObjectManager $manager)
{
$userAdmin = new User();

View file

@ -252,8 +252,6 @@ class User extends BaseUser implements EmailTwoFactorInterface, GoogleTwoFactorI
/**
* Set config.
*
* @param Config $config
*
* @return User
*/
public function setConfig(Config $config = null)
@ -297,65 +295,41 @@ class User extends BaseUser implements EmailTwoFactorInterface, GoogleTwoFactorI
return $this->isGoogleAuthenticatorEnabled();
}
/**
* {@inheritdoc}
*/
public function isEmailAuthEnabled(): bool
{
return $this->emailTwoFactor;
}
/**
* {@inheritdoc}
*/
public function getEmailAuthCode(): string
{
return $this->authCode;
}
/**
* {@inheritdoc}
*/
public function setEmailAuthCode(string $authCode): void
{
$this->authCode = $authCode;
}
/**
* {@inheritdoc}
*/
public function getEmailAuthRecipient(): string
{
return $this->email;
}
/**
* {@inheritdoc}
*/
public function isGoogleAuthenticatorEnabled(): bool
{
return $this->googleAuthenticatorSecret ? true : false;
}
/**
* {@inheritdoc}
*/
public function getGoogleAuthenticatorUsername(): string
{
return $this->username;
}
/**
* {@inheritdoc}
*/
public function getGoogleAuthenticatorSecret(): string
{
return $this->googleAuthenticatorSecret;
}
/**
* {@inheritdoc}
*/
public function setGoogleAuthenticatorSecret(?string $googleAuthenticatorSecret): void
{
$this->googleAuthenticatorSecret = $googleAuthenticatorSecret;
@ -371,17 +345,11 @@ class User extends BaseUser implements EmailTwoFactorInterface, GoogleTwoFactorI
return $this->backupCodes;
}
/**
* {@inheritdoc}
*/
public function isBackupCode(string $code): bool
{
return false === $this->findBackupCode($code) ? false : true;
}
/**
* {@inheritdoc}
*/
public function invalidateBackupCode(string $code): void
{
$key = $this->findBackupCode($code);

View file

@ -18,9 +18,6 @@ class AuthenticationFailureListener implements EventSubscriberInterface
$this->logger = $logger;
}
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents()
{
return [

View file

@ -22,9 +22,6 @@ class PasswordResettingListener implements EventSubscriberInterface
$this->router = $router;
}
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents()
{
return [

View file

@ -16,7 +16,7 @@ abstract class WallabagAnnotationTestCase extends WebTestCase
/**
* @var KernelBrowser
*/
protected $client = null;
protected $client;
/**
* @var UserInterface

View file

@ -18,7 +18,7 @@ abstract class WallabagApiTestCase extends WebTestCase
/**
* @var KernelBrowser
*/
protected $client = null;
protected $client;
/**
* @var UserInterface

View file

@ -12,7 +12,7 @@ class ReloadEntryCommandTest extends WallabagCoreTestCase
public $url = 'https://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html';
/**
* @var entry
* @var Entry
*/
public $adminEntry;

View file

@ -36,7 +36,7 @@ class FeedControllerTest extends WallabagCoreTestCase
$this->assertSame('admin', $xpath->query('/a:feed/a:author/a:name')->item(0)->nodeValue);
$this->assertSame(1, $xpath->query('/a:feed/a:subtitle')->length);
if (null !== $tagValue && 0 === strpos($type, 'tag')) {
if (null !== $tagValue && str_starts_with($type, 'tag')) {
$this->assertSame('wallabag — ' . $type . ' ' . $tagValue . ' feed', $xpath->query('/a:feed/a:title')->item(0)->nodeValue);
$this->assertSame('Atom feed for entries tagged with ' . $tagValue, $xpath->query('/a:feed/a:subtitle')->item(0)->nodeValue);
} else {

View file

@ -437,7 +437,7 @@ class ContentProxyTest extends TestCase
$ruleBasedIgnoreOriginProcessor->expects($this->once())
->method('process');
$proxy = new ContentProxy((new Graby()), $tagger, $ruleBasedIgnoreOriginProcessor, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage, true);
$proxy = new ContentProxy(new Graby(), $tagger, $ruleBasedIgnoreOriginProcessor, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage, true);
$entry = new Entry(new User());
$proxy->updateEntry(
$entry,
@ -483,7 +483,7 @@ class ContentProxyTest extends TestCase
$logHandler = new TestHandler();
$logger = new Logger('test', [$logHandler]);
$proxy = new ContentProxy((new Graby()), $tagger, $ruleBasedIgnoreOriginProcessor, $this->getValidator(), $logger, $this->fetchingErrorMessage);
$proxy = new ContentProxy(new Graby(), $tagger, $ruleBasedIgnoreOriginProcessor, $this->getValidator(), $logger, $this->fetchingErrorMessage);
$entry = new Entry(new User());
$proxy->updateEntry(
$entry,
@ -523,7 +523,7 @@ class ContentProxyTest extends TestCase
$handler = new TestHandler();
$logger->pushHandler($handler);
$proxy = new ContentProxy((new Graby()), $tagger, $ruleBasedIgnoreOriginProcessor, $this->getValidator(), $logger, $this->fetchingErrorMessage);
$proxy = new ContentProxy(new Graby(), $tagger, $ruleBasedIgnoreOriginProcessor, $this->getValidator(), $logger, $this->fetchingErrorMessage);
$entry = new Entry(new User());
$proxy->updateEntry(
$entry,
@ -565,7 +565,7 @@ class ContentProxyTest extends TestCase
$ruleBasedIgnoreOriginProcessor = $this->getRuleBasedIgnoreOriginProcessorMock();
$proxy = new ContentProxy((new Graby()), $tagger, $ruleBasedIgnoreOriginProcessor, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage);
$proxy = new ContentProxy(new Graby(), $tagger, $ruleBasedIgnoreOriginProcessor, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage);
$entry = new Entry(new User());
$proxy->updateEntry(
$entry,
@ -609,7 +609,7 @@ class ContentProxyTest extends TestCase
$ruleBasedIgnoreOriginProcessor = $this->getRuleBasedIgnoreOriginProcessorMock();
$proxy = new ContentProxy((new Graby()), $tagger, $ruleBasedIgnoreOriginProcessor, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage);
$proxy = new ContentProxy(new Graby(), $tagger, $ruleBasedIgnoreOriginProcessor, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage);
$entry = new Entry(new User());
$proxy->updateEntry(
$entry,
@ -620,7 +620,7 @@ class ContentProxyTest extends TestCase
'url' => 'http://1.1.1.1',
'language' => 'fr',
'status' => '200',
//'og_title' => 'my OG title',
// 'og_title' => 'my OG title',
'description' => 'OG desc',
'image' => 'http://3.3.3.3/cover.jpg',
'headers' => [
@ -1043,7 +1043,7 @@ class ContentProxyTest extends TestCase
->method('process')
->willReturn($processor_result);
$proxy = new ContentProxy((new Graby()), $tagger, $ruleBasedIgnoreOriginProcessor, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage, true);
$proxy = new ContentProxy(new Graby(), $tagger, $ruleBasedIgnoreOriginProcessor, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage, true);
$entry = new Entry(new User());
$entry->setOriginUrl($origin_url);
$proxy->updateEntry(
@ -1069,8 +1069,6 @@ class ContentProxyTest extends TestCase
/**
* https://stackoverflow.com/a/18506801.
*
* @param $string
*
* @return string
*/
private function strToHex($string)
@ -1090,8 +1088,6 @@ class ContentProxyTest extends TestCase
*
* @see https://stackoverflow.com/a/18506801
*
* @param $hex
*
* @return string
*/
private function hexToStr($hex)

View file

@ -18,7 +18,7 @@ abstract class WallabagCoreTestCase extends WebTestCase
/**
* @var KernelBrowser|null
*/
private $client = null;
private $client;
protected function setUp(): void
{

View file

@ -190,7 +190,7 @@ class PocketImportTest extends TestCase
}
}
JSON
));
));
$pocketImport = $this->getPocketImport('ConsumerKey', 1);
@ -280,7 +280,7 @@ JSON
}
}
JSON
));
));
$pocketImport = $this->getPocketImport('ConsumerKey', 2);