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

View file

@ -116,7 +116,7 @@ class AppKernel extends Kernel
$scheme = 'sqlite'; $scheme = 'sqlite';
break; break;
default: 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); $container->setParameter('database_scheme', $scheme);

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -103,8 +103,7 @@ class DeveloperController extends AbstractController
*/ */
public function howtoFirstAppAction() 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'), 'wallabag_url' => $this->getParameter('domain_name'),
]); ]);
} }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -674,7 +674,7 @@ class ConfigController extends AbstractController
*/ */
public function setLocaleAction(Request $request, ValidatorInterface $validator, $language = null) 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)) { if (0 === \count($errors)) {
$request->getSession()->set('_locale', $language); $request->getSession()->set('_locale', $language);

View file

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

View file

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

View file

@ -34,8 +34,6 @@ class FeedController extends AbstractController
* *
* @ParamConverter("user", class="Wallabag\UserBundle\Entity\User", converter="username_feed_token_converter") * @ParamConverter("user", class="Wallabag\UserBundle\Entity\User", converter="username_feed_token_converter")
* *
* @param $page
*
* @return Response * @return Response
*/ */
public function showUnreadFeedAction(User $user, $page) 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") * @ParamConverter("user", class="Wallabag\UserBundle\Entity\User", converter="username_feed_token_converter")
* *
* @param $page
*
* @return Response * @return Response
*/ */
public function showArchiveFeedAction(User $user, $page) 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") * @ParamConverter("user", class="Wallabag\UserBundle\Entity\User", converter="username_feed_token_converter")
* *
* @param $page
*
* @return Response * @return Response
*/ */
public function showStarredFeedAction(User $user, $page) public function showStarredFeedAction(User $user, $page)
@ -241,8 +235,6 @@ class FeedController extends AbstractController
'domainName' => $this->getParameter('domain_name'), 'domainName' => $this->getParameter('domain_name'),
'version' => $this->getParameter('wallabag_core.version'), 'version' => $this->getParameter('wallabag_core.version'),
'updated' => $this->prepareFeedUpdatedDate($entries), '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 class ConfigFixtures extends Fixture implements DependentFixtureInterface
{ {
/**
* {@inheritdoc}
*/
public function load(ObjectManager $manager): void public function load(ObjectManager $manager): void
{ {
$adminConfig = new Config($this->getReference('admin-user', User::class)); $adminConfig = new Config($this->getReference('admin-user', User::class));
@ -59,9 +56,6 @@ class ConfigFixtures extends Fixture implements DependentFixtureInterface
$manager->flush(); $manager->flush();
} }
/**
* {@inheritdoc}
*/
public function getDependencies() public function getDependencies()
{ {
return [ return [

View file

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

View file

@ -20,9 +20,6 @@ class IgnoreOriginInstanceRuleFixtures extends Fixture implements ContainerAware
$this->container = $container; $this->container = $container;
} }
/**
* {@inheritdoc}
*/
public function load(ObjectManager $manager): void public function load(ObjectManager $manager): void
{ {
foreach ($this->container->getParameter('wallabag_core.default_ignore_origin_instance_rules') as $ignore_origin_instance_rule) { 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 class IgnoreOriginUserRuleFixtures extends Fixture implements DependentFixtureInterface
{ {
/**
* {@inheritdoc}
*/
public function load(ObjectManager $manager): void public function load(ObjectManager $manager): void
{ {
$rule = new IgnoreOriginUserRule(); $rule = new IgnoreOriginUserRule();
@ -25,9 +22,6 @@ class IgnoreOriginUserRuleFixtures extends Fixture implements DependentFixtureIn
$manager->flush(); $manager->flush();
} }
/**
* {@inheritdoc}
*/
public function getDependencies() public function getDependencies()
{ {
return [ return [

View file

@ -20,9 +20,6 @@ class InternalSettingFixtures extends Fixture implements ContainerAwareInterface
$this->container = $container; $this->container = $container;
} }
/**
* {@inheritdoc}
*/
public function load(ObjectManager $manager): void public function load(ObjectManager $manager): void
{ {
foreach ($this->container->getParameter('wallabag_core.default_internal_settings') as $setting) { 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; $this->container = $container;
} }
/**
* {@inheritdoc}
*/
public function load(ObjectManager $manager): void public function load(ObjectManager $manager): void
{ {
$credential = new SiteCredential($this->getReference('admin-user', User::class)); $credential = new SiteCredential($this->getReference('admin-user', User::class));
@ -46,9 +43,6 @@ class SiteCredentialFixtures extends Fixture implements DependentFixtureInterfac
$manager->flush(); $manager->flush();
} }
/**
* {@inheritdoc}
*/
public function getDependencies() public function getDependencies()
{ {
return [ return [

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -98,7 +98,7 @@ class ContentProxy
$errors = $this->validator->validate( $errors = $this->validator->validate(
$value, $value,
(new LocaleConstraint(['canonicalize' => true])) new LocaleConstraint(['canonicalize' => true])
); );
if (0 === \count($errors)) { if (0 === \count($errors)) {
@ -119,7 +119,7 @@ class ContentProxy
{ {
$errors = $this->validator->validate( $errors = $this->validator->validate(
$value, $value,
(new UrlConstraint()) new UrlConstraint()
); );
if (0 === \count($errors)) { 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 * 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. * 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) * @return string (maybe contains invalid UTF-8 character)
*/ */
private function convertPdfEncodingToUTF8($title) private function convertPdfEncodingToUTF8($title)

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -18,7 +18,7 @@ abstract class WallabagApiTestCase extends WebTestCase
/** /**
* @var KernelBrowser * @var KernelBrowser
*/ */
protected $client = null; protected $client;
/** /**
* @var UserInterface * @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'; 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; 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('admin', $xpath->query('/a:feed/a:author/a:name')->item(0)->nodeValue);
$this->assertSame(1, $xpath->query('/a:feed/a:subtitle')->length); $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('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); $this->assertSame('Atom feed for entries tagged with ' . $tagValue, $xpath->query('/a:feed/a:subtitle')->item(0)->nodeValue);
} else { } else {

View file

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

View file

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

View file

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