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
Expand Up @@ -29,10 +29,10 @@
*
* @author Javier Eguiluz <javier.eguiluz@gmail.com>
*/
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
Expand Up @@ -26,14 +26,14 @@
*
* @author Oleg Voronkovich <oleg-voronkovich@yandex.ru>
*/
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
Expand Up @@ -23,10 +23,10 @@
* @author Ryan Weaver <weaverryan@gmail.com>
* @author Javier Eguiluz <javier.eguiluz@gmail.com>
*/
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
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
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
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.