Skip to content

Commit d99ca6e

Browse files
Use CPP where possible
1 parent beff62f commit d99ca6e

File tree

6 files changed

+34
-33
lines changed

6 files changed

+34
-33
lines changed

CacheWarmer/CachePoolClearerCacheWarmer.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,13 @@
2525
*/
2626
final class CachePoolClearerCacheWarmer implements CacheWarmerInterface
2727
{
28-
private Psr6CacheClearer $poolClearer;
29-
private array $pools;
30-
3128
/**
3229
* @param string[] $pools
3330
*/
34-
public function __construct(Psr6CacheClearer $poolClearer, array $pools = [])
35-
{
36-
$this->poolClearer = $poolClearer;
37-
$this->pools = $pools;
31+
public function __construct(
32+
private Psr6CacheClearer $poolClearer,
33+
private array $pools = [],
34+
) {
3835
}
3936

4037
public function warmUp(string $cacheDir, ?string $buildDir = null): array

CacheWarmer/ConfigBuilderCacheWarmer.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,10 @@
3434
*/
3535
class ConfigBuilderCacheWarmer implements CacheWarmerInterface
3636
{
37-
private KernelInterface $kernel;
38-
private ?LoggerInterface $logger;
39-
40-
public function __construct(KernelInterface $kernel, ?LoggerInterface $logger = null)
41-
{
42-
$this->kernel = $kernel;
43-
$this->logger = $logger;
37+
public function __construct(
38+
private KernelInterface $kernel,
39+
private ?LoggerInterface $logger = null,
40+
) {
4441
}
4542

4643
public function warmUp(string $cacheDir, ?string $buildDir = null): array

CacheWarmer/RouterCacheWarmer.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@
2626
*/
2727
class RouterCacheWarmer implements CacheWarmerInterface, ServiceSubscriberInterface
2828
{
29-
private ContainerInterface $container;
30-
31-
public function __construct(ContainerInterface $container)
32-
{
33-
// As this cache warmer is optional, dependencies should be lazy-loaded, that's why a container should be injected.
34-
$this->container = $container;
29+
/**
30+
* As this cache warmer is optional, dependencies should be lazy-loaded, that's why a container should be injected.
31+
*/
32+
public function __construct(
33+
private ContainerInterface $container,
34+
) {
3535
}
3636

3737
public function warmUp(string $cacheDir, ?string $buildDir = null): array

CacheWarmer/TranslationsCacheWarmer.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,14 @@
2626
*/
2727
class TranslationsCacheWarmer implements CacheWarmerInterface, ServiceSubscriberInterface
2828
{
29-
private ContainerInterface $container;
3029
private TranslatorInterface $translator;
3130

32-
public function __construct(ContainerInterface $container)
33-
{
34-
// As this cache warmer is optional, dependencies should be lazy-loaded, that's why a container should be injected.
35-
$this->container = $container;
31+
/**
32+
* As this cache warmer is optional, dependencies should be lazy-loaded, that's why a container should be injected.
33+
*/
34+
public function __construct(
35+
private ContainerInterface $container,
36+
) {
3637
}
3738

3839
public function warmUp(string $cacheDir, ?string $buildDir = null): array

Routing/Router.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,21 @@
3535
*/
3636
class Router extends BaseRouter implements WarmableInterface, ServiceSubscriberInterface
3737
{
38-
private ContainerInterface $container;
3938
private array $collectedParameters = [];
4039
private \Closure $paramFetcher;
4140

4241
/**
4342
* @param mixed $resource The main resource to load
4443
*/
45-
public function __construct(ContainerInterface $container, mixed $resource, array $options = [], ?RequestContext $context = null, ?ContainerInterface $parameters = null, ?LoggerInterface $logger = null, ?string $defaultLocale = null)
46-
{
47-
$this->container = $container;
44+
public function __construct(
45+
private ContainerInterface $container,
46+
mixed $resource,
47+
array $options = [],
48+
?RequestContext $context = null,
49+
?ContainerInterface $parameters = null,
50+
?LoggerInterface $logger = null,
51+
?string $defaultLocale = null,
52+
) {
4853
$this->resource = $resource;
4954
$this->context = $context ?? new RequestContext();
5055
$this->logger = $logger;

Secrets/SodiumVault.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,19 @@ class SodiumVault extends AbstractVault implements EnvVarLoaderInterface
2626
private string|\Stringable|null $decryptionKey = null;
2727
private string $pathPrefix;
2828
private ?string $secretsDir;
29-
private ?string $derivedSecretEnvVar;
3029

3130
/**
3231
* @param $decryptionKey A string or a stringable object that defines the private key to use to decrypt the vault
3332
* or null to store generated keys in the provided $secretsDir
3433
*/
35-
public function __construct(string $secretsDir, #[\SensitiveParameter] string|\Stringable|null $decryptionKey = null, ?string $derivedSecretEnvVar = null)
36-
{
34+
public function __construct(
35+
string $secretsDir,
36+
#[\SensitiveParameter] string|\Stringable|null $decryptionKey = null,
37+
private ?string $derivedSecretEnvVar = null,
38+
) {
3739
$this->pathPrefix = rtrim(strtr($secretsDir, '/', \DIRECTORY_SEPARATOR), \DIRECTORY_SEPARATOR).\DIRECTORY_SEPARATOR.basename($secretsDir).'.';
3840
$this->decryptionKey = $decryptionKey;
3941
$this->secretsDir = $secretsDir;
40-
$this->derivedSecretEnvVar = $derivedSecretEnvVar;
4142
}
4243

4344
public function generateKeys(bool $override = false): bool

0 commit comments

Comments
 (0)