diff --git a/composer.lock b/composer.lock index 9002aa0c8..d422cb238 100644 --- a/composer.lock +++ b/composer.lock @@ -8094,16 +8094,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.5", + "version": "1.10.6", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "1fb6f494d82455151ecf15c5c191923f5d84324e" + "reference": "50d089a3e0904b0fe7e2cf2d4fd37d427d64235a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/1fb6f494d82455151ecf15c5c191923f5d84324e", - "reference": "1fb6f494d82455151ecf15c5c191923f5d84324e", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/50d089a3e0904b0fe7e2cf2d4fd37d427d64235a", + "reference": "50d089a3e0904b0fe7e2cf2d4fd37d427d64235a", "shasum": "" }, "require": { @@ -8133,7 +8133,7 @@ ], "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.10.5" + "source": "https://github.com/phpstan/phpstan/tree/1.10.6" }, "funding": [ { @@ -8149,20 +8149,20 @@ "type": "tidelift" } ], - "time": "2023-03-07T16:48:45+00:00" + "time": "2023-03-09T16:55:12+00:00" }, { "name": "phpstan/phpstan-doctrine", - "version": "1.3.33", + "version": "1.3.35", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-doctrine.git", - "reference": "fcb67c2a747300ff8e6ae278191f6ff79fc90370" + "reference": "3dbb999bd56cc21d6733bab60898ebdf388245b5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-doctrine/zipball/fcb67c2a747300ff8e6ae278191f6ff79fc90370", - "reference": "fcb67c2a747300ff8e6ae278191f6ff79fc90370", + "url": "https://api.github.com/repos/phpstan/phpstan-doctrine/zipball/3dbb999bd56cc21d6733bab60898ebdf388245b5", + "reference": "3dbb999bd56cc21d6733bab60898ebdf388245b5", "shasum": "" }, "require": { @@ -8217,9 +8217,9 @@ "description": "Doctrine extensions for PHPStan", "support": { "issues": "https://github.com/phpstan/phpstan-doctrine/issues", - "source": "https://github.com/phpstan/phpstan-doctrine/tree/1.3.33" + "source": "https://github.com/phpstan/phpstan-doctrine/tree/1.3.35" }, - "time": "2023-02-21T08:52:52+00:00" + "time": "2023-03-10T14:43:05+00:00" }, { "name": "phpstan/phpstan-symfony", diff --git a/src/Command/AddUserCommand.php b/src/Command/AddUserCommand.php index 2bd4d24b5..6bb2f5e48 100644 --- a/src/Command/AddUserCommand.php +++ b/src/Command/AddUserCommand.php @@ -56,10 +56,10 @@ class AddUserCommand extends Command private SymfonyStyle $io; public function __construct( - private EntityManagerInterface $entityManager, - private UserPasswordHasherInterface $passwordHasher, - private Validator $validator, - private UserRepository $users + private readonly EntityManagerInterface $entityManager, + private readonly UserPasswordHasherInterface $passwordHasher, + private readonly Validator $validator, + private readonly UserRepository $users ) { parent::__construct(); } @@ -124,7 +124,7 @@ protected function interact(InputInterface $input, OutputInterface $output): voi if (null !== $username) { $this->io->text(' > Username: '.$username); } else { - $username = $this->io->ask('Username', null, [$this->validator, 'validateUsername']); + $username = $this->io->ask('Username', null, $this->validator->validateUsername(...)); $input->setArgument('username', $username); } @@ -135,7 +135,7 @@ protected function interact(InputInterface $input, OutputInterface $output): voi if (null !== $password) { $this->io->text(' > Password: '.u('*')->repeat(u($password)->length())); } else { - $password = $this->io->askHidden('Password (your type will be hidden)', [$this->validator, 'validatePassword']); + $password = $this->io->askHidden('Password (your type will be hidden)', $this->validator->validatePassword(...)); $input->setArgument('password', $password); } @@ -144,7 +144,7 @@ protected function interact(InputInterface $input, OutputInterface $output): voi if (null !== $email) { $this->io->text(' > Email: '.$email); } else { - $email = $this->io->ask('Email', null, [$this->validator, 'validateEmail']); + $email = $this->io->ask('Email', null, $this->validator->validateEmail(...)); $input->setArgument('email', $email); } @@ -153,7 +153,7 @@ protected function interact(InputInterface $input, OutputInterface $output): voi if (null !== $fullName) { $this->io->text(' > Full Name: '.$fullName); } else { - $fullName = $this->io->ask('Full Name', null, [$this->validator, 'validateFullName']); + $fullName = $this->io->ask('Full Name', null, $this->validator->validateFullName(...)); $input->setArgument('full-name', $fullName); } } diff --git a/src/Command/DeleteUserCommand.php b/src/Command/DeleteUserCommand.php index 3da9f4730..1ec8716ed 100644 --- a/src/Command/DeleteUserCommand.php +++ b/src/Command/DeleteUserCommand.php @@ -48,10 +48,10 @@ class DeleteUserCommand extends Command private SymfonyStyle $io; public function __construct( - private EntityManagerInterface $entityManager, - private Validator $validator, - private UserRepository $users, - private LoggerInterface $logger + private readonly EntityManagerInterface $entityManager, + private readonly Validator $validator, + private readonly UserRepository $users, + private readonly LoggerInterface $logger ) { parent::__construct(); } @@ -101,7 +101,7 @@ protected function interact(InputInterface $input, OutputInterface $output): voi '', ]); - $username = $this->io->ask('Username', null, [$this->validator, 'validateUsername']); + $username = $this->io->ask('Username', null, $this->validator->validateUsername(...)); $input->setArgument('username', $username); } diff --git a/src/Command/ListUsersCommand.php b/src/Command/ListUsersCommand.php index 68af9f036..43e5fd7bd 100644 --- a/src/Command/ListUsersCommand.php +++ b/src/Command/ListUsersCommand.php @@ -46,9 +46,9 @@ class ListUsersCommand extends Command { public function __construct( - private MailerInterface $mailer, - private string $emailSender, - private UserRepository $users + private readonly MailerInterface $mailer, + private readonly string $emailSender, + private readonly UserRepository $users ) { parent::__construct(); } diff --git a/src/DataFixtures/AppFixtures.php b/src/DataFixtures/AppFixtures.php index 9bf77a391..69b8c60f0 100644 --- a/src/DataFixtures/AppFixtures.php +++ b/src/DataFixtures/AppFixtures.php @@ -25,8 +25,8 @@ class AppFixtures extends Fixture { public function __construct( - private UserPasswordHasherInterface $passwordHasher, - private SluggerInterface $slugger + private readonly UserPasswordHasherInterface $passwordHasher, + private readonly SluggerInterface $slugger ) { } diff --git a/src/EventSubscriber/CheckRequirementsSubscriber.php b/src/EventSubscriber/CheckRequirementsSubscriber.php index fb485bf76..538cc969d 100644 --- a/src/EventSubscriber/CheckRequirementsSubscriber.php +++ b/src/EventSubscriber/CheckRequirementsSubscriber.php @@ -32,7 +32,7 @@ class CheckRequirementsSubscriber implements EventSubscriberInterface { public function __construct( - private EntityManagerInterface $entityManager + private readonly EntityManagerInterface $entityManager ) { } diff --git a/src/EventSubscriber/CommentNotificationSubscriber.php b/src/EventSubscriber/CommentNotificationSubscriber.php index 5e2a981a4..9f63ffdcc 100644 --- a/src/EventSubscriber/CommentNotificationSubscriber.php +++ b/src/EventSubscriber/CommentNotificationSubscriber.php @@ -28,10 +28,10 @@ class CommentNotificationSubscriber implements EventSubscriberInterface { public function __construct( - private MailerInterface $mailer, - private UrlGeneratorInterface $urlGenerator, - private TranslatorInterface $translator, - private string $sender + private readonly MailerInterface $mailer, + private readonly UrlGeneratorInterface $urlGenerator, + private readonly TranslatorInterface $translator, + private readonly string $sender ) { } diff --git a/src/EventSubscriber/ControllerSubscriber.php b/src/EventSubscriber/ControllerSubscriber.php index d72fb3cb3..b44827e0e 100644 --- a/src/EventSubscriber/ControllerSubscriber.php +++ b/src/EventSubscriber/ControllerSubscriber.php @@ -26,7 +26,7 @@ class ControllerSubscriber implements EventSubscriberInterface { public function __construct( - private SourceCodeExtension $twigExtension + private readonly SourceCodeExtension $twigExtension ) { } diff --git a/src/EventSubscriber/RedirectToPreferredLocaleSubscriber.php b/src/EventSubscriber/RedirectToPreferredLocaleSubscriber.php index ed1c9dc5a..849f7e1f5 100644 --- a/src/EventSubscriber/RedirectToPreferredLocaleSubscriber.php +++ b/src/EventSubscriber/RedirectToPreferredLocaleSubscriber.php @@ -32,10 +32,10 @@ class RedirectToPreferredLocaleSubscriber implements EventSubscriberInterface * @var string[] */ private array $locales; - private string $defaultLocale; + private readonly string $defaultLocale; public function __construct( - private UrlGeneratorInterface $urlGenerator, + private readonly UrlGeneratorInterface $urlGenerator, string $locales, ?string $defaultLocale = null ) { diff --git a/src/Form/DataTransformer/TagArrayToStringTransformer.php b/src/Form/DataTransformer/TagArrayToStringTransformer.php index 6b9cd0b5d..1579c74e8 100644 --- a/src/Form/DataTransformer/TagArrayToStringTransformer.php +++ b/src/Form/DataTransformer/TagArrayToStringTransformer.php @@ -30,7 +30,7 @@ class TagArrayToStringTransformer implements DataTransformerInterface { public function __construct( - private TagRepository $tags + private readonly TagRepository $tags ) { } diff --git a/src/Form/PostType.php b/src/Form/PostType.php index b0c398b5a..fbef7287c 100644 --- a/src/Form/PostType.php +++ b/src/Form/PostType.php @@ -33,7 +33,7 @@ class PostType extends AbstractType { // Form types are services, so you can inject other services in them if needed public function __construct( - private SluggerInterface $slugger + private readonly SluggerInterface $slugger ) { } diff --git a/src/Form/Type/DateTimePickerType.php b/src/Form/Type/DateTimePickerType.php index 33e8d968f..b33d0e4d3 100644 --- a/src/Form/Type/DateTimePickerType.php +++ b/src/Form/Type/DateTimePickerType.php @@ -30,7 +30,7 @@ class DateTimePickerType extends AbstractType { public function __construct( - private MomentFormatConverter $formatConverter + private readonly MomentFormatConverter $formatConverter ) { } diff --git a/src/Form/Type/TagsInputType.php b/src/Form/Type/TagsInputType.php index 788e856ef..920b764a1 100644 --- a/src/Form/Type/TagsInputType.php +++ b/src/Form/Type/TagsInputType.php @@ -31,7 +31,7 @@ class TagsInputType extends AbstractType { public function __construct( - private TagRepository $tags + private readonly TagRepository $tags ) { } diff --git a/src/Pagination/Paginator.php b/src/Pagination/Paginator.php index dbfe4f3b0..e6c465b2a 100644 --- a/src/Pagination/Paginator.php +++ b/src/Pagination/Paginator.php @@ -26,7 +26,7 @@ class Paginator * * See https://symfony.com/doc/current/best_practices.html#use-constants-to-define-options-that-rarely-change */ - public const PAGE_SIZE = 10; + final public const PAGE_SIZE = 10; private int $currentPage; private int $numResults; @@ -37,8 +37,8 @@ class Paginator private \Traversable $results; public function __construct( - private DoctrineQueryBuilder $queryBuilder, - private int $pageSize = self::PAGE_SIZE + private readonly DoctrineQueryBuilder $queryBuilder, + private readonly int $pageSize = self::PAGE_SIZE ) { } diff --git a/src/Twig/AppExtension.php b/src/Twig/AppExtension.php index 993a80f48..e5fa08682 100644 --- a/src/Twig/AppExtension.php +++ b/src/Twig/AppExtension.php @@ -27,7 +27,7 @@ class AppExtension extends AbstractExtension /** * @var string[] */ - private array $localeCodes; + private readonly array $localeCodes; /** * @var list|null @@ -46,7 +46,7 @@ public function __construct(string $locales) public function getFunctions(): array { return [ - new TwigFunction('locales', [$this, 'getLocales']), + new TwigFunction('locales', $this->getLocales(...)), ]; }