Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark some properties and classes as readonly #1515

Merged
merged 1 commit into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/EventSubscriber/CheckRequirementsSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@
*
* @author Javier Eguiluz <[email protected]>
*/
final class CheckRequirementsSubscriber implements EventSubscriberInterface
final readonly class CheckRequirementsSubscriber implements EventSubscriberInterface
{
public function __construct(
private readonly EntityManagerInterface $entityManager
private EntityManagerInterface $entityManager
) {
}

Expand Down
10 changes: 5 additions & 5 deletions src/EventSubscriber/CommentNotificationSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@
*
* @author Oleg Voronkovich <[email protected]>
*/
final class CommentNotificationSubscriber implements EventSubscriberInterface
final readonly class CommentNotificationSubscriber implements EventSubscriberInterface
{
public function __construct(
private readonly MailerInterface $mailer,
private readonly UrlGeneratorInterface $urlGenerator,
private readonly TranslatorInterface $translator,
private MailerInterface $mailer,
private UrlGeneratorInterface $urlGenerator,
private TranslatorInterface $translator,
#[Autowire('%app.notifications.email_sender%')]
private readonly string $sender
private string $sender
) {
}

Expand Down
4 changes: 2 additions & 2 deletions src/EventSubscriber/ControllerSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
* @author Ryan Weaver <[email protected]>
* @author Javier Eguiluz <[email protected]>
*/
final class ControllerSubscriber implements EventSubscriberInterface
final readonly class ControllerSubscriber implements EventSubscriberInterface
{
public function __construct(
private readonly SourceCodeExtension $twigExtension
private SourceCodeExtension $twigExtension
) {
}

Expand Down
4 changes: 2 additions & 2 deletions src/Form/DataTransformer/TagArrayToStringTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
*
* @template-implements DataTransformerInterface<Tag[], string>
*/
final class TagArrayToStringTransformer implements DataTransformerInterface
final readonly class TagArrayToStringTransformer implements DataTransformerInterface
{
public function __construct(
private readonly TagRepository $tags
private TagRepository $tags
) {
}

Expand Down
2 changes: 1 addition & 1 deletion src/Twig/AppExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ final class AppExtension extends AbstractExtension
// See https://symfony.com/doc/current/service_container.html#binding-arguments-by-name-or-type
public function __construct(
/** @var string[] */
private array $enabledLocales,
private readonly array $enabledLocales,
) {
}

Expand Down
2 changes: 1 addition & 1 deletion src/Twig/SourceCodeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ final class SourceCodeExtension extends AbstractExtension
private $controller;

public function __construct(
private FileLinkFormatter $fileLinkFormat,
private readonly FileLinkFormatter $fileLinkFormat,
#[Autowire('%kernel.project_dir%')]
private string $projectDir,
) {
Expand Down