Skip to content

Commit 877f6b2

Browse files
Use CPP where possible
1 parent a03a2f6 commit 877f6b2

File tree

81 files changed

+332
-480
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+332
-480
lines changed

src/Symfony/Bundle/FrameworkBundle/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

src/Symfony/Bundle/FrameworkBundle/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

src/Symfony/Bundle/FrameworkBundle/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

src/Symfony/Bundle/FrameworkBundle/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

src/Symfony/Bundle/FrameworkBundle/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;

src/Symfony/Bundle/FrameworkBundle/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

src/Symfony/Component/Asset/Exception/AssetNotFoundException.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@
1616
*/
1717
class AssetNotFoundException extends RuntimeException
1818
{
19-
private array $alternatives;
20-
2119
/**
2220
* @param string $message Exception message to throw
2321
* @param array $alternatives List of similar defined names
2422
* @param int $code Exception code
2523
* @param \Throwable $previous Previous exception used for the exception chaining
2624
*/
27-
public function __construct(string $message, array $alternatives = [], int $code = 0, ?\Throwable $previous = null)
28-
{
25+
public function __construct(
26+
string $message,
27+
private array $alternatives = [],
28+
int $code = 0,
29+
?\Throwable $previous = null,
30+
) {
2931
parent::__construct($message, $code, $previous);
30-
31-
$this->alternatives = $alternatives;
3232
}
3333

3434
public function getAlternatives(): array

src/Symfony/Component/BrowserKit/Test/Constraint/BrowserCookieValueSame.php

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

1717
final class BrowserCookieValueSame extends Constraint
1818
{
19-
private string $name;
20-
private string $value;
21-
private bool $raw;
22-
private string $path;
23-
private ?string $domain;
24-
25-
public function __construct(string $name, string $value, bool $raw = false, string $path = '/', ?string $domain = null)
26-
{
27-
$this->name = $name;
28-
$this->path = $path;
29-
$this->domain = $domain;
30-
$this->value = $value;
31-
$this->raw = $raw;
19+
public function __construct(
20+
private string $name,
21+
private string $value,
22+
private bool $raw = false,
23+
private string $path = '/',
24+
private ?string $domain = null,
25+
) {
3226
}
3327

3428
public function toString(): string

src/Symfony/Component/BrowserKit/Test/Constraint/BrowserHasCookie.php

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,11 @@
1616

1717
final class BrowserHasCookie extends Constraint
1818
{
19-
private string $name;
20-
private string $path;
21-
private ?string $domain;
22-
23-
public function __construct(string $name, string $path = '/', ?string $domain = null)
24-
{
25-
$this->name = $name;
26-
$this->path = $path;
27-
$this->domain = $domain;
19+
public function __construct(
20+
private string $name,
21+
private string $path = '/',
22+
private ?string $domain = null,
23+
) {
2824
}
2925

3026
public function toString(): string

src/Symfony/Component/Cache/Adapter/PhpFilesAdapter.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -305,10 +305,8 @@ private function getFileKey(string $file): string
305305
*/
306306
class LazyValue
307307
{
308-
public string $file;
309-
310-
public function __construct(string $file)
311-
{
312-
$this->file = $file;
308+
public function __construct(
309+
public string $file,
310+
) {
313311
}
314312
}

0 commit comments

Comments
 (0)