Skip to content

Commit 26ec8d2

Browse files
use readonly in args of construct, in components/
1 parent 9f8ca28 commit 26ec8d2

File tree

9 files changed

+13
-13
lines changed

9 files changed

+13
-13
lines changed

components/clock.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ determine the current time::
5050
class ExpirationChecker
5151
{
5252
public function __construct(
53-
private ClockInterface $clock
53+
private readonly ClockInterface $clock
5454
) {}
5555

5656
public function isExpired(DateTimeInterface $validUntil): bool

components/console/logger.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ PSR-3 compliant logger::
2020
class MyDependency
2121
{
2222
public function __construct(
23-
private LoggerInterface $logger,
23+
private readonly LoggerInterface $logger,
2424
) {
2525
}
2626

components/dependency_injection.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ so this is passed into the constructor::
5959
class Mailer
6060
{
6161
public function __construct(
62-
private $transport,
62+
private readonly $transport,
6363
) {
6464
}
6565

components/http_foundation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,7 @@ methods. You can inject this as a service anywhere in your application::
791791
class UserApiNormalizer
792792
{
793793
public function __construct(
794-
private UrlHelper $urlHelper,
794+
private readonly UrlHelper $urlHelper,
795795
) {
796796
}
797797

components/messenger.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ you can create your own message sender::
235235
class ImportantActionToEmailSender implements SenderInterface
236236
{
237237
public function __construct(
238-
private MailerInterface $mailer,
238+
private readonly MailerInterface $mailer,
239239
private string $toEmail,
240240
) {
241241
}
@@ -284,8 +284,8 @@ do is to write your own CSV receiver::
284284
class NewOrdersFromCsvFileReceiver implements ReceiverInterface
285285
{
286286
public function __construct(
287-
private SerializerInterface $serializer,
288-
private string $filePath,
287+
private readonly SerializerInterface $serializer,
288+
private readonly string $filePath,
289289
) {
290290
}
291291

components/phpunit_bridge.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -953,7 +953,7 @@ Consider the following example::
953953
class Foo
954954
{
955955
public function __construct(
956-
private Bar $bar,
956+
private readonly Bar $bar,
957957
) {
958958
}
959959

components/runtime.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,8 +406,8 @@ is added in a new class implementing :class:`Symfony\\Component\\Runtime\\Runner
406406
class ReactPHPRunner implements RunnerInterface
407407
{
408408
public function __construct(
409-
private RequestHandlerInterface $application,
410-
private int $port,
409+
private readonly RequestHandlerInterface $application,
410+
private readonly int $port,
411411
) {
412412
}
413413

components/string.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ the injected slugger is the same as the request locale::
554554
class MyService
555555
{
556556
public function __construct(
557-
private SluggerInterface $slugger,
557+
private readonly SluggerInterface $slugger,
558558
) {
559559
}
560560

components/uid.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ on the configuration you defined::
158158
class FooService
159159
{
160160
public function __construct(
161-
private UuidFactory $uuidFactory,
161+
private readonly UuidFactory $uuidFactory,
162162
) {
163163
}
164164

@@ -358,7 +358,7 @@ Like UUIDs, ULIDs have their own factory, ``UlidFactory``, that can be used to g
358358
class FooService
359359
{
360360
public function __construct(
361-
private UlidFactory $ulidFactory,
361+
private readonly UlidFactory $ulidFactory,
362362
) {
363363
}
364364

0 commit comments

Comments
 (0)