diff --git a/CacheWarmer/AbstractPhpFileCacheWarmer.php b/CacheWarmer/AbstractPhpFileCacheWarmer.php
index f6c259bbb..3d7c99e4f 100644
--- a/CacheWarmer/AbstractPhpFileCacheWarmer.php
+++ b/CacheWarmer/AbstractPhpFileCacheWarmer.php
@@ -34,7 +34,7 @@ public function isOptional(): bool
return true;
}
- public function warmUp(string $cacheDir, string $buildDir = null): array
+ public function warmUp(string $cacheDir, ?string $buildDir = null): array
{
$arrayAdapter = new ArrayAdapter();
@@ -77,5 +77,5 @@ final protected function ignoreAutoloadException(string $class, \Exception $exce
/**
* @return bool false if there is nothing to warm-up
*/
- abstract protected function doWarmUp(string $cacheDir, ArrayAdapter $arrayAdapter, string $buildDir = null): bool;
+ abstract protected function doWarmUp(string $cacheDir, ArrayAdapter $arrayAdapter, ?string $buildDir = null): bool;
}
diff --git a/CacheWarmer/CachePoolClearerCacheWarmer.php b/CacheWarmer/CachePoolClearerCacheWarmer.php
index 7498a82d1..ae27502cf 100644
--- a/CacheWarmer/CachePoolClearerCacheWarmer.php
+++ b/CacheWarmer/CachePoolClearerCacheWarmer.php
@@ -37,7 +37,7 @@ public function __construct(Psr6CacheClearer $poolClearer, array $pools = [])
$this->pools = $pools;
}
- public function warmUp(string $cacheDir, string $buildDir = null): array
+ public function warmUp(string $cacheDir, ?string $buildDir = null): array
{
foreach ($this->pools as $pool) {
if ($this->poolClearer->hasPool($pool)) {
diff --git a/CacheWarmer/ConfigBuilderCacheWarmer.php b/CacheWarmer/ConfigBuilderCacheWarmer.php
index 04ba80f6a..fe12b567f 100644
--- a/CacheWarmer/ConfigBuilderCacheWarmer.php
+++ b/CacheWarmer/ConfigBuilderCacheWarmer.php
@@ -31,13 +31,13 @@ class ConfigBuilderCacheWarmer implements CacheWarmerInterface
private KernelInterface $kernel;
private ?LoggerInterface $logger;
- public function __construct(KernelInterface $kernel, LoggerInterface $logger = null)
+ public function __construct(KernelInterface $kernel, ?LoggerInterface $logger = null)
{
$this->kernel = $kernel;
$this->logger = $logger;
}
- public function warmUp(string $cacheDir, string $buildDir = null): array
+ public function warmUp(string $cacheDir, ?string $buildDir = null): array
{
if (!$buildDir) {
return [];
@@ -80,6 +80,6 @@ private function dumpExtension(ExtensionInterface $extension, ConfigBuilderGener
public function isOptional(): bool
{
- return true;
+ return false;
}
}
diff --git a/CacheWarmer/RouterCacheWarmer.php b/CacheWarmer/RouterCacheWarmer.php
index 2af9a2fe8..c2b9478a3 100644
--- a/CacheWarmer/RouterCacheWarmer.php
+++ b/CacheWarmer/RouterCacheWarmer.php
@@ -34,7 +34,7 @@ public function __construct(ContainerInterface $container)
$this->container = $container;
}
- public function warmUp(string $cacheDir, string $buildDir = null): array
+ public function warmUp(string $cacheDir, ?string $buildDir = null): array
{
$router = $this->container->get('router');
diff --git a/CacheWarmer/SerializerCacheWarmer.php b/CacheWarmer/SerializerCacheWarmer.php
index b1300516b..fcd67af1f 100644
--- a/CacheWarmer/SerializerCacheWarmer.php
+++ b/CacheWarmer/SerializerCacheWarmer.php
@@ -38,7 +38,7 @@ public function __construct(array $loaders, string $phpArrayFile)
$this->loaders = $loaders;
}
- protected function doWarmUp(string $cacheDir, ArrayAdapter $arrayAdapter, string $buildDir = null): bool
+ protected function doWarmUp(string $cacheDir, ArrayAdapter $arrayAdapter, ?string $buildDir = null): bool
{
if (!$this->loaders) {
return true;
diff --git a/CacheWarmer/TranslationsCacheWarmer.php b/CacheWarmer/TranslationsCacheWarmer.php
index 59a7865a1..b1c0fc6d7 100644
--- a/CacheWarmer/TranslationsCacheWarmer.php
+++ b/CacheWarmer/TranslationsCacheWarmer.php
@@ -33,7 +33,7 @@ public function __construct(ContainerInterface $container)
$this->container = $container;
}
- public function warmUp(string $cacheDir, string $buildDir = null): array
+ public function warmUp(string $cacheDir, ?string $buildDir = null): array
{
$this->translator ??= $this->container->get('translator');
diff --git a/CacheWarmer/ValidatorCacheWarmer.php b/CacheWarmer/ValidatorCacheWarmer.php
index d88fd36c8..bf1e5035f 100644
--- a/CacheWarmer/ValidatorCacheWarmer.php
+++ b/CacheWarmer/ValidatorCacheWarmer.php
@@ -38,7 +38,7 @@ public function __construct(ValidatorBuilder $validatorBuilder, string $phpArray
$this->validatorBuilder = $validatorBuilder;
}
- protected function doWarmUp(string $cacheDir, ArrayAdapter $arrayAdapter, string $buildDir = null): bool
+ protected function doWarmUp(string $cacheDir, ArrayAdapter $arrayAdapter, ?string $buildDir = null): bool
{
$loaders = $this->validatorBuilder->getLoaders();
$metadataFactory = new LazyLoadingMetadataFactory(new LoaderChain($loaders), $arrayAdapter);
diff --git a/Command/CacheClearCommand.php b/Command/CacheClearCommand.php
index 878157e87..a06f291bb 100644
--- a/Command/CacheClearCommand.php
+++ b/Command/CacheClearCommand.php
@@ -40,7 +40,7 @@ class CacheClearCommand extends Command
private CacheClearerInterface $cacheClearer;
private Filesystem $filesystem;
- public function __construct(CacheClearerInterface $cacheClearer, Filesystem $filesystem = null)
+ public function __construct(CacheClearerInterface $cacheClearer, ?Filesystem $filesystem = null)
{
parent::__construct();
diff --git a/Command/CachePoolClearCommand.php b/Command/CachePoolClearCommand.php
index fcd70ca0e..8b8b9cd35 100644
--- a/Command/CachePoolClearCommand.php
+++ b/Command/CachePoolClearCommand.php
@@ -38,7 +38,7 @@ final class CachePoolClearCommand extends Command
/**
* @param string[]|null $poolNames
*/
- public function __construct(Psr6CacheClearer $poolClearer, array $poolNames = null)
+ public function __construct(Psr6CacheClearer $poolClearer, ?array $poolNames = null)
{
parent::__construct();
@@ -72,7 +72,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$poolNames = $input->getArgument('pools');
$excludedPoolNames = $input->getOption('exclude');
- if ($input->getOption('all')) {
+ if ($clearAll = $input->getOption('all')) {
if (!$this->poolNames) {
throw new InvalidArgumentException('Could not clear all cache pools, try specifying a specific pool or cache clearer.');
}
@@ -91,7 +91,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
foreach ($poolNames as $id) {
if ($this->poolClearer->hasPool($id)) {
$pools[$id] = $id;
- } else {
+ } elseif (!$clearAll || $kernel->getContainer()->has($id)) {
$pool = $kernel->getContainer()->get($id);
if ($pool instanceof CacheItemPoolInterface) {
diff --git a/Command/CachePoolDeleteCommand.php b/Command/CachePoolDeleteCommand.php
index 7b53ceb8b..dfa307bc0 100644
--- a/Command/CachePoolDeleteCommand.php
+++ b/Command/CachePoolDeleteCommand.php
@@ -35,7 +35,7 @@ final class CachePoolDeleteCommand extends Command
/**
* @param string[]|null $poolNames
*/
- public function __construct(Psr6CacheClearer $poolClearer, array $poolNames = null)
+ public function __construct(Psr6CacheClearer $poolClearer, ?array $poolNames = null)
{
parent::__construct();
diff --git a/Command/DebugAutowiringCommand.php b/Command/DebugAutowiringCommand.php
index ab4793b68..f6efd8bef 100644
--- a/Command/DebugAutowiringCommand.php
+++ b/Command/DebugAutowiringCommand.php
@@ -35,7 +35,7 @@ class DebugAutowiringCommand extends ContainerDebugCommand
{
private ?FileLinkFormatter $fileLinkFormatter;
- public function __construct(string $name = null, FileLinkFormatter $fileLinkFormatter = null)
+ public function __construct(?string $name = null, ?FileLinkFormatter $fileLinkFormatter = null)
{
$this->fileLinkFormatter = $fileLinkFormatter;
parent::__construct($name);
diff --git a/Command/RouterDebugCommand.php b/Command/RouterDebugCommand.php
index 8d4e38a29..9318b46be 100644
--- a/Command/RouterDebugCommand.php
+++ b/Command/RouterDebugCommand.php
@@ -42,7 +42,7 @@ class RouterDebugCommand extends Command
private RouterInterface $router;
private ?FileLinkFormatter $fileLinkFormatter;
- public function __construct(RouterInterface $router, FileLinkFormatter $fileLinkFormatter = null)
+ public function __construct(RouterInterface $router, ?FileLinkFormatter $fileLinkFormatter = null)
{
parent::__construct();
diff --git a/Command/SecretsDecryptToLocalCommand.php b/Command/SecretsDecryptToLocalCommand.php
index 22be89502..ac711e3db 100644
--- a/Command/SecretsDecryptToLocalCommand.php
+++ b/Command/SecretsDecryptToLocalCommand.php
@@ -31,7 +31,7 @@ final class SecretsDecryptToLocalCommand extends Command
private AbstractVault $vault;
private ?AbstractVault $localVault;
- public function __construct(AbstractVault $vault, AbstractVault $localVault = null)
+ public function __construct(AbstractVault $vault, ?AbstractVault $localVault = null)
{
$this->vault = $vault;
$this->localVault = $localVault;
diff --git a/Command/SecretsEncryptFromLocalCommand.php b/Command/SecretsEncryptFromLocalCommand.php
index 4c613ef7b..46e0baffc 100644
--- a/Command/SecretsEncryptFromLocalCommand.php
+++ b/Command/SecretsEncryptFromLocalCommand.php
@@ -30,7 +30,7 @@ final class SecretsEncryptFromLocalCommand extends Command
private AbstractVault $vault;
private ?AbstractVault $localVault;
- public function __construct(AbstractVault $vault, AbstractVault $localVault = null)
+ public function __construct(AbstractVault $vault, ?AbstractVault $localVault = null)
{
$this->vault = $vault;
$this->localVault = $localVault;
diff --git a/Command/SecretsGenerateKeysCommand.php b/Command/SecretsGenerateKeysCommand.php
index 761f6c260..989eff9fd 100644
--- a/Command/SecretsGenerateKeysCommand.php
+++ b/Command/SecretsGenerateKeysCommand.php
@@ -33,7 +33,7 @@ final class SecretsGenerateKeysCommand extends Command
private AbstractVault $vault;
private ?AbstractVault $localVault;
- public function __construct(AbstractVault $vault, AbstractVault $localVault = null)
+ public function __construct(AbstractVault $vault, ?AbstractVault $localVault = null)
{
$this->vault = $vault;
$this->localVault = $localVault;
diff --git a/Command/SecretsListCommand.php b/Command/SecretsListCommand.php
index de8a7e772..9a24f4a90 100644
--- a/Command/SecretsListCommand.php
+++ b/Command/SecretsListCommand.php
@@ -34,7 +34,7 @@ final class SecretsListCommand extends Command
private AbstractVault $vault;
private ?AbstractVault $localVault;
- public function __construct(AbstractVault $vault, AbstractVault $localVault = null)
+ public function __construct(AbstractVault $vault, ?AbstractVault $localVault = null)
{
$this->vault = $vault;
$this->localVault = $localVault;
diff --git a/Command/SecretsRemoveCommand.php b/Command/SecretsRemoveCommand.php
index e03afcd0c..1789f2981 100644
--- a/Command/SecretsRemoveCommand.php
+++ b/Command/SecretsRemoveCommand.php
@@ -35,7 +35,7 @@ final class SecretsRemoveCommand extends Command
private AbstractVault $vault;
private ?AbstractVault $localVault;
- public function __construct(AbstractVault $vault, AbstractVault $localVault = null)
+ public function __construct(AbstractVault $vault, ?AbstractVault $localVault = null)
{
$this->vault = $vault;
$this->localVault = $localVault;
diff --git a/Command/SecretsSetCommand.php b/Command/SecretsSetCommand.php
index 0e831a343..2d2b8c5cb 100644
--- a/Command/SecretsSetCommand.php
+++ b/Command/SecretsSetCommand.php
@@ -36,7 +36,7 @@ final class SecretsSetCommand extends Command
private AbstractVault $vault;
private ?AbstractVault $localVault;
- public function __construct(AbstractVault $vault, AbstractVault $localVault = null)
+ public function __construct(AbstractVault $vault, ?AbstractVault $localVault = null)
{
$this->vault = $vault;
$this->localVault = $localVault;
diff --git a/Command/TranslationDebugCommand.php b/Command/TranslationDebugCommand.php
index 79a67847a..ecb0ad8d7 100644
--- a/Command/TranslationDebugCommand.php
+++ b/Command/TranslationDebugCommand.php
@@ -59,7 +59,7 @@ class TranslationDebugCommand extends Command
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 = [])
+ public function __construct(TranslatorInterface $translator, TranslationReaderInterface $reader, ExtractorInterface $extractor, ?string $defaultTransPath = null, ?string $defaultViewsPath = null, array $transPaths = [], array $codePaths = [], array $enabledLocales = [])
{
parent::__construct();
diff --git a/Command/TranslationUpdateCommand.php b/Command/TranslationUpdateCommand.php
index bf2c0ec8f..fc95e0217 100644
--- a/Command/TranslationUpdateCommand.php
+++ b/Command/TranslationUpdateCommand.php
@@ -60,7 +60,7 @@ class TranslationUpdateCommand extends Command
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 = [])
+ public function __construct(TranslationWriterInterface $writer, TranslationReaderInterface $reader, ExtractorInterface $extractor, string $defaultLocale, ?string $defaultTransPath = null, ?string $defaultViewsPath = null, array $transPaths = [], array $codePaths = [], array $enabledLocales = [])
{
parent::__construct();
diff --git a/Console/Application.php b/Console/Application.php
index daa6c7026..14a907e2e 100644
--- a/Console/Application.php
+++ b/Console/Application.php
@@ -149,7 +149,7 @@ public function get(string $name): Command
return parent::get($name);
}
- public function all(string $namespace = null): array
+ public function all(?string $namespace = null): array
{
$this->registerCommands();
diff --git a/Console/Descriptor/Descriptor.php b/Console/Descriptor/Descriptor.php
index ba500adb2..8541f71bb 100644
--- a/Console/Descriptor/Descriptor.php
+++ b/Console/Descriptor/Descriptor.php
@@ -96,7 +96,7 @@ abstract protected function describeContainerTags(ContainerBuilder $container, a
*
* @param Definition|Alias|object $service
*/
- abstract protected function describeContainerService(object $service, array $options = [], ContainerBuilder $container = null): void;
+ abstract protected function describeContainerService(object $service, array $options = [], ?ContainerBuilder $container = null): void;
/**
* Describes container services.
@@ -108,9 +108,9 @@ abstract protected function describeContainerServices(ContainerBuilder $containe
abstract protected function describeContainerDeprecations(ContainerBuilder $container, array $options = []): void;
- abstract protected function describeContainerDefinition(Definition $definition, array $options = [], ContainerBuilder $container = null): void;
+ abstract protected function describeContainerDefinition(Definition $definition, array $options = [], ?ContainerBuilder $container = null): void;
- abstract protected function describeContainerAlias(Alias $alias, array $options = [], ContainerBuilder $container = null): void;
+ abstract protected function describeContainerAlias(Alias $alias, array $options = [], ?ContainerBuilder $container = null): void;
abstract protected function describeContainerParameter(mixed $parameter, ?array $deprecation, array $options = []): void;
@@ -278,7 +278,7 @@ protected function getReverseAliases(RouteCollection $routes): array
return $reverseAliases;
}
- public static function getClassDescription(string $class, string &$resolvedClass = null): string
+ public static function getClassDescription(string $class, ?string &$resolvedClass = null): string
{
$resolvedClass = $class;
try {
diff --git a/Console/Descriptor/JsonDescriptor.php b/Console/Descriptor/JsonDescriptor.php
index 35c86c584..0c5a31ff7 100644
--- a/Console/Descriptor/JsonDescriptor.php
+++ b/Console/Descriptor/JsonDescriptor.php
@@ -70,7 +70,7 @@ protected function describeContainerTags(ContainerBuilder $container, array $opt
$this->writeData($data, $options);
}
- protected function describeContainerService(object $service, array $options = [], ContainerBuilder $container = null): void
+ protected function describeContainerService(object $service, array $options = [], ?ContainerBuilder $container = null): void
{
if (!isset($options['id'])) {
throw new \InvalidArgumentException('An "id" option must be provided.');
@@ -121,12 +121,12 @@ protected function describeContainerServices(ContainerBuilder $container, array
$this->writeData($data, $options);
}
- protected function describeContainerDefinition(Definition $definition, array $options = [], ContainerBuilder $container = null): void
+ protected function describeContainerDefinition(Definition $definition, array $options = [], ?ContainerBuilder $container = null): void
{
$this->writeData($this->getContainerDefinitionData($definition, isset($options['omit_tags']) && $options['omit_tags'], isset($options['show_arguments']) && $options['show_arguments'], $container, $options['id'] ?? null), $options);
}
- protected function describeContainerAlias(Alias $alias, array $options = [], ContainerBuilder $container = null): void
+ protected function describeContainerAlias(Alias $alias, array $options = [], ?ContainerBuilder $container = null): void
{
if (!$container) {
$this->writeData($this->getContainerAliasData($alias), $options);
@@ -245,7 +245,7 @@ protected function sortParameters(ParameterBag $parameters): array
return $sortedParameters;
}
- private function getContainerDefinitionData(Definition $definition, bool $omitTags = false, bool $showArguments = false, ContainerBuilder $container = null, string $id = null): array
+ private function getContainerDefinitionData(Definition $definition, bool $omitTags = false, bool $showArguments = false, ?ContainerBuilder $container = null, ?string $id = null): array
{
$data = [
'class' => (string) $definition->getClass(),
@@ -418,7 +418,7 @@ private function getCallableData(mixed $callable): array
throw new \InvalidArgumentException('Callable is not describable.');
}
- private function describeValue($value, bool $omitTags, bool $showArguments, ContainerBuilder $container = null, string $id = null): mixed
+ private function describeValue($value, bool $omitTags, bool $showArguments, ?ContainerBuilder $container = null, ?string $id = null): mixed
{
if (\is_array($value)) {
$data = [];
diff --git a/Console/Descriptor/MarkdownDescriptor.php b/Console/Descriptor/MarkdownDescriptor.php
index 3b66c79cf..69277fecc 100644
--- a/Console/Descriptor/MarkdownDescriptor.php
+++ b/Console/Descriptor/MarkdownDescriptor.php
@@ -98,7 +98,7 @@ protected function describeContainerTags(ContainerBuilder $container, array $opt
}
}
- protected function describeContainerService(object $service, array $options = [], ContainerBuilder $container = null): void
+ protected function describeContainerService(object $service, array $options = [], ?ContainerBuilder $container = null): void
{
if (!isset($options['id'])) {
throw new \InvalidArgumentException('An "id" option must be provided.');
@@ -206,7 +206,7 @@ protected function describeContainerServices(ContainerBuilder $container, array
}
}
- protected function describeContainerDefinition(Definition $definition, array $options = [], ContainerBuilder $container = null): void
+ protected function describeContainerDefinition(Definition $definition, array $options = [], ?ContainerBuilder $container = null): void
{
$output = '';
@@ -276,7 +276,7 @@ protected function describeContainerDefinition(Definition $definition, array $op
$this->write(isset($options['id']) ? sprintf("### %s\n\n%s\n", $options['id'], $output) : $output);
}
- protected function describeContainerAlias(Alias $alias, array $options = [], ContainerBuilder $container = null): void
+ protected function describeContainerAlias(Alias $alias, array $options = [], ?ContainerBuilder $container = null): void
{
$output = '- Service: `'.$alias.'`'
."\n".'- Public: '.($alias->isPublic() && !$alias->isPrivate() ? 'yes' : 'no');
diff --git a/Console/Descriptor/TextDescriptor.php b/Console/Descriptor/TextDescriptor.php
index d13d3e13c..ebac3b370 100644
--- a/Console/Descriptor/TextDescriptor.php
+++ b/Console/Descriptor/TextDescriptor.php
@@ -40,7 +40,7 @@ class TextDescriptor extends Descriptor
{
private ?FileLinkFormatter $fileLinkFormatter;
- public function __construct(FileLinkFormatter $fileLinkFormatter = null)
+ public function __construct(?FileLinkFormatter $fileLinkFormatter = null)
{
$this->fileLinkFormatter = $fileLinkFormatter;
}
@@ -159,7 +159,7 @@ protected function describeContainerTags(ContainerBuilder $container, array $opt
}
}
- protected function describeContainerService(object $service, array $options = [], ContainerBuilder $container = null): void
+ protected function describeContainerService(object $service, array $options = [], ?ContainerBuilder $container = null): void
{
if (!isset($options['id'])) {
throw new \InvalidArgumentException('An "id" option must be provided.');
@@ -281,7 +281,7 @@ protected function describeContainerServices(ContainerBuilder $container, array
$options['output']->table($tableHeaders, $tableRows);
}
- protected function describeContainerDefinition(Definition $definition, array $options = [], ContainerBuilder $container = null): void
+ protected function describeContainerDefinition(Definition $definition, array $options = [], ?ContainerBuilder $container = null): void
{
if (isset($options['id'])) {
$options['output']->title(sprintf('Information for Service "%s"', $options['id']));
@@ -420,7 +420,7 @@ protected function describeContainerDeprecations(ContainerBuilder $container, ar
$options['output']->listing($formattedLogs);
}
- protected function describeContainerAlias(Alias $alias, array $options = [], ContainerBuilder $container = null): void
+ protected function describeContainerAlias(Alias $alias, array $options = [], ?ContainerBuilder $container = null): void
{
if ($alias->isPublic() && !$alias->isPrivate()) {
$options['output']->comment(sprintf('This service is a public alias for the service %s', (string) $alias));
@@ -579,7 +579,7 @@ private function formatRouterConfig(array $config): string
return trim($configAsString);
}
- private function formatControllerLink(mixed $controller, string $anchorText, callable $getContainer = null): string
+ private function formatControllerLink(mixed $controller, string $anchorText, ?callable $getContainer = null): string
{
if (null === $this->fileLinkFormatter) {
return $anchorText;
diff --git a/Console/Descriptor/XmlDescriptor.php b/Console/Descriptor/XmlDescriptor.php
index 069dcf09f..672fb750b 100644
--- a/Console/Descriptor/XmlDescriptor.php
+++ b/Console/Descriptor/XmlDescriptor.php
@@ -53,7 +53,7 @@ protected function describeContainerTags(ContainerBuilder $container, array $opt
$this->writeDocument($this->getContainerTagsDocument($container, isset($options['show_hidden']) && $options['show_hidden']));
}
- protected function describeContainerService(object $service, array $options = [], ContainerBuilder $container = null): void
+ protected function describeContainerService(object $service, array $options = [], ?ContainerBuilder $container = null): void
{
if (!isset($options['id'])) {
throw new \InvalidArgumentException('An "id" option must be provided.');
@@ -67,12 +67,12 @@ protected function describeContainerServices(ContainerBuilder $container, array
$this->writeDocument($this->getContainerServicesDocument($container, $options['tag'] ?? null, isset($options['show_hidden']) && $options['show_hidden'], isset($options['show_arguments']) && $options['show_arguments'], $options['filter'] ?? null, $options['id'] ?? null));
}
- protected function describeContainerDefinition(Definition $definition, array $options = [], ContainerBuilder $container = null): void
+ protected function describeContainerDefinition(Definition $definition, array $options = [], ?ContainerBuilder $container = null): void
{
$this->writeDocument($this->getContainerDefinitionDocument($definition, $options['id'] ?? null, isset($options['omit_tags']) && $options['omit_tags'], isset($options['show_arguments']) && $options['show_arguments'], $container));
}
- protected function describeContainerAlias(Alias $alias, array $options = [], ContainerBuilder $container = null): void
+ protected function describeContainerAlias(Alias $alias, array $options = [], ?ContainerBuilder $container = null): void
{
$dom = new \DOMDocument('1.0', 'UTF-8');
$dom->appendChild($dom->importNode($this->getContainerAliasDocument($alias, $options['id'] ?? null)->childNodes->item(0), true));
@@ -162,7 +162,7 @@ private function getRouteCollectionDocument(RouteCollection $routes, array $opti
return $dom;
}
- private function getRouteDocument(Route $route, string $name = null): \DOMDocument
+ private function getRouteDocument(Route $route, ?string $name = null): \DOMDocument
{
$dom = new \DOMDocument('1.0', 'UTF-8');
$dom->appendChild($routeXML = $dom->createElement('route'));
@@ -268,7 +268,7 @@ private function getContainerTagsDocument(ContainerBuilder $container, bool $sho
return $dom;
}
- private function getContainerServiceDocument(object $service, string $id, ContainerBuilder $container = null, bool $showArguments = false): \DOMDocument
+ private function getContainerServiceDocument(object $service, string $id, ?ContainerBuilder $container = null, bool $showArguments = false): \DOMDocument
{
$dom = new \DOMDocument('1.0', 'UTF-8');
@@ -288,7 +288,7 @@ private function getContainerServiceDocument(object $service, string $id, Contai
return $dom;
}
- private function getContainerServicesDocument(ContainerBuilder $container, string $tag = null, bool $showHidden = false, bool $showArguments = false, callable $filter = null, string $id = null): \DOMDocument
+ private function getContainerServicesDocument(ContainerBuilder $container, ?string $tag = null, bool $showHidden = false, bool $showArguments = false, ?callable $filter = null, ?string $id = null): \DOMDocument
{
$dom = new \DOMDocument('1.0', 'UTF-8');
$dom->appendChild($containerXML = $dom->createElement('container'));
@@ -318,7 +318,7 @@ private function getContainerServicesDocument(ContainerBuilder $container, strin
return $dom;
}
- private function getContainerDefinitionDocument(Definition $definition, string $id = null, bool $omitTags = false, bool $showArguments = false, ContainerBuilder $container = null): \DOMDocument
+ private function getContainerDefinitionDocument(Definition $definition, ?string $id = null, bool $omitTags = false, bool $showArguments = false, ?ContainerBuilder $container = null): \DOMDocument
{
$dom = new \DOMDocument('1.0', 'UTF-8');
$dom->appendChild($serviceXML = $dom->createElement('definition'));
@@ -418,7 +418,7 @@ private function getContainerDefinitionDocument(Definition $definition, string $
/**
* @return \DOMNode[]
*/
- private function getArgumentNodes(array $arguments, \DOMDocument $dom, ContainerBuilder $container = null): array
+ private function getArgumentNodes(array $arguments, \DOMDocument $dom, ?ContainerBuilder $container = null): array
{
$nodes = [];
@@ -466,7 +466,7 @@ private function getArgumentNodes(array $arguments, \DOMDocument $dom, Container
return $nodes;
}
- private function getContainerAliasDocument(Alias $alias, string $id = null): \DOMDocument
+ private function getContainerAliasDocument(Alias $alias, ?string $id = null): \DOMDocument
{
$dom = new \DOMDocument('1.0', 'UTF-8');
$dom->appendChild($aliasXML = $dom->createElement('alias'));
diff --git a/Console/Helper/DescriptorHelper.php b/Console/Helper/DescriptorHelper.php
index 47d69fef4..b12a8d862 100644
--- a/Console/Helper/DescriptorHelper.php
+++ b/Console/Helper/DescriptorHelper.php
@@ -25,7 +25,7 @@
*/
class DescriptorHelper extends BaseDescriptorHelper
{
- public function __construct(FileLinkFormatter $fileLinkFormatter = null)
+ public function __construct(?FileLinkFormatter $fileLinkFormatter = null)
{
$this
->register('txt', new TextDescriptor($fileLinkFormatter))
diff --git a/Controller/AbstractController.php b/Controller/AbstractController.php
index dd65afce1..f0c1d98ee 100644
--- a/Controller/AbstractController.php
+++ b/Controller/AbstractController.php
@@ -160,7 +160,7 @@ protected function json(mixed $data, int $status = 200, array $headers = [], arr
/**
* Returns a BinaryFileResponse object with original or customized file name and disposition header.
*/
- protected function file(\SplFileInfo|string $file, string $fileName = null, string $disposition = ResponseHeaderBag::DISPOSITION_ATTACHMENT): BinaryFileResponse
+ protected function file(\SplFileInfo|string $file, ?string $fileName = null, string $disposition = ResponseHeaderBag::DISPOSITION_ATTACHMENT): BinaryFileResponse
{
$response = new BinaryFileResponse($file);
$response->setContentDisposition($disposition, $fileName ?? $response->getFile()->getFilename());
@@ -245,7 +245,7 @@ protected function renderBlockView(string $view, string $block, array $parameter
* If an invalid form is found in the list of parameters, a 422 status code is returned.
* Forms found in parameters are auto-cast to form views.
*/
- protected function render(string $view, array $parameters = [], Response $response = null): Response
+ protected function render(string $view, array $parameters = [], ?Response $response = null): Response
{
return $this->doRender($view, null, $parameters, $response, __FUNCTION__);
}
@@ -256,7 +256,7 @@ protected function render(string $view, array $parameters = [], Response $respon
* If an invalid form is found in the list of parameters, a 422 status code is returned.
* Forms found in parameters are auto-cast to form views.
*/
- protected function renderBlock(string $view, string $block, array $parameters = [], Response $response = null): Response
+ protected function renderBlock(string $view, string $block, array $parameters = [], ?Response $response = null): Response
{
return $this->doRender($view, $block, $parameters, $response, __FUNCTION__);
}
@@ -264,7 +264,7 @@ protected function renderBlock(string $view, string $block, array $parameters =
/**
* Streams a view.
*/
- protected function stream(string $view, array $parameters = [], StreamedResponse $response = null): StreamedResponse
+ protected function stream(string $view, array $parameters = [], ?StreamedResponse $response = null): StreamedResponse
{
if (!$this->container->has('twig')) {
throw new \LogicException('You cannot use the "stream" method if the Twig Bundle is not available. Try running "composer require symfony/twig-bundle".');
@@ -292,7 +292,7 @@ protected function stream(string $view, array $parameters = [], StreamedResponse
*
* throw $this->createNotFoundException('Page not found!');
*/
- protected function createNotFoundException(string $message = 'Not Found', \Throwable $previous = null): NotFoundHttpException
+ protected function createNotFoundException(string $message = 'Not Found', ?\Throwable $previous = null): NotFoundHttpException
{
return new NotFoundHttpException($message, $previous);
}
@@ -306,7 +306,7 @@ protected function createNotFoundException(string $message = 'Not Found', \Throw
*
* @throws \LogicException If the Security component is not available
*/
- protected function createAccessDeniedException(string $message = 'Access Denied.', \Throwable $previous = null): AccessDeniedException
+ protected function createAccessDeniedException(string $message = 'Access Denied.', ?\Throwable $previous = null): AccessDeniedException
{
if (!class_exists(AccessDeniedException::class)) {
throw new \LogicException('You cannot use the "createAccessDeniedException" method if the Security component is not available. Try running "composer require symfony/security-bundle".');
@@ -389,7 +389,7 @@ protected function addLink(Request $request, LinkInterface $link): void
/**
* @param LinkInterface[] $links
*/
- protected function sendEarlyHints(iterable $links = [], Response $response = null): Response
+ protected function sendEarlyHints(iterable $links = [], ?Response $response = null): Response
{
if (!$this->container->has('web_link.http_header_serializer')) {
throw new \LogicException('You cannot use the "sendEarlyHints" method if the WebLink component is not available. Try running "composer require symfony/web-link".');
diff --git a/Controller/RedirectController.php b/Controller/RedirectController.php
index f5f42a7f7..fbb52ead7 100644
--- a/Controller/RedirectController.php
+++ b/Controller/RedirectController.php
@@ -31,7 +31,7 @@ class RedirectController
private ?int $httpPort;
private ?int $httpsPort;
- public function __construct(UrlGeneratorInterface $router = null, int $httpPort = null, int $httpsPort = null)
+ public function __construct(?UrlGeneratorInterface $router = null, ?int $httpPort = null, ?int $httpsPort = null)
{
$this->router = $router;
$this->httpPort = $httpPort;
@@ -107,7 +107,7 @@ public function redirectAction(Request $request, string $route, bool $permanent
*
* @throws HttpException In case the path is empty
*/
- public function urlRedirectAction(Request $request, string $path, bool $permanent = false, string $scheme = null, int $httpPort = null, int $httpsPort = null, bool $keepRequestMethod = false): Response
+ public function urlRedirectAction(Request $request, string $path, bool $permanent = false, ?string $scheme = null, ?int $httpPort = null, ?int $httpsPort = null, bool $keepRequestMethod = false): Response
{
if ('' == $path) {
throw new HttpException($permanent ? 410 : 404);
diff --git a/Controller/TemplateController.php b/Controller/TemplateController.php
index 437458a49..97631572c 100644
--- a/Controller/TemplateController.php
+++ b/Controller/TemplateController.php
@@ -25,7 +25,7 @@ class TemplateController
{
private ?Environment $twig;
- public function __construct(Environment $twig = null)
+ public function __construct(?Environment $twig = null)
{
$this->twig = $twig;
}
@@ -40,7 +40,7 @@ public function __construct(Environment $twig = null)
* @param array $context The context (arguments) of the template
* @param int $statusCode The HTTP status code to return with the response (200 "OK" by default)
*/
- public function templateAction(string $template, int $maxAge = null, int $sharedAge = null, bool $private = null, array $context = [], int $statusCode = 200): Response
+ public function templateAction(string $template, ?int $maxAge = null, ?int $sharedAge = null, ?bool $private = null, array $context = [], int $statusCode = 200): Response
{
if (null === $this->twig) {
throw new \LogicException('You cannot use the TemplateController if the Twig Bundle is not available. Try running "composer require symfony/twig-bundle".');
@@ -68,7 +68,7 @@ public function templateAction(string $template, int $maxAge = null, int $shared
/**
* @param int $statusCode The HTTP status code (200 "OK" by default)
*/
- public function __invoke(string $template, int $maxAge = null, int $sharedAge = null, bool $private = null, array $context = [], int $statusCode = 200): Response
+ public function __invoke(string $template, ?int $maxAge = null, ?int $sharedAge = null, ?bool $private = null, array $context = [], int $statusCode = 200): Response
{
return $this->templateAction($template, $maxAge, $sharedAge, $private, $context, $statusCode);
}
diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php
index a247418a9..a05c329e4 100644
--- a/DependencyInjection/Configuration.php
+++ b/DependencyInjection/Configuration.php
@@ -131,7 +131,7 @@ public function getConfigTreeBuilder(): TreeBuilder
->end()
;
- $willBeAvailable = static function (string $package, string $class, string $parentPackage = null) {
+ $willBeAvailable = static function (string $package, string $class, ?string $parentPackage = null) {
$parentPackages = (array) $parentPackage;
$parentPackages[] = 'symfony/framework-bundle';
diff --git a/DependencyInjection/FrameworkExtension.php b/DependencyInjection/FrameworkExtension.php
index 132a6329e..26f5c1c32 100644
--- a/DependencyInjection/FrameworkExtension.php
+++ b/DependencyInjection/FrameworkExtension.php
@@ -2725,7 +2725,7 @@ private function registerNotifierConfiguration(array $config, ContainerBuilder $
NotifierBridge\Mastodon\MastodonTransportFactory::class => 'notifier.transport_factory.mastodon',
NotifierBridge\Mattermost\MattermostTransportFactory::class => 'notifier.transport_factory.mattermost',
NotifierBridge\Mercure\MercureTransportFactory::class => 'notifier.transport_factory.mercure',
- NotifierBridge\MessageBird\MessageBirdTransport::class => 'notifier.transport_factory.message-bird',
+ NotifierBridge\MessageBird\MessageBirdTransportFactory::class => 'notifier.transport_factory.message-bird',
NotifierBridge\MessageMedia\MessageMediaTransportFactory::class => 'notifier.transport_factory.message-media',
NotifierBridge\MicrosoftTeams\MicrosoftTeamsTransportFactory::class => 'notifier.transport_factory.microsoft-teams',
NotifierBridge\Mobyt\MobytTransportFactory::class => 'notifier.transport_factory.mobyt',
@@ -2755,7 +2755,7 @@ private function registerNotifierConfiguration(array $config, ContainerBuilder $
NotifierBridge\Telegram\TelegramTransportFactory::class => 'notifier.transport_factory.telegram',
NotifierBridge\Telnyx\TelnyxTransportFactory::class => 'notifier.transport_factory.telnyx',
NotifierBridge\Termii\TermiiTransportFactory::class => 'notifier.transport_factory.termii',
- NotifierBridge\TurboSms\TurboSmsTransport::class => 'notifier.transport_factory.turbo-sms',
+ NotifierBridge\TurboSms\TurboSmsTransportFactory::class => 'notifier.transport_factory.turbo-sms',
NotifierBridge\Twilio\TwilioTransportFactory::class => 'notifier.transport_factory.twilio',
NotifierBridge\Twitter\TwitterTransportFactory::class => 'notifier.transport_factory.twitter',
NotifierBridge\Vonage\VonageTransportFactory::class => 'notifier.transport_factory.vonage',
@@ -2776,27 +2776,27 @@ private function registerNotifierConfiguration(array $config, ContainerBuilder $
if (ContainerBuilder::willBeAvailable('symfony/mercure-notifier', NotifierBridge\Mercure\MercureTransportFactory::class, $parentPackages) && ContainerBuilder::willBeAvailable('symfony/mercure-bundle', MercureBundle::class, $parentPackages) && \in_array(MercureBundle::class, $container->getParameter('kernel.bundles'), true)) {
$container->getDefinition($classToServices[NotifierBridge\Mercure\MercureTransportFactory::class])
- ->replaceArgument('$registry', new Reference(HubRegistry::class))
- ->replaceArgument('$client', new Reference('http_client', ContainerBuilder::NULL_ON_INVALID_REFERENCE))
- ->replaceArgument('$dispatcher', new Reference('event_dispatcher', ContainerBuilder::NULL_ON_INVALID_REFERENCE));
+ ->replaceArgument(0, new Reference(HubRegistry::class))
+ ->replaceArgument(1, new Reference('event_dispatcher', ContainerBuilder::NULL_ON_INVALID_REFERENCE))
+ ->addArgument(new Reference('http_client', ContainerBuilder::NULL_ON_INVALID_REFERENCE));
} elseif (ContainerBuilder::willBeAvailable('symfony/mercure-notifier', NotifierBridge\Mercure\MercureTransportFactory::class, $parentPackages)) {
$container->removeDefinition($classToServices[NotifierBridge\Mercure\MercureTransportFactory::class]);
}
if (ContainerBuilder::willBeAvailable('symfony/fake-chat-notifier', NotifierBridge\FakeChat\FakeChatTransportFactory::class, ['symfony/framework-bundle', 'symfony/notifier', 'symfony/mailer'])) {
$container->getDefinition($classToServices[NotifierBridge\FakeChat\FakeChatTransportFactory::class])
- ->replaceArgument('$mailer', new Reference('mailer'))
- ->replaceArgument('$logger', new Reference('logger'))
- ->replaceArgument('$client', new Reference('http_client', ContainerBuilder::NULL_ON_INVALID_REFERENCE))
- ->replaceArgument('$dispatcher', new Reference('event_dispatcher', ContainerBuilder::NULL_ON_INVALID_REFERENCE));
+ ->replaceArgument(0, new Reference('mailer'))
+ ->replaceArgument(1, new Reference('logger'))
+ ->addArgument(new Reference('event_dispatcher', ContainerBuilder::NULL_ON_INVALID_REFERENCE))
+ ->addArgument(new Reference('http_client', ContainerBuilder::NULL_ON_INVALID_REFERENCE));
}
if (ContainerBuilder::willBeAvailable('symfony/fake-sms-notifier', NotifierBridge\FakeSms\FakeSmsTransportFactory::class, ['symfony/framework-bundle', 'symfony/notifier', 'symfony/mailer'])) {
$container->getDefinition($classToServices[NotifierBridge\FakeSms\FakeSmsTransportFactory::class])
- ->replaceArgument('$mailer', new Reference('mailer'))
- ->replaceArgument('$logger', new Reference('logger'))
- ->replaceArgument('$client', new Reference('http_client', ContainerBuilder::NULL_ON_INVALID_REFERENCE))
- ->replaceArgument('$dispatcher', new Reference('event_dispatcher', ContainerBuilder::NULL_ON_INVALID_REFERENCE));
+ ->replaceArgument(0, new Reference('mailer'))
+ ->replaceArgument(1, new Reference('logger'))
+ ->addArgument(new Reference('event_dispatcher', ContainerBuilder::NULL_ON_INVALID_REFERENCE))
+ ->addArgument(new Reference('http_client', ContainerBuilder::NULL_ON_INVALID_REFERENCE));
}
if (isset($config['admin_recipients'])) {
diff --git a/HttpCache/HttpCache.php b/HttpCache/HttpCache.php
index ab8cae6b7..38eee7361 100644
--- a/HttpCache/HttpCache.php
+++ b/HttpCache/HttpCache.php
@@ -37,7 +37,7 @@ class HttpCache extends BaseHttpCache
/**
* @param $cache The cache directory (default used if null) or the storage instance
*/
- public function __construct(KernelInterface $kernel, string|StoreInterface $cache = null, SurrogateInterface $surrogate = null, array $options = null)
+ public function __construct(KernelInterface $kernel, string|StoreInterface|null $cache = null, ?SurrogateInterface $surrogate = null, ?array $options = null)
{
$this->kernel = $kernel;
$this->surrogate = $surrogate;
@@ -60,7 +60,7 @@ public function __construct(KernelInterface $kernel, string|StoreInterface $cach
parent::__construct($kernel, $this->createStore(), $this->createSurrogate(), array_merge($this->options, $this->getOptions()));
}
- protected function forward(Request $request, bool $catch = false, Response $entry = null): Response
+ protected function forward(Request $request, bool $catch = false, ?Response $entry = null): Response
{
$this->getKernel()->boot();
$this->getKernel()->getContainer()->set('cache', $this);
diff --git a/KernelBrowser.php b/KernelBrowser.php
index 0c1374633..e06b9a056 100644
--- a/KernelBrowser.php
+++ b/KernelBrowser.php
@@ -34,7 +34,7 @@ class KernelBrowser extends HttpKernelBrowser
private bool $profiler = false;
private bool $reboot = true;
- public function __construct(KernelInterface $kernel, array $server = [], History $history = null, CookieJar $cookieJar = null)
+ public function __construct(KernelInterface $kernel, array $server = [], ?History $history = null, ?CookieJar $cookieJar = null)
{
parent::__construct($kernel, $server, $history, $cookieJar);
}
diff --git a/README.md b/README.md
index 14c600fac..220d72a8a 100644
--- a/README.md
+++ b/README.md
@@ -17,4 +17,4 @@ Resources
[send Pull Requests](https://github.com/symfony/symfony/pulls)
in the [main Symfony repository](https://github.com/symfony/symfony)
-[3]: https://symfony.com/sponsor
+[1]: https://symfony.com/sponsor
diff --git a/Routing/Attribute/AsRoutingConditionService.php b/Routing/Attribute/AsRoutingConditionService.php
index d1f1a5f34..13f8ff26a 100644
--- a/Routing/Attribute/AsRoutingConditionService.php
+++ b/Routing/Attribute/AsRoutingConditionService.php
@@ -42,7 +42,7 @@
class AsRoutingConditionService extends AutoconfigureTag
{
public function __construct(
- string $alias = null,
+ ?string $alias = null,
int $priority = 0,
) {
parent::__construct('routing.condition_service', ['alias' => $alias, 'priority' => $priority]);
diff --git a/Routing/DelegatingLoader.php b/Routing/DelegatingLoader.php
index df7e9348c..3239d1094 100644
--- a/Routing/DelegatingLoader.php
+++ b/Routing/DelegatingLoader.php
@@ -40,7 +40,7 @@ public function __construct(LoaderResolverInterface $resolver, array $defaultOpt
parent::__construct($resolver);
}
- public function load(mixed $resource, string $type = null): RouteCollection
+ public function load(mixed $resource, ?string $type = null): RouteCollection
{
if ($this->loading) {
// This can happen if a fatal error occurs in parent::load().
diff --git a/Routing/RedirectableCompiledUrlMatcher.php b/Routing/RedirectableCompiledUrlMatcher.php
index 538427aae..609502bca 100644
--- a/Routing/RedirectableCompiledUrlMatcher.php
+++ b/Routing/RedirectableCompiledUrlMatcher.php
@@ -21,7 +21,7 @@
*/
class RedirectableCompiledUrlMatcher extends CompiledUrlMatcher implements RedirectableUrlMatcherInterface
{
- public function redirect(string $path, string $route, string $scheme = null): array
+ public function redirect(string $path, string $route, ?string $scheme = null): array
{
return [
'_controller' => 'Symfony\\Bundle\\FrameworkBundle\\Controller\\RedirectController::urlRedirectAction',
diff --git a/Routing/Router.php b/Routing/Router.php
index d6b1d57dc..53d8b06d0 100644
--- a/Routing/Router.php
+++ b/Routing/Router.php
@@ -40,7 +40,7 @@ class Router extends BaseRouter implements WarmableInterface, ServiceSubscriberI
/**
* @param mixed $resource The main resource to load
*/
- public function __construct(ContainerInterface $container, mixed $resource, array $options = [], RequestContext $context = null, ContainerInterface $parameters = null, LoggerInterface $logger = null, string $defaultLocale = null)
+ public function __construct(ContainerInterface $container, mixed $resource, array $options = [], ?RequestContext $context = null, ?ContainerInterface $parameters = null, ?LoggerInterface $logger = null, ?string $defaultLocale = null)
{
$this->container = $container;
$this->resource = $resource;
@@ -80,7 +80,7 @@ public function getRouteCollection(): RouteCollection
return $this->collection;
}
- public function warmUp(string $cacheDir, string $buildDir = null): array
+ public function warmUp(string $cacheDir, ?string $buildDir = null): array
{
$currentDir = $this->getOption('cache_dir');
diff --git a/Secrets/SodiumVault.php b/Secrets/SodiumVault.php
index b6bb058b3..dcf79869f 100644
--- a/Secrets/SodiumVault.php
+++ b/Secrets/SodiumVault.php
@@ -12,6 +12,7 @@
namespace Symfony\Bundle\FrameworkBundle\Secrets;
use Symfony\Component\DependencyInjection\EnvVarLoaderInterface;
+use Symfony\Component\String\LazyString;
use Symfony\Component\VarExporter\VarExporter;
/**
@@ -30,7 +31,7 @@ class SodiumVault extends AbstractVault implements EnvVarLoaderInterface
* @param $decryptionKey A string or a stringable object that defines the private key to use to decrypt the vault
* or null to store generated keys in the provided $secretsDir
*/
- public function __construct(string $secretsDir, #[\SensitiveParameter] string|\Stringable $decryptionKey = null)
+ public function __construct(string $secretsDir, #[\SensitiveParameter] string|\Stringable|null $decryptionKey = null)
{
$this->pathPrefix = rtrim(strtr($secretsDir, '/', \DIRECTORY_SEPARATOR), \DIRECTORY_SEPARATOR).\DIRECTORY_SEPARATOR.basename($secretsDir).'.';
$this->decryptionKey = $decryptionKey;
@@ -169,7 +170,14 @@ public function list(bool $reveal = false): array
public function loadEnvVars(): array
{
- return $this->list(true);
+ $envs = [];
+ $reveal = $this->reveal(...);
+
+ foreach ($this->list() as $name => $value) {
+ $envs[$name] = LazyString::fromCallable($reveal, $name);
+ }
+
+ return $envs;
}
private function loadKeys(): void
diff --git a/Test/BrowserKitAssertionsTrait.php b/Test/BrowserKitAssertionsTrait.php
index a6d4fed33..125aa45a7 100644
--- a/Test/BrowserKitAssertionsTrait.php
+++ b/Test/BrowserKitAssertionsTrait.php
@@ -43,7 +43,7 @@ public static function assertResponseFormatSame(?string $expectedFormat, string
self::assertThatForResponse(new ResponseConstraint\ResponseFormatSame(self::getRequest(), $expectedFormat), $message);
}
- public static function assertResponseRedirects(string $expectedLocation = null, int $expectedCode = null, string $message = ''): void
+ public static function assertResponseRedirects(?string $expectedLocation = null, ?int $expectedCode = null, string $message = ''): void
{
$constraint = new ResponseConstraint\ResponseIsRedirected();
if ($expectedLocation) {
@@ -82,17 +82,17 @@ public static function assertResponseHeaderNotSame(string $headerName, string $e
self::assertThatForResponse(new LogicalNot(new ResponseConstraint\ResponseHeaderSame($headerName, $expectedValue)), $message);
}
- public static function assertResponseHasCookie(string $name, string $path = '/', string $domain = null, string $message = ''): void
+ public static function assertResponseHasCookie(string $name, string $path = '/', ?string $domain = null, string $message = ''): void
{
self::assertThatForResponse(new ResponseConstraint\ResponseHasCookie($name, $path, $domain), $message);
}
- public static function assertResponseNotHasCookie(string $name, string $path = '/', string $domain = null, string $message = ''): void
+ public static function assertResponseNotHasCookie(string $name, string $path = '/', ?string $domain = null, string $message = ''): void
{
self::assertThatForResponse(new LogicalNot(new ResponseConstraint\ResponseHasCookie($name, $path, $domain)), $message);
}
- public static function assertResponseCookieValueSame(string $name, string $expectedValue, string $path = '/', string $domain = null, string $message = ''): void
+ public static function assertResponseCookieValueSame(string $name, string $expectedValue, string $path = '/', ?string $domain = null, string $message = ''): void
{
self::assertThatForResponse(LogicalAnd::fromConstraints(
new ResponseConstraint\ResponseHasCookie($name, $path, $domain),
@@ -105,17 +105,17 @@ public static function assertResponseIsUnprocessable(string $message = ''): void
self::assertThatForResponse(new ResponseConstraint\ResponseIsUnprocessable(), $message);
}
- public static function assertBrowserHasCookie(string $name, string $path = '/', string $domain = null, string $message = ''): void
+ public static function assertBrowserHasCookie(string $name, string $path = '/', ?string $domain = null, string $message = ''): void
{
self::assertThatForClient(new BrowserKitConstraint\BrowserHasCookie($name, $path, $domain), $message);
}
- public static function assertBrowserNotHasCookie(string $name, string $path = '/', string $domain = null, string $message = ''): void
+ public static function assertBrowserNotHasCookie(string $name, string $path = '/', ?string $domain = null, string $message = ''): void
{
self::assertThatForClient(new LogicalNot(new BrowserKitConstraint\BrowserHasCookie($name, $path, $domain)), $message);
}
- public static function assertBrowserCookieValueSame(string $name, string $expectedValue, bool $raw = false, string $path = '/', string $domain = null, string $message = ''): void
+ public static function assertBrowserCookieValueSame(string $name, string $expectedValue, bool $raw = false, string $path = '/', ?string $domain = null, string $message = ''): void
{
self::assertThatForClient(LogicalAnd::fromConstraints(
new BrowserKitConstraint\BrowserHasCookie($name, $path, $domain),
@@ -162,7 +162,7 @@ public static function assertThatForClient(Constraint $constraint, string $messa
self::assertThat(self::getClient(), $constraint, $message);
}
- protected static function getClient(AbstractBrowser $newClient = null): ?AbstractBrowser
+ protected static function getClient(?AbstractBrowser $newClient = null): ?AbstractBrowser
{
static $client;
diff --git a/Test/HttpClientAssertionsTrait.php b/Test/HttpClientAssertionsTrait.php
index bed835fa1..20c64608e 100644
--- a/Test/HttpClientAssertionsTrait.php
+++ b/Test/HttpClientAssertionsTrait.php
@@ -20,7 +20,7 @@
trait HttpClientAssertionsTrait
{
- public static function assertHttpClientRequest(string $expectedUrl, string $expectedMethod = 'GET', string|array $expectedBody = null, array $expectedHeaders = [], string $httpClientId = 'http_client'): void
+ public static function assertHttpClientRequest(string $expectedUrl, string $expectedMethod = 'GET', string|array|null $expectedBody = null, array $expectedHeaders = [], string $httpClientId = 'http_client'): void
{
/** @var KernelBrowser $client */
$client = static::getClient();
diff --git a/Test/MailerAssertionsTrait.php b/Test/MailerAssertionsTrait.php
index 83643421e..2308c3e2f 100644
--- a/Test/MailerAssertionsTrait.php
+++ b/Test/MailerAssertionsTrait.php
@@ -20,12 +20,12 @@
trait MailerAssertionsTrait
{
- public static function assertEmailCount(int $count, string $transport = null, string $message = ''): void
+ public static function assertEmailCount(int $count, ?string $transport = null, string $message = ''): void
{
self::assertThat(self::getMessageMailerEvents(), new MailerConstraint\EmailCount($count, $transport), $message);
}
- public static function assertQueuedEmailCount(int $count, string $transport = null, string $message = ''): void
+ public static function assertQueuedEmailCount(int $count, ?string $transport = null, string $message = ''): void
{
self::assertThat(self::getMessageMailerEvents(), new MailerConstraint\EmailCount($count, $transport, true), $message);
}
@@ -103,12 +103,12 @@ public static function assertEmailSubjectNotContains(RawMessage $email, string $
/**
* @return MessageEvent[]
*/
- public static function getMailerEvents(string $transport = null): array
+ public static function getMailerEvents(?string $transport = null): array
{
return self::getMessageMailerEvents()->getEvents($transport);
}
- public static function getMailerEvent(int $index = 0, string $transport = null): ?MessageEvent
+ public static function getMailerEvent(int $index = 0, ?string $transport = null): ?MessageEvent
{
return self::getMailerEvents($transport)[$index] ?? null;
}
@@ -116,12 +116,12 @@ public static function getMailerEvent(int $index = 0, string $transport = null):
/**
* @return RawMessage[]
*/
- public static function getMailerMessages(string $transport = null): array
+ public static function getMailerMessages(?string $transport = null): array
{
return self::getMessageMailerEvents()->getMessages($transport);
}
- public static function getMailerMessage(int $index = 0, string $transport = null): ?RawMessage
+ public static function getMailerMessage(int $index = 0, ?string $transport = null): ?RawMessage
{
return self::getMailerMessages($transport)[$index] ?? null;
}
diff --git a/Test/NotificationAssertionsTrait.php b/Test/NotificationAssertionsTrait.php
index 53d24cb12..b68473561 100644
--- a/Test/NotificationAssertionsTrait.php
+++ b/Test/NotificationAssertionsTrait.php
@@ -22,12 +22,12 @@
*/
trait NotificationAssertionsTrait
{
- public static function assertNotificationCount(int $count, string $transportName = null, string $message = ''): void
+ public static function assertNotificationCount(int $count, ?string $transportName = null, string $message = ''): void
{
self::assertThat(self::getNotificationEvents(), new NotifierConstraint\NotificationCount($count, $transportName), $message);
}
- public static function assertQueuedNotificationCount(int $count, string $transportName = null, string $message = ''): void
+ public static function assertQueuedNotificationCount(int $count, ?string $transportName = null, string $message = ''): void
{
self::assertThat(self::getNotificationEvents(), new NotifierConstraint\NotificationCount($count, $transportName, true), $message);
}
@@ -52,12 +52,12 @@ public static function assertNotificationSubjectNotContains(MessageInterface $no
self::assertThat($notification, new LogicalNot(new NotifierConstraint\NotificationSubjectContains($text)), $message);
}
- public static function assertNotificationTransportIsEqual(MessageInterface $notification, string $transportName = null, string $message = ''): void
+ public static function assertNotificationTransportIsEqual(MessageInterface $notification, ?string $transportName = null, string $message = ''): void
{
self::assertThat($notification, new NotifierConstraint\NotificationTransportIsEqual($transportName), $message);
}
- public static function assertNotificationTransportIsNotEqual(MessageInterface $notification, string $transportName = null, string $message = ''): void
+ public static function assertNotificationTransportIsNotEqual(MessageInterface $notification, ?string $transportName = null, string $message = ''): void
{
self::assertThat($notification, new LogicalNot(new NotifierConstraint\NotificationTransportIsEqual($transportName)), $message);
}
@@ -65,12 +65,12 @@ public static function assertNotificationTransportIsNotEqual(MessageInterface $n
/**
* @return MessageEvent[]
*/
- public static function getNotifierEvents(string $transportName = null): array
+ public static function getNotifierEvents(?string $transportName = null): array
{
return self::getNotificationEvents()->getEvents($transportName);
}
- public static function getNotifierEvent(int $index = 0, string $transportName = null): ?MessageEvent
+ public static function getNotifierEvent(int $index = 0, ?string $transportName = null): ?MessageEvent
{
return self::getNotifierEvents($transportName)[$index] ?? null;
}
@@ -78,12 +78,12 @@ public static function getNotifierEvent(int $index = 0, string $transportName =
/**
* @return MessageInterface[]
*/
- public static function getNotifierMessages(string $transportName = null): array
+ public static function getNotifierMessages(?string $transportName = null): array
{
return self::getNotificationEvents()->getMessages($transportName);
}
- public static function getNotifierMessage(int $index = 0, string $transportName = null): ?MessageInterface
+ public static function getNotifierMessage(int $index = 0, ?string $transportName = null): ?MessageInterface
{
return self::getNotifierMessages($transportName)[$index] ?? null;
}
diff --git a/Test/TestBrowserToken.php b/Test/TestBrowserToken.php
index 8bf365eb0..25d71d084 100644
--- a/Test/TestBrowserToken.php
+++ b/Test/TestBrowserToken.php
@@ -23,7 +23,7 @@ class TestBrowserToken extends AbstractToken
{
private string $firewallName;
- public function __construct(array $roles = [], UserInterface $user = null, string $firewallName = 'main')
+ public function __construct(array $roles = [], ?UserInterface $user = null, string $firewallName = 'main')
{
parent::__construct($roles);
diff --git a/Tests/Command/CacheClearCommand/Fixture/TestAppKernel.php b/Tests/Command/CacheClearCommand/Fixture/TestAppKernel.php
index 7992c4f9d..58a40cd58 100644
--- a/Tests/Command/CacheClearCommand/Fixture/TestAppKernel.php
+++ b/Tests/Command/CacheClearCommand/Fixture/TestAppKernel.php
@@ -52,7 +52,7 @@ public function isOptional(): bool
return false;
}
- public function warmUp(string $cacheDir, string $buildDir = null): array
+ public function warmUp(string $cacheDir, ?string $buildDir = null): array
{
file_put_contents($cacheDir.'/dummy.txt', 'Hello');
diff --git a/Tests/Command/TranslationDebugCommandTest.php b/Tests/Command/TranslationDebugCommandTest.php
index 251d2fa6a..dcff845a3 100644
--- a/Tests/Command/TranslationDebugCommandTest.php
+++ b/Tests/Command/TranslationDebugCommandTest.php
@@ -160,12 +160,12 @@ protected function tearDown(): void
$this->fs->remove($this->translationDir);
}
- private function createCommandTester(array $extractedMessages = [], array $loadedMessages = [], KernelInterface $kernel = null, array $transPaths = [], array $codePaths = []): CommandTester
+ private function createCommandTester(array $extractedMessages = [], array $loadedMessages = [], ?KernelInterface $kernel = null, array $transPaths = [], array $codePaths = []): CommandTester
{
return new CommandTester($this->createCommand($extractedMessages, $loadedMessages, $kernel, $transPaths, $codePaths));
}
- private function createCommand(array $extractedMessages = [], array $loadedMessages = [], KernelInterface $kernel = null, array $transPaths = [], array $codePaths = [], ExtractorInterface $extractor = null, array $bundles = [], array $enabledLocales = []): TranslationDebugCommand
+ private function createCommand(array $extractedMessages = [], array $loadedMessages = [], ?KernelInterface $kernel = null, array $transPaths = [], array $codePaths = [], ?ExtractorInterface $extractor = null, array $bundles = [], array $enabledLocales = []): TranslationDebugCommand
{
$translator = $this->createMock(Translator::class);
$translator
diff --git a/Tests/Command/TranslationUpdateCommandCompletionTest.php b/Tests/Command/TranslationUpdateCommandCompletionTest.php
index ee80e1932..1b11a6111 100644
--- a/Tests/Command/TranslationUpdateCommandCompletionTest.php
+++ b/Tests/Command/TranslationUpdateCommandCompletionTest.php
@@ -67,7 +67,7 @@ protected function tearDown(): void
$this->fs->remove($this->translationDir);
}
- private function createCommandCompletionTester($extractedMessages = [], $loadedMessages = [], KernelInterface $kernel = null, array $transPaths = [], array $codePaths = []): CommandCompletionTester
+ private function createCommandCompletionTester($extractedMessages = [], $loadedMessages = [], ?KernelInterface $kernel = null, array $transPaths = [], array $codePaths = []): CommandCompletionTester
{
$translator = $this->createMock(Translator::class);
$translator
diff --git a/Tests/Command/TranslationUpdateCommandTest.php b/Tests/Command/TranslationUpdateCommandTest.php
index 789f68376..d9f142e8f 100644
--- a/Tests/Command/TranslationUpdateCommandTest.php
+++ b/Tests/Command/TranslationUpdateCommandTest.php
@@ -184,7 +184,7 @@ protected function tearDown(): void
$this->fs->remove($this->translationDir);
}
- private function createCommandTester($extractedMessages = [], $loadedMessages = [], KernelInterface $kernel = null, array $transPaths = [], array $codePaths = []): CommandTester
+ private function createCommandTester($extractedMessages = [], $loadedMessages = [], ?KernelInterface $kernel = null, array $transPaths = [], array $codePaths = []): CommandTester
{
$translator = $this->createMock(Translator::class);
$translator
diff --git a/Tests/Controller/ControllerResolverTest.php b/Tests/Controller/ControllerResolverTest.php
index 0c51924a4..3571ac13a 100644
--- a/Tests/Controller/ControllerResolverTest.php
+++ b/Tests/Controller/ControllerResolverTest.php
@@ -104,7 +104,7 @@ class_exists(AbstractControllerTest::class);
$this->assertSame($controllerContainer, $controller->getContainer());
}
- protected function createControllerResolver(LoggerInterface $logger = null, Psr11ContainerInterface $container = null)
+ protected function createControllerResolver(?LoggerInterface $logger = null, ?Psr11ContainerInterface $container = null)
{
if (!$container) {
$container = $this->createMockContainer();
diff --git a/Tests/DependencyInjection/Compiler/ProfilerPassTest.php b/Tests/DependencyInjection/Compiler/ProfilerPassTest.php
index 469825782..1b699d4d1 100644
--- a/Tests/DependencyInjection/Compiler/ProfilerPassTest.php
+++ b/Tests/DependencyInjection/Compiler/ProfilerPassTest.php
@@ -67,7 +67,7 @@ public function testValidCollector()
public static function provideValidCollectorWithTemplateUsingAutoconfigure(): \Generator
{
yield [new class() implements TemplateAwareDataCollectorInterface {
- public function collect(Request $request, Response $response, \Throwable $exception = null): void
+ public function collect(Request $request, Response $response, ?\Throwable $exception = null): void
{
}
@@ -87,7 +87,7 @@ public static function getTemplate(): string
}];
yield [new class() extends AbstractDataCollector {
- public function collect(Request $request, Response $response, \Throwable $exception = null): void
+ public function collect(Request $request, Response $response, ?\Throwable $exception = null): void
{
}
diff --git a/Tests/DependencyInjection/FrameworkExtensionTestCase.php b/Tests/DependencyInjection/FrameworkExtensionTestCase.php
index 4bd3c481f..bdda5134d 100644
--- a/Tests/DependencyInjection/FrameworkExtensionTestCase.php
+++ b/Tests/DependencyInjection/FrameworkExtensionTestCase.php
@@ -2316,7 +2316,7 @@ protected function createContainer(array $data = [])
], $data)));
}
- protected function createContainerFromFile(string $file, array $data = [], bool $resetCompilerPasses = true, bool $compile = true, FrameworkExtension $extension = null): ContainerBuilder
+ protected function createContainerFromFile(string $file, array $data = [], bool $resetCompilerPasses = true, bool $compile = true, ?FrameworkExtension $extension = null): ContainerBuilder
{
$cacheKey = md5(static::class.$file.serialize($data));
if ($compile && isset(self::$containerCache[$cacheKey])) {
diff --git a/Tests/Fixtures/Messenger/DummyTask.php b/Tests/Fixtures/Messenger/DummyTask.php
index 94773b4e1..06cadadef 100644
--- a/Tests/Fixtures/Messenger/DummyTask.php
+++ b/Tests/Fixtures/Messenger/DummyTask.php
@@ -9,6 +9,9 @@
#[AsCronTask(expression: '0 * * * *', timezone: 'Europe/Berlin', arguments: ['2'], schedule: 'dummy_task', method: 'method2')]
#[AsPeriodicTask(frequency: 5, arguments: [3], schedule: 'dummy_task')]
#[AsPeriodicTask(frequency: '1 day', from: '2023-10-25 09:59:00Z', jitter: 60, arguments: ['4'], schedule: 'dummy_task', method: 'method4')]
+#[AsPeriodicTask(frequency: '1 day', from: '2023-10-25 09:59:00Z', arguments: ['9'], schedule: 'dummy_task', method: 'method5')]
+#[AsPeriodicTask(frequency: '1 day', from: '2023-10-25 09:59:00Z', arguments: ['9b'], schedule: 'dummy_task', method: 'method5')]
+#[AsPeriodicTask(frequency: '1 day', from: '2023-10-25 09:59:00Z', arguments: ['named' => '9'], schedule: 'dummy_task', method: 'method5')]
class DummyTask
{
public static array $calls = [];
diff --git a/Tests/Functional/Bundle/TestBundle/Controller/AnnotatedController.php b/Tests/Functional/Bundle/TestBundle/Controller/AnnotatedController.php
index 1fdb31dcc..d4e3b0f62 100644
--- a/Tests/Functional/Bundle/TestBundle/Controller/AnnotatedController.php
+++ b/Tests/Functional/Bundle/TestBundle/Controller/AnnotatedController.php
@@ -18,7 +18,7 @@
class AnnotatedController
{
#[Route('/null_request', name: 'null_request')]
- public function requestDefaultNullAction(Request $request = null): Response
+ public function requestDefaultNullAction(?Request $request = null): Response
{
return new Response($request ? $request::class : null);
}
diff --git a/Tests/Functional/Bundle/TestBundle/DependencyInjection/Configuration.php b/Tests/Functional/Bundle/TestBundle/DependencyInjection/Configuration.php
index 20386304e..cf32c8880 100644
--- a/Tests/Functional/Bundle/TestBundle/DependencyInjection/Configuration.php
+++ b/Tests/Functional/Bundle/TestBundle/DependencyInjection/Configuration.php
@@ -19,7 +19,7 @@ class Configuration implements ConfigurationInterface
{
private ?CustomConfig $customConfig;
- public function __construct(CustomConfig $customConfig = null)
+ public function __construct(?CustomConfig $customConfig = null)
{
$this->customConfig = $customConfig;
}
diff --git a/Tests/Functional/CachePoolClearCommandTest.php b/Tests/Functional/CachePoolClearCommandTest.php
index ab740d804..dbd78645d 100644
--- a/Tests/Functional/CachePoolClearCommandTest.php
+++ b/Tests/Functional/CachePoolClearCommandTest.php
@@ -143,7 +143,7 @@ public function testExcludedPool()
$this->assertStringContainsString('[OK] Cache was successfully cleared.', $tester->getDisplay());
}
- private function createCommandTester(array $poolNames = null)
+ private function createCommandTester(?array $poolNames = null)
{
$application = new Application(static::$kernel);
$application->add(new CachePoolClearCommand(static::getContainer()->get('cache.global_clearer'), $poolNames));
diff --git a/Tests/Functional/SchedulerTest.php b/Tests/Functional/SchedulerTest.php
index 7b3cd197d..7f737a4c4 100644
--- a/Tests/Functional/SchedulerTest.php
+++ b/Tests/Functional/SchedulerTest.php
@@ -84,6 +84,7 @@ public function testAutoconfiguredScheduler()
$this->assertCount(779, $calls['__invoke']);
$this->assertSame([['2']], $calls['method2']);
$this->assertSame([['4']], $calls['method4']);
+ $this->assertSame([['9'], ['9b'], ['named' => '9']], $calls['method5']);
$this->assertSame([['5', 6], ['7', 8]], $calls['attributesOnMethod']);
}
diff --git a/Translation/Translator.php b/Translation/Translator.php
index 644b0caac..2f25aa74c 100644
--- a/Translation/Translator.php
+++ b/Translation/Translator.php
@@ -93,7 +93,7 @@ public function __construct(ContainerInterface $container, MessageFormatterInter
parent::__construct($defaultLocale, $formatter, $this->options['cache_dir'], $this->options['debug'], $this->options['cache_vary']);
}
- public function warmUp(string $cacheDir, string $buildDir = null): array
+ public function warmUp(string $cacheDir, ?string $buildDir = null): array
{
// skip warmUp when translator doesn't use cache
if (null === $this->options['cache_dir']) {
@@ -114,7 +114,7 @@ public function warmUp(string $cacheDir, string $buildDir = null): array
return [];
}
- public function addResource(string $format, mixed $resource, string $locale, string $domain = null): void
+ public function addResource(string $format, mixed $resource, string $locale, ?string $domain = null): void
{
if ($this->resourceFiles) {
$this->addResourceFiles();
diff --git a/composer.json b/composer.json
index 8e879fd21..522b2b66c 100644
--- a/composer.json
+++ b/composer.json
@@ -56,7 +56,7 @@
"symfony/notifier": "^6.4|^7.0",
"symfony/process": "^6.4|^7.0",
"symfony/rate-limiter": "^6.4|^7.0",
- "symfony/scheduler": "^6.4|^7.0",
+ "symfony/scheduler": "^6.4.3|^7.0.3",
"symfony/security-bundle": "^6.4|^7.0",
"symfony/semaphore": "^6.4|^7.0",
"symfony/serializer": "^6.4|^7.0",
@@ -91,7 +91,7 @@
"symfony/mime": "<6.4",
"symfony/property-info": "<6.4",
"symfony/property-access": "<6.4",
- "symfony/scheduler": "<6.4",
+ "symfony/scheduler": "<6.4.3|>=7.0.0,<7.0.3",
"symfony/serializer": "<6.4",
"symfony/security-csrf": "<6.4",
"symfony/security-core": "<6.4",