Skip to content

Commit

Permalink
minor #1515 Mark some properties and classes as readonly (javiereguiluz)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
javiereguiluz committed Apr 16, 2024
2 parents 31fad76 + 06f3d60 commit b02544a
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
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

0 comments on commit b02544a

Please sign in to comment.