Skip to content

Commit b02544a

Browse files
committed
minor #1515 Mark some properties and classes as readonly (javiereguiluz)
This PR was merged into the main branch. Discussion ---------- Mark some properties and classes as readonly Commits ------- 06f3d60 Mark some properties and classes as readonly
2 parents 31fad76 + 06f3d60 commit b02544a

6 files changed

+13
-13
lines changed

src/EventSubscriber/CheckRequirementsSubscriber.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@
2929
*
3030
* @author Javier Eguiluz <[email protected]>
3131
*/
32-
final class CheckRequirementsSubscriber implements EventSubscriberInterface
32+
final readonly class CheckRequirementsSubscriber implements EventSubscriberInterface
3333
{
3434
public function __construct(
35-
private readonly EntityManagerInterface $entityManager
35+
private EntityManagerInterface $entityManager
3636
) {
3737
}
3838

src/EventSubscriber/CommentNotificationSubscriber.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@
2626
*
2727
* @author Oleg Voronkovich <[email protected]>
2828
*/
29-
final class CommentNotificationSubscriber implements EventSubscriberInterface
29+
final readonly class CommentNotificationSubscriber implements EventSubscriberInterface
3030
{
3131
public function __construct(
32-
private readonly MailerInterface $mailer,
33-
private readonly UrlGeneratorInterface $urlGenerator,
34-
private readonly TranslatorInterface $translator,
32+
private MailerInterface $mailer,
33+
private UrlGeneratorInterface $urlGenerator,
34+
private TranslatorInterface $translator,
3535
#[Autowire('%app.notifications.email_sender%')]
36-
private readonly string $sender
36+
private string $sender
3737
) {
3838
}
3939

src/EventSubscriber/ControllerSubscriber.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@
2323
* @author Ryan Weaver <[email protected]>
2424
* @author Javier Eguiluz <[email protected]>
2525
*/
26-
final class ControllerSubscriber implements EventSubscriberInterface
26+
final readonly class ControllerSubscriber implements EventSubscriberInterface
2727
{
2828
public function __construct(
29-
private readonly SourceCodeExtension $twigExtension
29+
private SourceCodeExtension $twigExtension
3030
) {
3131
}
3232

src/Form/DataTransformer/TagArrayToStringTransformer.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@
2727
*
2828
* @template-implements DataTransformerInterface<Tag[], string>
2929
*/
30-
final class TagArrayToStringTransformer implements DataTransformerInterface
30+
final readonly class TagArrayToStringTransformer implements DataTransformerInterface
3131
{
3232
public function __construct(
33-
private readonly TagRepository $tags
33+
private TagRepository $tags
3434
) {
3535
}
3636

src/Twig/AppExtension.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ final class AppExtension extends AbstractExtension
3333
// See https://symfony.com/doc/current/service_container.html#binding-arguments-by-name-or-type
3434
public function __construct(
3535
/** @var string[] */
36-
private array $enabledLocales,
36+
private readonly array $enabledLocales,
3737
) {
3838
}
3939

src/Twig/SourceCodeExtension.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ final class SourceCodeExtension extends AbstractExtension
3636
private $controller;
3737

3838
public function __construct(
39-
private FileLinkFormatter $fileLinkFormat,
39+
private readonly FileLinkFormatter $fileLinkFormat,
4040
#[Autowire('%kernel.project_dir%')]
4141
private string $projectDir,
4242
) {

0 commit comments

Comments
 (0)