Skip to content

Commit bc2d994

Browse files
minor #53861 [FrameworkBundle] Use CPP (derrabus)
This PR was merged into the 7.1 branch. Discussion ---------- [FrameworkBundle] Use CPP | Q | A | ------------- | --- | Branch? | 7.1 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | N/A | License | MIT Commits ------- d6637b7 [FrameworkBundle] Use CPP
2 parents d995693 + d6637b7 commit bc2d994

33 files changed

+145
-247
lines changed

src/Symfony/Bundle/FrameworkBundle/CacheWarmer/AbstractPhpFileCacheWarmer.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,12 @@
1919

2020
abstract class AbstractPhpFileCacheWarmer implements CacheWarmerInterface
2121
{
22-
private string $phpArrayFile;
23-
2422
/**
2523
* @param string $phpArrayFile The PHP file where metadata are cached
2624
*/
27-
public function __construct(string $phpArrayFile)
28-
{
29-
$this->phpArrayFile = $phpArrayFile;
25+
public function __construct(
26+
private string $phpArrayFile,
27+
) {
3028
}
3129

3230
public function isOptional(): bool

src/Symfony/Bundle/FrameworkBundle/CacheWarmer/SerializerCacheWarmer.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,15 @@
2828
*/
2929
class SerializerCacheWarmer extends AbstractPhpFileCacheWarmer
3030
{
31-
private array $loaders;
32-
3331
/**
3432
* @param LoaderInterface[] $loaders The serializer metadata loaders
3533
* @param string $phpArrayFile The PHP file where metadata are cached
3634
*/
37-
public function __construct(array $loaders, string $phpArrayFile)
38-
{
35+
public function __construct(
36+
private array $loaders,
37+
string $phpArrayFile,
38+
) {
3939
parent::__construct($phpArrayFile);
40-
$this->loaders = $loaders;
4140
}
4241

4342
protected function doWarmUp(string $cacheDir, ArrayAdapter $arrayAdapter, ?string $buildDir = null): bool

src/Symfony/Bundle/FrameworkBundle/CacheWarmer/ValidatorCacheWarmer.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,14 @@
2929
*/
3030
class ValidatorCacheWarmer extends AbstractPhpFileCacheWarmer
3131
{
32-
private ValidatorBuilder $validatorBuilder;
33-
3432
/**
3533
* @param string $phpArrayFile The PHP file where metadata are cached
3634
*/
37-
public function __construct(ValidatorBuilder $validatorBuilder, string $phpArrayFile)
38-
{
35+
public function __construct(
36+
private ValidatorBuilder $validatorBuilder,
37+
string $phpArrayFile,
38+
) {
3939
parent::__construct($phpArrayFile);
40-
$this->validatorBuilder = $validatorBuilder;
4140
}
4241

4342
protected function doWarmUp(string $cacheDir, ArrayAdapter $arrayAdapter, ?string $buildDir = null): bool

src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,11 @@ class AssetsInstallCommand extends Command
4141
public const METHOD_ABSOLUTE_SYMLINK = 'absolute symlink';
4242
public const METHOD_RELATIVE_SYMLINK = 'relative symlink';
4343

44-
private Filesystem $filesystem;
45-
private string $projectDir;
46-
47-
public function __construct(Filesystem $filesystem, string $projectDir)
48-
{
44+
public function __construct(
45+
private Filesystem $filesystem,
46+
private string $projectDir,
47+
) {
4948
parent::__construct();
50-
51-
$this->filesystem = $filesystem;
52-
$this->projectDir = $projectDir;
5349
}
5450

5551
protected function configure(): void

src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@
3737
#[AsCommand(name: 'cache:clear', description: 'Clear the cache')]
3838
class CacheClearCommand extends Command
3939
{
40-
private CacheClearerInterface $cacheClearer;
4140
private Filesystem $filesystem;
4241

43-
public function __construct(CacheClearerInterface $cacheClearer, ?Filesystem $filesystem = null)
44-
{
42+
public function __construct(
43+
private CacheClearerInterface $cacheClearer,
44+
?Filesystem $filesystem = null,
45+
) {
4546
parent::__construct();
4647

47-
$this->cacheClearer = $cacheClearer;
4848
$this->filesystem = $filesystem ?? new Filesystem();
4949
}
5050

src/Symfony/Bundle/FrameworkBundle/Command/CachePoolClearCommand.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,14 @@
3232
#[AsCommand(name: 'cache:pool:clear', description: 'Clear cache pools')]
3333
final class CachePoolClearCommand extends Command
3434
{
35-
private Psr6CacheClearer $poolClearer;
36-
private ?array $poolNames;
37-
3835
/**
3936
* @param string[]|null $poolNames
4037
*/
41-
public function __construct(Psr6CacheClearer $poolClearer, ?array $poolNames = null)
42-
{
38+
public function __construct(
39+
private Psr6CacheClearer $poolClearer,
40+
private ?array $poolNames = null,
41+
) {
4342
parent::__construct();
44-
45-
$this->poolClearer = $poolClearer;
46-
$this->poolNames = $poolNames;
4743
}
4844

4945
protected function configure(): void

src/Symfony/Bundle/FrameworkBundle/Command/CachePoolDeleteCommand.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,14 @@
2929
#[AsCommand(name: 'cache:pool:delete', description: 'Delete an item from a cache pool')]
3030
final class CachePoolDeleteCommand extends Command
3131
{
32-
private Psr6CacheClearer $poolClearer;
33-
private ?array $poolNames;
34-
3532
/**
3633
* @param string[]|null $poolNames
3734
*/
38-
public function __construct(Psr6CacheClearer $poolClearer, ?array $poolNames = null)
39-
{
35+
public function __construct(
36+
private Psr6CacheClearer $poolClearer,
37+
private ?array $poolNames = null,
38+
) {
4039
parent::__construct();
41-
42-
$this->poolClearer = $poolClearer;
43-
$this->poolNames = $poolNames;
4440
}
4541

4642
protected function configure(): void

src/Symfony/Bundle/FrameworkBundle/Command/CachePoolInvalidateTagsCommand.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,13 @@
3030
#[AsCommand(name: 'cache:pool:invalidate-tags', description: 'Invalidate cache tags for all or a specific pool')]
3131
final class CachePoolInvalidateTagsCommand extends Command
3232
{
33-
private ServiceProviderInterface $pools;
3433
private array $poolNames;
3534

36-
public function __construct(ServiceProviderInterface $pools)
37-
{
35+
public function __construct(
36+
private ServiceProviderInterface $pools,
37+
) {
3838
parent::__construct();
3939

40-
$this->pools = $pools;
4140
$this->poolNames = array_keys($pools->getProvidedServices());
4241
}
4342

src/Symfony/Bundle/FrameworkBundle/Command/CachePoolListCommand.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,13 @@
2525
#[AsCommand(name: 'cache:pool:list', description: 'List available cache pools')]
2626
final class CachePoolListCommand extends Command
2727
{
28-
private array $poolNames;
29-
3028
/**
3129
* @param string[] $poolNames
3230
*/
33-
public function __construct(array $poolNames)
34-
{
31+
public function __construct(
32+
private array $poolNames,
33+
) {
3534
parent::__construct();
36-
37-
$this->poolNames = $poolNames;
3835
}
3936

4037
protected function configure(): void

src/Symfony/Bundle/FrameworkBundle/Command/CachePoolPruneCommand.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,13 @@
2626
#[AsCommand(name: 'cache:pool:prune', description: 'Prune cache pools')]
2727
final class CachePoolPruneCommand extends Command
2828
{
29-
private iterable $pools;
30-
3129
/**
3230
* @param iterable<mixed, PruneableInterface> $pools
3331
*/
34-
public function __construct(iterable $pools)
35-
{
32+
public function __construct(
33+
private iterable $pools,
34+
) {
3635
parent::__construct();
37-
38-
$this->pools = $pools;
3936
}
4037

4138
protected function configure(): void

0 commit comments

Comments
 (0)