Skip to content

Commit 6f9e578

Browse files
minor symfony#53279 [Uid] Use CPP (OskarStark)
This PR was squashed before being merged into the 7.1 branch. Discussion ---------- [Uid] Use CPP | Q | A | ------------- | --- | Branch? | 7.1 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | -- | License | MIT Commits ------- a050bde [Uid] Use CPP
2 parents c8adc20 + a050bde commit 6f9e578

File tree

5 files changed

+20
-34
lines changed

5 files changed

+20
-34
lines changed

src/Symfony/Component/Uid/Command/GenerateUlidCommand.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,9 @@
2525
#[AsCommand(name: 'ulid:generate', description: 'Generate a ULID')]
2626
class GenerateUlidCommand extends Command
2727
{
28-
private UlidFactory $factory;
29-
30-
public function __construct(UlidFactory $factory = null)
31-
{
32-
$this->factory = $factory ?? new UlidFactory();
33-
28+
public function __construct(
29+
private UlidFactory $factory = new UlidFactory(),
30+
) {
3431
parent::__construct();
3532
}
3633

src/Symfony/Component/Uid/Command/GenerateUuidCommand.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,9 @@
2626
#[AsCommand(name: 'uuid:generate', description: 'Generate a UUID')]
2727
class GenerateUuidCommand extends Command
2828
{
29-
private UuidFactory $factory;
30-
31-
public function __construct(UuidFactory $factory = null)
32-
{
33-
$this->factory = $factory ?? new UuidFactory();
34-
29+
public function __construct(
30+
private UuidFactory $factory = new UuidFactory(),
31+
) {
3532
parent::__construct();
3633
}
3734

src/Symfony/Component/Uid/Factory/NameBasedUuidFactory.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,10 @@
1717

1818
class NameBasedUuidFactory
1919
{
20-
private string $class;
21-
private Uuid $namespace;
22-
23-
public function __construct(string $class, Uuid $namespace)
24-
{
25-
$this->class = $class;
26-
$this->namespace = $namespace;
20+
public function __construct(
21+
private string $class,
22+
private Uuid $namespace,
23+
) {
2724
}
2825

2926
public function create(string $name): UuidV5|UuidV3

src/Symfony/Component/Uid/Factory/RandomBasedUuidFactory.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@
1515

1616
class RandomBasedUuidFactory
1717
{
18-
private string $class;
19-
20-
public function __construct(string $class)
21-
{
22-
$this->class = $class;
18+
/**
19+
* @param class-string $class
20+
*/
21+
public function __construct(
22+
private string $class,
23+
) {
2324
}
2425

2526
public function create(): UuidV4

src/Symfony/Component/Uid/Factory/TimeBasedUuidFactory.php

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,13 @@
1616

1717
class TimeBasedUuidFactory
1818
{
19-
/**
20-
* @var class-string<Uuid&TimeBasedUidInterface>
21-
*/
22-
private string $class;
23-
private ?Uuid $node;
24-
2519
/**
2620
* @param class-string<Uuid&TimeBasedUidInterface> $class
2721
*/
28-
public function __construct(string $class, Uuid $node = null)
29-
{
30-
$this->class = $class;
31-
$this->node = $node;
22+
public function __construct(
23+
private string $class,
24+
private ?Uuid $node = null
25+
) {
3226
}
3327

3428
public function create(\DateTimeInterface $time = null): Uuid&TimeBasedUidInterface

0 commit comments

Comments
 (0)