Fix some self deprecation notices

This commit is contained in:
Yassine Guedidi 2025-01-18 23:56:06 +01:00
parent 5a8b581adf
commit 98ed784af3
47 changed files with 57 additions and 49 deletions

View file

@ -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));

View file

@ -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');

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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;

View file

@ -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') . ' ---');

View file

@ -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 ...');

View file

@ -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;

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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;
}

View file

@ -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',

View file

@ -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

View file

@ -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

View file

@ -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',

View file

@ -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',

View file

@ -25,7 +25,7 @@ class DownloadImagesSubscriber implements EventSubscriberInterface
$this->logger = $logger;
}
public static function getSubscribedEvents()
public static function getSubscribedEvents(): array
{
return [
EntrySavedEvent::NAME => 'onEntrySaved',

View file

@ -18,7 +18,7 @@ class GenerateCustomCSSSubscriber implements EventSubscriberInterface
$this->compiler = $compiler;
}
public static function getSubscribedEvents()
public static function getSubscribedEvents(): array
{
return [
ConfigUpdatedEvent::NAME => 'onConfigUpdated',

View file

@ -15,7 +15,7 @@ class SchemaAdapterSubscriber implements EventSubscriber
$this->databaseTablePrefix = $databaseTablePrefix;
}
public function getSubscribedEvents()
public function getSubscribedEvents(): array
{
return ['postGenerateSchema'];
}

View file

@ -25,7 +25,7 @@ class TablePrefixSubscriber implements EventSubscriber
$this->tablePrefix = (string) $tablePrefix;
}
public function getSubscribedEvents()
public function getSubscribedEvents(): array
{
return ['loadClassMetadata'];
}

View file

@ -45,7 +45,7 @@ class ClientType extends AbstractType
]);
}
public function getBlockPrefix()
public function getBlockPrefix(): string
{
return 'client';
}

View file

@ -41,7 +41,7 @@ class ChangePasswordType extends AbstractType
;
}
public function getBlockPrefix()
public function getBlockPrefix(): string
{
return 'change_passwd';
}

View file

@ -104,7 +104,7 @@ class ConfigType extends AbstractType
]);
}
public function getBlockPrefix()
public function getBlockPrefix(): string
{
return 'config';
}

View file

@ -44,7 +44,7 @@ class EditEntryType extends AbstractType
]);
}
public function getBlockPrefix()
public function getBlockPrefix(): string
{
return 'entry';
}

View file

@ -197,7 +197,7 @@ class EntryFilterType extends AbstractType
;
}
public function getBlockPrefix()
public function getBlockPrefix(): string
{
return 'entry_filter';
}

View file

@ -30,7 +30,7 @@ class FeedType extends AbstractType
]);
}
public function getBlockPrefix()
public function getBlockPrefix(): string
{
return 'feed_config';
}

View file

@ -31,7 +31,7 @@ class IgnoreOriginInstanceRuleType extends AbstractType
]);
}
public function getBlockPrefix()
public function getBlockPrefix(): string
{
return 'ignore_origin_instance_rule';
}

View file

@ -31,7 +31,7 @@ class IgnoreOriginUserRuleType extends AbstractType
]);
}
public function getBlockPrefix()
public function getBlockPrefix(): string
{
return 'ignore_origin_user_rule';
}

View file

@ -28,7 +28,7 @@ class NewEntryType extends AbstractType
]);
}
public function getBlockPrefix()
public function getBlockPrefix(): string
{
return 'entry';
}

View file

@ -37,7 +37,7 @@ class NewTagType extends AbstractType
]);
}
public function getBlockPrefix()
public function getBlockPrefix(): string
{
return 'tag';
}

View file

@ -53,7 +53,7 @@ class NewUserType extends AbstractType
]);
}
public function getBlockPrefix()
public function getBlockPrefix(): string
{
return 'new_user';
}

View file

@ -29,7 +29,7 @@ class RenameTagType extends AbstractType
]);
}
public function getBlockPrefix()
public function getBlockPrefix(): string
{
return 'tag';
}

View file

@ -38,7 +38,7 @@ class SiteCredentialType extends AbstractType
]);
}
public function getBlockPrefix()
public function getBlockPrefix(): string
{
return 'site_credential';
}

View file

@ -22,7 +22,7 @@ class TaggingRuleImportType extends AbstractType
;
}
public function getBlockPrefix()
public function getBlockPrefix(): string
{
return 'upload_tagging_rule_file';
}

View file

@ -40,7 +40,7 @@ class TaggingRuleType extends AbstractType
]);
}
public function getBlockPrefix()
public function getBlockPrefix(): string
{
return 'tagging_rule';
}

View file

@ -27,7 +27,7 @@ class UploadImportType extends AbstractType
;
}
public function getBlockPrefix()
public function getBlockPrefix(): string
{
return 'upload_import_file';
}

View file

@ -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';
}

View file

@ -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;
}

View file

@ -16,6 +16,10 @@ class Matches
{
public function __invoke($subject, $pattern)
{
if (null === $subject) {
return false;
}
return false !== stripos($subject, $pattern);
}
}

View file

@ -16,6 +16,10 @@ class NotMatches
{
public function __invoke($subject, $pattern)
{
if (null === $subject) {
return true;
}
return false === stripos($subject, $pattern);
}
}

View file

@ -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');

View file

@ -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:

View file

@ -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']),