8000 [FrameworkBundle] Add types to private properties by derrabus · Pull Request #43869 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[FrameworkBundle] Add types to private properties #43869

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

abstract class AbstractPhpFileCacheWarmer implements CacheWarmerInterface
{
private $phpArrayFile;
private string $phpArrayFile;

/**
* @param string $phpArrayFile The PHP file where metadata are cached
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
*/
class AnnotationsCacheWarmer extends AbstractPhpFileCacheWarmer
{
private $annotationReader;
private $excludeRegexp;
private $debug;
private Reader $annotationReader;
private ?string $excludeRegexp;
private bool $debug;

/**
* @param string $phpArrayFile The PHP file where annotations are cached
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,12 @@
*/
final class CachePoolClearerCacheWarmer implements CacheWarmerInterface
{
private $poolClearer;
private $pools;
private Psr6CacheClearer $poolClearer;
private array $pools;

/**
* @param string[] $pools
*/
public function __construct(Psr6CacheClearer $poolClearer, array $pools = [])
{
$this->poolClearer = $poolClearer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
*/
class ConfigBuilderCacheWarmer implements CacheWarmerInterface
{
private $kernel;
private $logger;
private KernelInterface $kernel;
private ?LoggerInterface $logger;

public function __construct(KernelInterface $kernel, LoggerInterface $logger = null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*/
class RouterCacheWarmer implements CacheWarmerInterface, ServiceSubscriberInterface
{
private $container;
private ContainerInterface $container;

public function __construct(ContainerInterface $container)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
*/
class SerializerCacheWarmer extends AbstractPhpFileCacheWarmer
{
private $loaders;
private array $loaders;

/**
* @param LoaderInterface[] $loaders The serializer metadata loaders
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
*/
class TranslationsCacheWarmer implements CacheWarmerInterface, ServiceSubscriberInterface
{
private $container;
private $translator;
private ContainerInterface $container;
private TranslatorInterface $translator;

public function __construct(ContainerInterface $container)
{
Expand All @@ -40,9 +40,7 @@ public function __construct(ContainerInterface $container)
*/
public function warmUp(string $cacheDir): array
{
if (null === $this->translator) {
$this->translator = $this->container->get('translator');
}
$this->translator ??= $this->container->get('translator');

if ($this->translator instanceof WarmableInterface) {
return (array) $this->translator->warmUp($cacheDir);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
*/
class ValidatorCacheWarmer extends AbstractPhpFileCacheWarmer
{
private $validatorBuilder;
private ValidatorBuilder $validatorBuilder;

/**
* @param string $phpArrayFile The PHP file where metadata are cached
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ class AssetsInstallCommand extends Command
public const METHOD_ABSOLUTE_SYMLINK = 'absolute symlink';
public const METHOD_RELATIVE_SYMLINK = 'relative symlink';

private $filesystem;
private $projectDir;
private Filesystem $filesystem;
private string $projectDir;

public function __construct(Filesystem $filesystem, string $projectDir)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
#[AsCommand(name: 'cache:clear', description: 'Clear the cache')]
class CacheClearCommand extends Command
{
private $cacheClearer;
private $filesystem;
private CacheClearerInterface $cacheClearer;
private Filesystem $filesystem;

public function __construct(CacheClearerInterface $cacheClearer, Filesystem $filesystem = null)
{
Expand Down
F987
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,12 @@
#[AsCommand(name: 'cache:pool:clear', description: 'Clear cache pools')]
final class CachePoolClearCommand extends Command
{
private $poolClearer;
private $poolNames;
private Psr6CacheClearer $poolClearer;
private ?array $poolNames;

/**
* @param string[]|null $poolNames
*/
public function __construct(Psr6CacheClearer $poolClearer, array $poolNames = null)
{
parent::__construct();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,12 @@
#[AsCommand(name: 'cache:pool:delete', description: 'Delete an item from a cache pool')]
final class CachePoolDeleteCommand extends Command
{
private $poolClearer;
private $poolNames;
private Psr6CacheClearer $poolClearer;
private ?array $poolNames;

/**
* @param string[]|null $poolNames
*/
public function __construct(Psr6CacheClearer $poolClearer, array $poolNames = null)
{
parent::__construct();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@
#[AsCommand(name: 'cache:pool:list', description: 'List available cache pools')]
final class CachePoolListCommand extends Command
{
private $poolNames;
private array $poolNames;

/**
* @param string[] $poolNames
*/
public function __construct(array $poolNames)
{
parent::__construct();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
#[AsCommand(name: 'cache:pool:prune', description: 'Prune cache pools')]
final class CachePoolPruneCommand extends Command
{
private $pools;
private iterable $pools;

/**
* @param iterable|PruneableInterface[] $pools
* @param iterable<mixed, PruneableInterface> $pools
*/
public function __construct(iterable $pools)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#[AsCommand(name: 'cache:warmup', description: 'Warm up an empty cache')]
class CacheWarmupCommand extends Command
{
private $cacheWarmer;
private CacheWarmerAggregate $cacheWarmer;

public function __construct(CacheWarmerAggregate $cacheWarmer)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,7 @@
#[AsCommand(name: 'lint:container', description: 'Ensure that arguments injected into services match type declarations')]
final class ContainerLintCommand extends Command
{
/**
* @var ContainerBuilder
*/
private $containerBuilder;
private ContainerBuilder $containerBuilder;

/**
* {@inheritdoc}
Expand Down Expand Up @@ -79,7 +76,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int

private function getContainerBuilder(): ContainerBuilder
{
if ($this->containerBuilder) {
if (isset($this->containerBuilder)) {
return $this->containerBuilder;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
#[AsCommand(name: 'debug:autowiring', description: 'List classes/interfaces you can use for autowiring')]
class DebugAutowiringCommand extends ContainerDebugCommand
{
private $supportsHref;
private $fileLinkFormatter;
private bool $supportsHref;
private ?FileLinkFormatter $fileLinkFormatter;

public function __construct(string $name = null, FileLinkFormatter $fileLinkFormatter = null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class EventDispatcherDebugCommand extends Command
{
private const DEFAULT_DISPATCHER = 'event_dispatcher';

private $dispatchers;
private ContainerInterface $dispatchers;

public function __construct(ContainerInterface $dispatchers)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ class RouterDebugCommand extends Command
{
use BuildDebugContainerTrait;

private $router;
private $fileLinkFormatter;
private RouterInterface $router;
private ?FileLinkFormatter $fileLinkFormatter;

public function __construct(RouterInterface $router, FileLinkFormatter $fileLinkFormatter = null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface;
use Symfony\Component\Routing\Matcher\TraceableUrlMatcher;
use Symfony\Component\Routing\RouterInterface;

Expand All @@ -32,9 +33,12 @@
#[AsCommand(name: 'router:match', description: 'Help debug routes by simulating a path info match')]
class RouterMatchCommand extends Command
{
private $router;
private $expressionLanguageProviders;
private RouterInterface $router;
private iterable $expressionLanguageProviders;

/**
* @param iterable<mixed, ExpressionFunctionProviderInterface> $expressionLanguageProviders
*/
public function __construct(RouterInterface $router, iterable $expressionLanguageProviders = [])
{
parent::__construct();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
#[AsCommand(name: 'secrets:decrypt-to-local', description: 'Decrypt all secrets and stores them in the local vault')]
final class SecretsDecryptToLocalCommand extends Command
{
private $vault;
private $localVault;
private AbstractVault $vault;
private ?AbstractVault $localVault;

public function __construct(AbstractVault $vault, AbstractVault $localVault = null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
#[AsCommand(name: 'secrets:encrypt-from-local', description: 'Encrypt all local secrets to the vault')]
final class SecretsEncryptFromLocalCommand extends Command
{
private $vault;
private $localVault;
private AbstractVault $vault;
private ?AbstractVault $localVault;

public function __construct(AbstractVault $vault, AbstractVault $localVault = null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
#[AsCommand(name: 'secrets:generate-keys', description: 'Generate new encryption keys')]
final class SecretsGenerateKeysCommand extends Command
{
private $vault;
private $localVault;
private AbstractVault $vault;
private ?AbstractVault $localVault;

public function __construct(AbstractVault $vault, AbstractVault $localVault = null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
#[AsCommand(name: 'secrets:list', description: 'List all secrets')]
final class SecretsListCommand extends Command
{
private $vault;
private $localVault;
private AbstractVault $vault;
private ?AbstractVault $localVault;

public function __construct(AbstractVault $vault, AbstractVault $localVault = null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
#[AsCommand(name: 'secrets:remove', description: 'Remove a secret from the vault')]
final class SecretsRemoveCommand extends Command
{
private $vault;
private $localVault;
private AbstractVault $vault;
private ?AbstractVault $localVault;

public function __construct(AbstractVault $vault, AbstractVault $localVault = null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
#[AsCommand(name: 'secrets:set', description: 48DA 'Set a secret in the vault')]
final class SecretsSetCommand extends Command
{
private $vault;
private $localVault;
private AbstractVault $vault;
private ?AbstractVault $localVault;

public function __construct(AbstractVault $vault, AbstractVault $localVault = null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ class TranslationDebugCommand extends Command
public const MESSAGE_UNUSED = 1;
public const MESSAGE_EQUALS_FALLBACK = 2;

private $translator;
private $reader;
private $extractor;
private $defaultTransPath;
private $defaultViewsPath;
private $transPaths;
private $codePaths;
private $enabledLocales;
private TranslatorInterface $translator;
private TranslationReaderInterface $reader;
private ExtractorInterface $extractor;
private ?string $defaultTransPath;
private ?string $defaultViewsPath;
private array $transPaths;
private array $codePaths;
private array $enabledLocales;

public function __construct(TranslatorInterface $translator, TranslationReaderInterface $reader, ExtractorInterface $extractor, string $defaultTransPath = null, string $defaultViewsPath = null, array $transPaths = [], array $codePaths = [], array $enabledLocales = [])
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ class TranslationUpdateCommand extends Command
'xlf20' => ['xlf', '2.0'],
];

private $writer;
private $reader;
private $extractor;
private $defaultLocale;
private $defaultTransPath;
private $defaultViewsPath;
private $transPaths;
private $codePaths;
private $enabledLocales;
private TranslationWriterInterface $writer;
private TranslationReaderInterface $reader;
private ExtractorInterface $extractor;
private string $defaultLocale;
private ?string $defaultTransPath;
private ?string $defaultViewsPath;
private array $transPaths;
private array $codePaths;
private array $enabledLocales;

public function __construct(TranslationWriterInterface $writer, TranslationReaderInterface $reader, ExtractorInterface $extractor, string $defaultLocale, string $defaultTransPath = null, string $defaultViewsPath = null, array $transPaths = [], array $codePaths = [], array $enabledLocales = [])
{
Expand Down
6 changes: 3 additions & 3 deletions src/Symfony/Bundle/FrameworkBundle/Console/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
*/
class Application extends BaseApplication
{
private $kernel;
private $commandsRegistered = false;
private $registrationErrors = [];
private KernelInterface $kernel;
private bool $commandsRegistered = false;
private array $registrationErrors = [];

public function __construct(KernelInterface $kernel)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
*/
class TextDescriptor extends Descriptor
{
private $fileLinkFormatter;
private ?FileLinkFormatter $fileLinkFormatter;

public function __construct(FileLinkFormatter $fileLinkFormatter = null)
{
Expand Down
Loading
0