diff --git a/fixtures/AnnotationFixtures.php b/fixtures/AnnotationFixtures.php index c514f6854..401d25db8 100644 --- a/fixtures/AnnotationFixtures.php +++ b/fixtures/AnnotationFixtures.php @@ -11,7 +11,7 @@ use Wallabag\Entity\User; class AnnotationFixtures extends Fixture implements DependentFixtureInterface { - public function load(ObjectManager $manager) + public function load(ObjectManager $manager): void { $annotation1 = new Annotation($this->getReference('admin-user', User::class)); $annotation1->setEntry($this->getReference('entry1', Entry::class)); diff --git a/fixtures/UserFixtures.php b/fixtures/UserFixtures.php index 4f3c26931..79424b848 100644 --- a/fixtures/UserFixtures.php +++ b/fixtures/UserFixtures.php @@ -8,7 +8,7 @@ use Wallabag\Entity\User; class UserFixtures extends Fixture { - public function load(ObjectManager $manager) + public function load(ObjectManager $manager): void { $userAdmin = new User(); $userAdmin->setName('Big boss'); diff --git a/src/Command/CleanDownloadedImagesCommand.php b/src/Command/CleanDownloadedImagesCommand.php index ee1415c5c..c57cb248a 100644 --- a/src/Command/CleanDownloadedImagesCommand.php +++ b/src/Command/CleanDownloadedImagesCommand.php @@ -38,7 +38,7 @@ class CleanDownloadedImagesCommand extends Command ); } - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $io = new SymfonyStyle($input, $output); diff --git a/src/Command/CleanDuplicatesCommand.php b/src/Command/CleanDuplicatesCommand.php index 2ee306cd3..184146aec 100644 --- a/src/Command/CleanDuplicatesCommand.php +++ b/src/Command/CleanDuplicatesCommand.php @@ -45,7 +45,7 @@ class CleanDuplicatesCommand extends Command ); } - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $this->io = new SymfonyStyle($input, $output); diff --git a/src/Command/ExportCommand.php b/src/Command/ExportCommand.php index 8db47c4e8..f651157a6 100644 --- a/src/Command/ExportCommand.php +++ b/src/Command/ExportCommand.php @@ -49,7 +49,7 @@ class ExportCommand extends Command ; } - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $io = new SymfonyStyle($input, $output); diff --git a/src/Command/GenerateUrlHashesCommand.php b/src/Command/GenerateUrlHashesCommand.php index 9ac7de0f2..4583fa140 100644 --- a/src/Command/GenerateUrlHashesCommand.php +++ b/src/Command/GenerateUrlHashesCommand.php @@ -39,7 +39,7 @@ class GenerateUrlHashesCommand extends Command ->addArgument('username', InputArgument::OPTIONAL, 'User to process entries'); } - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $this->output = $output; diff --git a/src/Command/Import/ImportCommand.php b/src/Command/Import/ImportCommand.php index 119843a20..8d4781961 100644 --- a/src/Command/Import/ImportCommand.php +++ b/src/Command/Import/ImportCommand.php @@ -97,7 +97,7 @@ class ImportCommand extends Command ; } - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $output->writeln('Start : ' . (new \DateTime())->format('d-m-Y G:i:s') . ' ---'); diff --git a/src/Command/Import/RedisWorkerCommand.php b/src/Command/Import/RedisWorkerCommand.php index f5ec875aa..b12e88f5a 100644 --- a/src/Command/Import/RedisWorkerCommand.php +++ b/src/Command/Import/RedisWorkerCommand.php @@ -33,7 +33,7 @@ class RedisWorkerCommand extends Command ; } - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $output->writeln('Worker started at: ' . (new \DateTime())->format('d-m-Y G:i:s')); $output->writeln('Waiting for message ...'); diff --git a/src/Command/InstallCommand.php b/src/Command/InstallCommand.php index 9ef7a3ec0..b9a2590dc 100644 --- a/src/Command/InstallCommand.php +++ b/src/Command/InstallCommand.php @@ -70,7 +70,7 @@ class InstallCommand extends Command ; } - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $this->defaultInput = $input; diff --git a/src/Command/ListUserCommand.php b/src/Command/ListUserCommand.php index e31f0ef47..6085955b4 100644 --- a/src/Command/ListUserCommand.php +++ b/src/Command/ListUserCommand.php @@ -33,7 +33,7 @@ class ListUserCommand extends Command ; } - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $io = new SymfonyStyle($input, $output); diff --git a/src/Command/ReloadEntryCommand.php b/src/Command/ReloadEntryCommand.php index 1aebd3a7d..aab6bb69f 100644 --- a/src/Command/ReloadEntryCommand.php +++ b/src/Command/ReloadEntryCommand.php @@ -51,7 +51,7 @@ class ReloadEntryCommand extends Command ); } - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $io = new SymfonyStyle($input, $output); diff --git a/src/Command/ShowUserCommand.php b/src/Command/ShowUserCommand.php index 6a341b6c8..124daa87c 100644 --- a/src/Command/ShowUserCommand.php +++ b/src/Command/ShowUserCommand.php @@ -37,7 +37,7 @@ class ShowUserCommand extends Command ); } - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $this->io = new SymfonyStyle($input, $output); diff --git a/src/Command/TagAllCommand.php b/src/Command/TagAllCommand.php index 628858ec5..8d933e086 100644 --- a/src/Command/TagAllCommand.php +++ b/src/Command/TagAllCommand.php @@ -42,7 +42,7 @@ class TagAllCommand extends Command ; } - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $io = new SymfonyStyle($input, $output); diff --git a/src/Command/UpdatePicturesPathCommand.php b/src/Command/UpdatePicturesPathCommand.php index 0a3eecdec..e78316e5c 100644 --- a/src/Command/UpdatePicturesPathCommand.php +++ b/src/Command/UpdatePicturesPathCommand.php @@ -37,7 +37,7 @@ class UpdatePicturesPathCommand extends Command ); } - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $io = new SymfonyStyle($input, $output); diff --git a/src/Doctrine/JsonArrayType.php b/src/Doctrine/JsonArrayType.php index 6e57157ae..8e43cabe8 100644 --- a/src/Doctrine/JsonArrayType.php +++ b/src/Doctrine/JsonArrayType.php @@ -25,12 +25,12 @@ class JsonArrayType extends JsonType return json_decode($value, true); } - public function getName() + public function getName(): string { return 'json_array'; } - public function requiresSQLCommentHint(AbstractPlatform $platform) + public function requiresSQLCommentHint(AbstractPlatform $platform): bool { return true; } diff --git a/src/Event/Listener/AuthenticationFailureListener.php b/src/Event/Listener/AuthenticationFailureListener.php index 0c36856cd..d64ad6d4e 100644 --- a/src/Event/Listener/AuthenticationFailureListener.php +++ b/src/Event/Listener/AuthenticationFailureListener.php @@ -18,7 +18,7 @@ class AuthenticationFailureListener implements EventSubscriberInterface $this->logger = $logger; } - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [ AuthenticationEvents::AUTHENTICATION_FAILURE => 'onAuthenticationFailure', diff --git a/src/Event/Listener/CreateConfigListener.php b/src/Event/Listener/CreateConfigListener.php index 383589aad..be9fd0a95 100644 --- a/src/Event/Listener/CreateConfigListener.php +++ b/src/Event/Listener/CreateConfigListener.php @@ -38,7 +38,7 @@ class CreateConfigListener implements EventSubscriberInterface $this->displayThumbnails = $displayThumbnails; } - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [ // when a user register using the normal form diff --git a/src/Event/Listener/LocaleListener.php b/src/Event/Listener/LocaleListener.php index 1937cda85..b14b8aa98 100644 --- a/src/Event/Listener/LocaleListener.php +++ b/src/Event/Listener/LocaleListener.php @@ -34,7 +34,7 @@ class LocaleListener implements EventSubscriberInterface } } - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [ // must be registered before the default Locale listener diff --git a/src/Event/Listener/PasswordResettingListener.php b/src/Event/Listener/PasswordResettingListener.php index 611d1fead..6b47ffd09 100644 --- a/src/Event/Listener/PasswordResettingListener.php +++ b/src/Event/Listener/PasswordResettingListener.php @@ -22,7 +22,7 @@ class PasswordResettingListener implements EventSubscriberInterface $this->router = $router; } - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [ FOSUserEvents::RESETTING_RESET_SUCCESS => 'onPasswordResettingSuccess', diff --git a/src/Event/Listener/RegistrationListener.php b/src/Event/Listener/RegistrationListener.php index 8baea7918..33a03c9d1 100644 --- a/src/Event/Listener/RegistrationListener.php +++ b/src/Event/Listener/RegistrationListener.php @@ -26,7 +26,7 @@ class RegistrationListener implements EventSubscriberInterface $this->urlGenerator = $urlGenerator; } - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [ FOSUserEvents::REGISTRATION_INITIALIZE => 'onRegistrationInitialize', diff --git a/src/Event/Subscriber/DownloadImagesSubscriber.php b/src/Event/Subscriber/DownloadImagesSubscriber.php index 6c8eb4b05..069018b24 100644 --- a/src/Event/Subscriber/DownloadImagesSubscriber.php +++ b/src/Event/Subscriber/DownloadImagesSubscriber.php @@ -25,7 +25,7 @@ class DownloadImagesSubscriber implements EventSubscriberInterface $this->logger = $logger; } - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [ EntrySavedEvent::NAME => 'onEntrySaved', diff --git a/src/Event/Subscriber/GenerateCustomCSSSubscriber.php b/src/Event/Subscriber/GenerateCustomCSSSubscriber.php index 9fc72bee9..78d9081a5 100644 --- a/src/Event/Subscriber/GenerateCustomCSSSubscriber.php +++ b/src/Event/Subscriber/GenerateCustomCSSSubscriber.php @@ -18,7 +18,7 @@ class GenerateCustomCSSSubscriber implements EventSubscriberInterface $this->compiler = $compiler; } - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [ ConfigUpdatedEvent::NAME => 'onConfigUpdated', diff --git a/src/Event/Subscriber/SchemaAdapterSubscriber.php b/src/Event/Subscriber/SchemaAdapterSubscriber.php index 018877e97..fb3cb15f6 100644 --- a/src/Event/Subscriber/SchemaAdapterSubscriber.php +++ b/src/Event/Subscriber/SchemaAdapterSubscriber.php @@ -15,7 +15,7 @@ class SchemaAdapterSubscriber implements EventSubscriber $this->databaseTablePrefix = $databaseTablePrefix; } - public function getSubscribedEvents() + public function getSubscribedEvents(): array { return ['postGenerateSchema']; } diff --git a/src/Event/Subscriber/TablePrefixSubscriber.php b/src/Event/Subscriber/TablePrefixSubscriber.php index 9a6f12f8c..cf329f7d4 100644 --- a/src/Event/Subscriber/TablePrefixSubscriber.php +++ b/src/Event/Subscriber/TablePrefixSubscriber.php @@ -25,7 +25,7 @@ class TablePrefixSubscriber implements EventSubscriber $this->tablePrefix = (string) $tablePrefix; } - public function getSubscribedEvents() + public function getSubscribedEvents(): array { return ['loadClassMetadata']; } diff --git a/src/Form/Type/Api/ClientType.php b/src/Form/Type/Api/ClientType.php index 66284fe58..8986a04ff 100644 --- a/src/Form/Type/Api/ClientType.php +++ b/src/Form/Type/Api/ClientType.php @@ -45,7 +45,7 @@ class ClientType extends AbstractType ]); } - public function getBlockPrefix() + public function getBlockPrefix(): string { return 'client'; } diff --git a/src/Form/Type/ChangePasswordType.php b/src/Form/Type/ChangePasswordType.php index 512a01750..e6a3ed7a9 100644 --- a/src/Form/Type/ChangePasswordType.php +++ b/src/Form/Type/ChangePasswordType.php @@ -41,7 +41,7 @@ class ChangePasswordType extends AbstractType ; } - public function getBlockPrefix() + public function getBlockPrefix(): string { return 'change_passwd'; } diff --git a/src/Form/Type/ConfigType.php b/src/Form/Type/ConfigType.php index 1aea4fc6f..fc72ebe75 100644 --- a/src/Form/Type/ConfigType.php +++ b/src/Form/Type/ConfigType.php @@ -104,7 +104,7 @@ class ConfigType extends AbstractType ]); } - public function getBlockPrefix() + public function getBlockPrefix(): string { return 'config'; } diff --git a/src/Form/Type/EditEntryType.php b/src/Form/Type/EditEntryType.php index 090e73e83..cb0d75144 100644 --- a/src/Form/Type/EditEntryType.php +++ b/src/Form/Type/EditEntryType.php @@ -44,7 +44,7 @@ class EditEntryType extends AbstractType ]); } - public function getBlockPrefix() + public function getBlockPrefix(): string { return 'entry'; } diff --git a/src/Form/Type/EntryFilterType.php b/src/Form/Type/EntryFilterType.php index d4462f36d..50d3fd10c 100644 --- a/src/Form/Type/EntryFilterType.php +++ b/src/Form/Type/EntryFilterType.php @@ -197,7 +197,7 @@ class EntryFilterType extends AbstractType ; } - public function getBlockPrefix() + public function getBlockPrefix(): string { return 'entry_filter'; } diff --git a/src/Form/Type/FeedType.php b/src/Form/Type/FeedType.php index 3739cb421..7b71670a6 100644 --- a/src/Form/Type/FeedType.php +++ b/src/Form/Type/FeedType.php @@ -30,7 +30,7 @@ class FeedType extends AbstractType ]); } - public function getBlockPrefix() + public function getBlockPrefix(): string { return 'feed_config'; } diff --git a/src/Form/Type/IgnoreOriginInstanceRuleType.php b/src/Form/Type/IgnoreOriginInstanceRuleType.php index c4a4a29b5..440beef52 100644 --- a/src/Form/Type/IgnoreOriginInstanceRuleType.php +++ b/src/Form/Type/IgnoreOriginInstanceRuleType.php @@ -31,7 +31,7 @@ class IgnoreOriginInstanceRuleType extends AbstractType ]); } - public function getBlockPrefix() + public function getBlockPrefix(): string { return 'ignore_origin_instance_rule'; } diff --git a/src/Form/Type/IgnoreOriginUserRuleType.php b/src/Form/Type/IgnoreOriginUserRuleType.php index e4da264c5..122c782d8 100644 --- a/src/Form/Type/IgnoreOriginUserRuleType.php +++ b/src/Form/Type/IgnoreOriginUserRuleType.php @@ -31,7 +31,7 @@ class IgnoreOriginUserRuleType extends AbstractType ]); } - public function getBlockPrefix() + public function getBlockPrefix(): string { return 'ignore_origin_user_rule'; } diff --git a/src/Form/Type/NewEntryType.php b/src/Form/Type/NewEntryType.php index 9892adf74..6dd2eecdd 100644 --- a/src/Form/Type/NewEntryType.php +++ b/src/Form/Type/NewEntryType.php @@ -28,7 +28,7 @@ class NewEntryType extends AbstractType ]); } - public function getBlockPrefix() + public function getBlockPrefix(): string { return 'entry'; } diff --git a/src/Form/Type/NewTagType.php b/src/Form/Type/NewTagType.php index 5f99d8aaf..4f0cbbb08 100644 --- a/src/Form/Type/NewTagType.php +++ b/src/Form/Type/NewTagType.php @@ -37,7 +37,7 @@ class NewTagType extends AbstractType ]); } - public function getBlockPrefix() + public function getBlockPrefix(): string { return 'tag'; } diff --git a/src/Form/Type/NewUserType.php b/src/Form/Type/NewUserType.php index 5a3da7790..459a2f720 100644 --- a/src/Form/Type/NewUserType.php +++ b/src/Form/Type/NewUserType.php @@ -53,7 +53,7 @@ class NewUserType extends AbstractType ]); } - public function getBlockPrefix() + public function getBlockPrefix(): string { return 'new_user'; } diff --git a/src/Form/Type/RenameTagType.php b/src/Form/Type/RenameTagType.php index 0cdabf401..2c27c6f13 100644 --- a/src/Form/Type/RenameTagType.php +++ b/src/Form/Type/RenameTagType.php @@ -29,7 +29,7 @@ class RenameTagType extends AbstractType ]); } - public function getBlockPrefix() + public function getBlockPrefix(): string { return 'tag'; } diff --git a/src/Form/Type/SiteCredentialType.php b/src/Form/Type/SiteCredentialType.php index 294db8ff6..f8b8177a0 100644 --- a/src/Form/Type/SiteCredentialType.php +++ b/src/Form/Type/SiteCredentialType.php @@ -38,7 +38,7 @@ class SiteCredentialType extends AbstractType ]); } - public function getBlockPrefix() + public function getBlockPrefix(): string { return 'site_credential'; } diff --git a/src/Form/Type/TaggingRuleImportType.php b/src/Form/Type/TaggingRuleImportType.php index cd9946042..b07a44a51 100644 --- a/src/Form/Type/TaggingRuleImportType.php +++ b/src/Form/Type/TaggingRuleImportType.php @@ -22,7 +22,7 @@ class TaggingRuleImportType extends AbstractType ; } - public function getBlockPrefix() + public function getBlockPrefix(): string { return 'upload_tagging_rule_file'; } diff --git a/src/Form/Type/TaggingRuleType.php b/src/Form/Type/TaggingRuleType.php index 1aa5da5cb..153a6aad4 100644 --- a/src/Form/Type/TaggingRuleType.php +++ b/src/Form/Type/TaggingRuleType.php @@ -40,7 +40,7 @@ class TaggingRuleType extends AbstractType ]); } - public function getBlockPrefix() + public function getBlockPrefix(): string { return 'tagging_rule'; } diff --git a/src/Form/Type/UploadImportType.php b/src/Form/Type/UploadImportType.php index 301e6a23c..09b793f9e 100644 --- a/src/Form/Type/UploadImportType.php +++ b/src/Form/Type/UploadImportType.php @@ -27,7 +27,7 @@ class UploadImportType extends AbstractType ; } - public function getBlockPrefix() + public function getBlockPrefix(): string { return 'upload_import_file'; } diff --git a/src/Form/Type/UserInformationType.php b/src/Form/Type/UserInformationType.php index a5c633dcd..94020138b 100644 --- a/src/Form/Type/UserInformationType.php +++ b/src/Form/Type/UserInformationType.php @@ -30,7 +30,7 @@ class UserInformationType extends AbstractType ; } - public function getParent() + public function getParent(): ?string { return RegistrationFormType::class; } @@ -42,7 +42,7 @@ class UserInformationType extends AbstractType ]); } - public function getBlockPrefix() + public function getBlockPrefix(): string { return 'update_user'; } diff --git a/src/Import/AbstractImport.php b/src/Import/AbstractImport.php index 9ebe307dd..6fb649a45 100644 --- a/src/Import/AbstractImport.php +++ b/src/Import/AbstractImport.php @@ -37,7 +37,7 @@ abstract class AbstractImport implements ImportInterface $this->eventDispatcher = $eventDispatcher; } - public function setLogger(LoggerInterface $logger) + public function setLogger(LoggerInterface $logger): void { $this->logger = $logger; } diff --git a/src/Operator/PHP/Matches.php b/src/Operator/PHP/Matches.php index cfc5ea96b..7d727bcae 100644 --- a/src/Operator/PHP/Matches.php +++ b/src/Operator/PHP/Matches.php @@ -16,6 +16,10 @@ class Matches { public function __invoke($subject, $pattern) { + if (null === $subject) { + return false; + } + return false !== stripos($subject, $pattern); } } diff --git a/src/Operator/PHP/NotMatches.php b/src/Operator/PHP/NotMatches.php index c78d5cc9b..9942a985f 100644 --- a/src/Operator/PHP/NotMatches.php +++ b/src/Operator/PHP/NotMatches.php @@ -16,6 +16,10 @@ class NotMatches { public function __invoke($subject, $pattern) { + if (null === $subject) { + return true; + } + return false === stripos($subject, $pattern); } } diff --git a/src/ParamConverter/UsernameFeedTokenConverter.php b/src/ParamConverter/UsernameFeedTokenConverter.php index 8001436d6..67807efb9 100644 --- a/src/ParamConverter/UsernameFeedTokenConverter.php +++ b/src/ParamConverter/UsernameFeedTokenConverter.php @@ -33,7 +33,7 @@ class UsernameFeedTokenConverter implements ParamConverterInterface * * Check, if object supported by our converter */ - public function supports(ParamConverter $configuration) + public function supports(ParamConverter $configuration): bool { // If there is no manager, this means that only Doctrine DBAL is configured // In this case we can do nothing and just return @@ -65,7 +65,7 @@ class UsernameFeedTokenConverter implements ParamConverterInterface * @throws \InvalidArgumentException When route attributes are missing * @throws NotFoundHttpException When object not found */ - public function apply(Request $request, ParamConverter $configuration) + public function apply(Request $request, ParamConverter $configuration): bool { $username = $request->attributes->get('username'); $feedToken = $request->attributes->get('token'); diff --git a/src/Repository/Api/ClientRepository.php b/src/Repository/Api/ClientRepository.php index 28ed7389c..926f013db 100644 --- a/src/Repository/Api/ClientRepository.php +++ b/src/Repository/Api/ClientRepository.php @@ -16,7 +16,7 @@ class ClientRepository extends ServiceEntityRepository parent::__construct($registry, Client::class); } - public function findOneBy(array $criteria, ?array $orderBy = null) + public function findOneBy(array $criteria, ?array $orderBy = null): ?object { if (!empty($criteria['id'])) { // cast client id to be an integer to avoid postgres error: diff --git a/src/Twig/WallabagExtension.php b/src/Twig/WallabagExtension.php index 5b37a4408..9c80586e0 100644 --- a/src/Twig/WallabagExtension.php +++ b/src/Twig/WallabagExtension.php @@ -36,7 +36,7 @@ class WallabagExtension extends AbstractExtension implements GlobalsInterface return []; } - public function getFilters() + public function getFilters(): array { return [ new TwigFilter('removeWww', [$this, 'removeWww']), @@ -45,7 +45,7 @@ class WallabagExtension extends AbstractExtension implements GlobalsInterface ]; } - public function getFunctions() + public function getFunctions(): array { return [ new TwigFunction('count_entries', [$this, 'countEntries']),