Thanks to visit codestin.com
Credit goes to github.com

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

+3-5
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

+4-5
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

+4-5
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

+4-8
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

+4-4
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

+4-8
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

+4-8
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

+3-4
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

+3-6
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

+3-6
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

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

+3-6
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,10 @@
3131
#[AsCommand(name: 'cache:warmup', description: 'Warm up an empty cache')]
3232
class CacheWarmupCommand extends Command
3333
{
34-
private CacheWarmerAggregate $cacheWarmer;
35-
36-
public function __construct(CacheWarmerAggregate $cacheWarmer)
37-
{
34+
public function __construct(
35+
private CacheWarmerAggregate $cacheWarmer,
36+
) {
3837
parent::__construct();
39-
40-
$this->cacheWarmer = $cacheWarmer;
4138
}
4239

4340
protected function configure(): void

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

+4-5
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,10 @@
3333
#[AsCommand(name: 'debug:autowiring', description: 'List classes/interfaces you can use for autowiring')]
3434
class DebugAutowiringCommand extends ContainerDebugCommand
3535
{
36-
private ?FileLinkFormatter $fileLinkFormatter;
37-
38-
public function __construct(?string $name = null, ?FileLinkFormatter $fileLinkFormatter = null)
39-
{
40-
$this->fileLinkFormatter = $fileLinkFormatter;
36+
public function __construct(
37+
?string $name = null,
38+
private ?FileLinkFormatter $fileLinkFormatter = null,
39+
) {
4140
parent::__construct($name);
4241
}
4342

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

+3-6
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,10 @@ class EventDispatcherDebugCommand extends Command
3737
{
3838
private const DEFAULT_DISPATCHER = 'event_dispatcher';
3939

40-
private ContainerInterface $dispatchers;
41-
42-
public function __construct(ContainerInterface $dispatchers)
43-
{
40+
public function __construct(
41+
private ContainerInterface $dispatchers,
42+
) {
4443
parent::__construct();
45-
46-
$this->dispatchers = $dispatchers;
4744
}
4845

4946
protected function configure(): void

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

+4-8
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,11 @@ class RouterDebugCommand extends Command
3939
{
4040
use BuildDebugContainerTrait;
4141

42-
private RouterInterface $router;
43-
private ?FileLinkFormatter $fileLinkFormatter;
44-
45-
public function __construct(RouterInterface $router, ?FileLinkFormatter $fileLinkFormatter = null)
46-
{
42+
public function __construct(
43+
private RouterInterface $router,
44+
private ?FileLinkFormatter $fileLinkFormatter = null,
45+
) {
4746
parent::__construct();
48-
49-
$this->router = $router;
50-
$this->fileLinkFormatter = $fileLinkFormatter;
5147
}
5248

5349
protected function configure(): void

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

+4-8
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,14 @@
3333
#[AsCommand(name: 'router:match', description: 'Help debug routes by simulating a path info match')]
3434
class RouterMatchCommand extends Command
3535
{
36-
private RouterInterface $router;
37-
private iterable $expressionLanguageProviders;
38-
3936
/**
4037
* @param iterable<mixed, ExpressionFunctionProviderInterface> $expressionLanguageProviders
4138
*/
42-
public function __construct(RouterInterface $router, iterable $expressionLanguageProviders = [])
43-
{
39+
public function __construct(
40+
private RouterInterface $router,
41+
private iterable $expressionLanguageProviders = [],
42+
) {
4443
parent::__construct();
45-
46-
$this->router = $router;
47-
$this->expressionLanguageProviders = $expressionLanguageProviders;
4844
}
4945

5046
protected function configure(): void

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

+4-8
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,10 @@
2828
#[AsCommand(name: 'secrets:decrypt-to-local', description: 'Decrypt all secrets and stores them in the local vault')]
2929
final class SecretsDecryptToLocalCommand extends Command
3030
{
31-
private AbstractVault $vault;
32-
private ?AbstractVault $localVault;
33-
34-
public function __construct(AbstractVault $vault, ?AbstractVault $localVault = null)
35-
{
36-
$this->vault = $vault;
37-
$this->localVault = $localVault;
38-
31+
public function __construct(
32+
private AbstractVault $vault,
33+
private ?AbstractVault $localVault = null,
34+
) {
3935
parent::__construct();
4036
}
4137

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

+4-8
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,10 @@
2727
#[AsCommand(name: 'secrets:encrypt-from-local', description: 'Encrypt all local secrets to the vault')]
2828
final class SecretsEncryptFromLocalCommand extends Command
2929
{
30-
private AbstractVault $vault;
31-
private ?AbstractVault $localVault;
32-
33-
public function __construct(AbstractVault $vault, ?AbstractVault $localVault = null)
34-
{
35-
$this->vault = $vault;
36-
$this->localVault = $localVault;
37-
30+
public function __construct(
31+
private AbstractVault $vault,
32+
private ?AbstractVault $localVault = null,
33+
) {
3834
parent::__construct();
3935
}
4036

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

+4-8
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,10 @@
3030
#[AsCommand(name: 'secrets:generate-keys', description: 'Generate new encryption keys')]
3131
final class SecretsGenerateKeysCommand extends Command
3232
{
33-
private AbstractVault $vault;
34-
private ?AbstractVault $localVault;
35-
36-
public function __construct(AbstractVault $vault, ?AbstractVault $localVault = null)
37-
{
38-
$this->vault = $vault;
39-
$this->localVault = $localVault;
40-
33+
public function __construct(
34+
private AbstractVault $vault,
35+
private ?AbstractVault $localVault = null,
36+
) {
4137
parent::__construct();
4238
}
4339

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

+4-8
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,10 @@
3131
#[AsCommand(name: 'secrets:list', description: 'List all secrets')]
3232
final class SecretsListCommand extends Command
3333
{
34-
private AbstractVault $vault;
35-
private ?AbstractVault $localVault;
36-
37-
public function __construct(AbstractVault $vault, ?AbstractVault $localVault = null)
38-
{
39-
$this->vault = $vault;
40-
$this->localVault = $localVault;
41-
34+
public function __construct(
35+
private AbstractVault $vault,
36+
private ?AbstractVault $localVault = null,
37+
) {
4238
parent::__construct();
4339
}
4440

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

+4-8
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,10 @@
3232
#[AsCommand(name: 'secrets:remove', description: 'Remove a secret from the vault')]
3333
final class SecretsRemoveCommand extends Command
3434
{
35-
private AbstractVault $vault;
36-
private ?AbstractVault $localVault;
37-
38-
public function __construct(AbstractVault $vault, ?AbstractVault $localVault = null)
39-
{
40-
$this->vault = $vault;
41-
$this->localVault = $localVault;
42-
35+
public function __construct(
36+
private AbstractVault $vault,
37+
private ?AbstractVault $localVault = null,
38+
) {
4339
parent::__construct();
4440
}
4541

0 commit comments

Comments
 (0)