Skip to content

Commit c41d35b

Browse files
Use CPP where possible
1 parent 58edfde commit c41d35b

File tree

3 files changed

+14
-19
lines changed

3 files changed

+14
-19
lines changed

Alias.php

+3-4
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,11 @@
1515

1616
class Alias
1717
{
18-
private string $id;
1918
private array $deprecation = [];
2019

21-
public function __construct(string $id)
22-
{
23-
$this->id = $id;
20+
public function __construct(
21+
private string $id,
22+
) {
2423
}
2524

2625
public function withId(string $id): static

Matcher/Dumper/StaticPrefixCollection.php

+3-5
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323
*/
2424
class StaticPrefixCollection
2525
{
26-
private string $prefix;
27-
2826
/**
2927
* @var string[]
3028
*/
@@ -40,9 +38,9 @@ class StaticPrefixCollection
4038
*/
4139
private array $items = [];
4240

43-
public function __construct(string $prefix = '/')
44-
{
45-
$this->prefix = $prefix;
41+
public function __construct(
42+
private string $prefix = '/',
43+
) {
4644
}
4745

4846
public function getPrefix(): string

Router.php

+8-10
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,8 @@ class Router implements RouterInterface, RequestMatcherInterface
4040
protected UrlMatcherInterface|RequestMatcherInterface $matcher;
4141
protected UrlGeneratorInterface $generator;
4242
protected RequestContext $context;
43-
protected LoaderInterface $loader;
4443
protected RouteCollection $collection;
45-
protected mixed $resource;
4644
protected array $options = [];
47-
protected ?LoggerInterface $logger;
48-
protected ?string $defaultLocale;
4945

5046
private ConfigCacheFactoryInterface $configCacheFactory;
5147

@@ -56,14 +52,16 @@ class Router implements RouterInterface, RequestMatcherInterface
5652

5753
private static ?array $cache = [];
5854

59-
public function __construct(LoaderInterface $loader, mixed $resource, array $options = [], ?RequestContext $context = null, ?LoggerInterface $logger = null, ?string $defaultLocale = null)
60-
{
61-
$this->loader = $loader;
62-
$this->resource = $resource;
63-
$this->logger = $logger;
55+
public function __construct(
56+
protected LoaderInterface $loader,
57+
protected mixed $resource,
58+
array $options = [],
59+
?RequestContext $context = null,
60+
protected ?LoggerInterface $logger = null,
61+
protected ?string $defaultLocale = null,
62+
) {
6463
$this->context = $context ?? new RequestContext();
6564
$this->setOptions($options);
66-
$this->defaultLocale = $defaultLocale;
6765
}
6866

6967
/**

0 commit comments

Comments
 (0)