8000 minor #17699 [Uid] Use constructor property promotion for UuidFactory… · symfony/symfony-docs@8677542 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8677542

Browse files
committed
minor #17699 [Uid] Use constructor property promotion for UuidFactory and UlidFactory examples (alexandre-daubois)
This PR was merged into the 6.0 branch. Discussion ---------- [Uid] Use constructor property promotion for UuidFactory and UlidFactory examples Following `@OskarStark`'s idea (#17690 (comment)), here is a little improvement on Uid factories for 6.0+ 👍 Commits ------- 5232e0d [Uid] Use constructor property promotion for UuidFactory and UlidFactory examples
2 parents 6f2875c + 5232e0d commit 8677542

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

components/uid.rst

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,8 @@ on the configuration you defined::
146146

147147
class FooService
148148
{
149-
private UuidFactory $uuidFactory;
150-
151-
public function __construct(UuidFactory $uuidFactory)
149+
public function __construct(private UuidFactory $uuidFactory)
152150
{
153-
$this->uuidFactory = $uuidFactory;
154151
}
155152

156153
public function generate(): void
@@ -337,11 +334,8 @@ Like UUIDs, ULIDs have their own factory, ``UlidFactory``, that can be used to g
337334

338335
class FooService
339336
{
340-
private UlidFactory $ulidFactory;
341-
342-
public function __construct(UlidFactory $ulidFactory)
337+
public function __construct(private UlidFactory $ulidFactory)
343338
{
344-
$this->ulidFactory = $ulidFactory;
345339
}
346340

347341
public function generate(): void

0 commit comments

Comments
 (0)
0