diff --git a/config/services.yaml b/config/services.yaml index e4f668ccd..ef61daaca 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -15,9 +15,9 @@ services: autowire: true # Automatically injects dependencies in your services. autoconfigure: true # Automatically registers your services as commands, event subscribers, etc. bind: # defines the scalar arguments once and apply them to any service defined/created in this file - $locales: '%app_locales%' - $defaultLocale: '%locale%' - $emailSender: '%app.notifications.email_sender%' + string $locales: '%app_locales%' + string $defaultLocale: '%locale%' + string $emailSender: '%app.notifications.email_sender%' # makes classes in src/ available to be used as services # this creates a service per class whose id is the fully-qualified class name diff --git a/src/Command/ListUsersCommand.php b/src/Command/ListUsersCommand.php index 31703baf7..a1c8158c8 100644 --- a/src/Command/ListUsersCommand.php +++ b/src/Command/ListUsersCommand.php @@ -46,7 +46,7 @@ class ListUsersCommand extends Command private $emailSender; private $users; - public function __construct(MailerInterface $mailer, $emailSender, UserRepository $users) + public function __construct(MailerInterface $mailer, string $emailSender, UserRepository $users) { parent::__construct(); diff --git a/src/Entity/Post.php b/src/Entity/Post.php index b9dd28403..479e481d8 100644 --- a/src/Entity/Post.php +++ b/src/Entity/Post.php @@ -93,7 +93,7 @@ class Post private $author; /** - * @var Comment[]|ArrayCollection + * @var Comment[]|Collection * * @ORM\OneToMany( * targetEntity="Comment", @@ -106,7 +106,7 @@ class Post private $comments; /** - * @var Tag[]|ArrayCollection + * @var Tag[]|Collection * * @ORM\ManyToMany(targetEntity="App\Entity\Tag", cascade={"persist"}) * @ORM\JoinTable(name="symfony_demo_post_tag") diff --git a/src/EventSubscriber/CommentNotificationSubscriber.php b/src/EventSubscriber/CommentNotificationSubscriber.php index 35f194cd4..07675e746 100644 --- a/src/EventSubscriber/CommentNotificationSubscriber.php +++ b/src/EventSubscriber/CommentNotificationSubscriber.php @@ -31,7 +31,7 @@ class CommentNotificationSubscriber implements EventSubscriberInterface private $urlGenerator; private $sender; - public function __construct(MailerInterface $mailer, UrlGeneratorInterface $urlGenerator, TranslatorInterface $translator, $sender) + public function __construct(MailerInterface $mailer, UrlGeneratorInterface $urlGenerator, TranslatorInterface $translator, string $sender) { $this->mailer = $mailer; $this->urlGenerator = $urlGenerator; diff --git a/src/Form/Type/DateTimePickerType.php b/src/Form/Type/DateTimePickerType.php index 83a18802f..59aca6c30 100644 --- a/src/Form/Type/DateTimePickerType.php +++ b/src/Form/Type/DateTimePickerType.php @@ -61,7 +61,7 @@ public function configureOptions(OptionsResolver $resolver): void /** * {@inheritdoc} */ - public function getParent() + public function getParent(): ?string { return DateTimeType::class; } diff --git a/src/Form/Type/TagsInputType.php b/src/Form/Type/TagsInputType.php index 8371a4cf5..5cc4b4ecd 100644 --- a/src/Form/Type/TagsInputType.php +++ b/src/Form/Type/TagsInputType.php @@ -63,7 +63,7 @@ public function buildView(FormView $view, FormInterface $form, array $options): /** * {@inheritdoc} */ - public function getParent() + public function getParent(): ?string { return TextType::class; } diff --git a/src/Security/PostVoter.php b/src/Security/PostVoter.php index fbf7e6370..d4af08a8b 100644 --- a/src/Security/PostVoter.php +++ b/src/Security/PostVoter.php @@ -35,7 +35,7 @@ class PostVoter extends Voter /** * {@inheritdoc} */ - protected function supports($attribute, $subject): bool + protected function supports(string $attribute, $subject): bool { // this voter is only executed for three specific permissions on Post objects return $subject instanceof Post && \in_array($attribute, [self::SHOW, self::EDIT, self::DELETE], true); @@ -43,8 +43,10 @@ protected function supports($attribute, $subject): bool /** * {@inheritdoc} + * + * @param Post $post */ - protected function voteOnAttribute($attribute, $post, TokenInterface $token): bool + protected function voteOnAttribute(string $attribute, $post, TokenInterface $token): bool { $user = $token->getUser(); diff --git a/src/Twig/SourceCodeExtension.php b/src/Twig/SourceCodeExtension.php index f37a0ffde..0fc8bca59 100644 --- a/src/Twig/SourceCodeExtension.php +++ b/src/Twig/SourceCodeExtension.php @@ -46,6 +46,9 @@ public function getFunctions(): array ]; } + /** + * @param string|TemplateWrapper|array $template + */ public function showSourceCode(Environment $twig, $template): string { return $twig->render('debug/source_code.html.twig', [ @@ -94,10 +97,7 @@ private function getCallableReflector(callable $callable): \ReflectionFunctionAb return new \ReflectionFunction($callable); } - /** - * @param TemplateWrapper|Template $template - */ - private function getTemplateSource($template): array + private function getTemplateSource(TemplateWrapper $template): array { $templateSource = $template->getSourceContext();