Skip to content

Commit f6557cc

Browse files
Apply php-cs-fixer fix --rules nullable_type_declaration_for_default_null_value
1 parent 585ad66 commit f6557cc

Some content is hidden

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

48 files changed

+87
-87
lines changed

Argument/BoundArgument.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ final class BoundArgument implements ArgumentInterface
2828
private $type;
2929
private $file;
3030

31-
public function __construct($value, bool $trackUsage = true, int $type = 0, string $file = null)
31+
public function __construct($value, bool $trackUsage = true, int $type = 0, ?string $file = null)
3232
{
3333
$this->value = $value;
3434
if ($trackUsage) {

Argument/ServiceLocator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class ServiceLocator extends BaseServiceLocator
2424
private $serviceMap;
2525
private $serviceTypes;
2626

27-
public function __construct(\Closure $factory, array $serviceMap, array $serviceTypes = null)
27+
public function __construct(\Closure $factory, array $serviceMap, ?array $serviceTypes = null)
2828
{
2929
$this->factory = $factory;
3030
$this->serviceMap = $serviceMap;

Argument/TaggedIteratorArgument.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class TaggedIteratorArgument extends IteratorArgument
3131
* @param bool $needsIndexes Whether indexes are required and should be generated when computing the map
3232
* @param string|null $defaultPriorityMethod The static method that should be called to get each service's priority when their tag doesn't define the "priority" attribute
3333
*/
34-
public function __construct(string $tag, string $indexAttribute = null, string $defaultIndexMethod = null, bool $needsIndexes = false, string $defaultPriorityMethod = null)
34+
public function __construct(string $tag, ?string $indexAttribute = null, ?string $defaultIndexMethod = null, bool $needsIndexes = false, ?string $defaultPriorityMethod = null)
3535
{
3636
parent::__construct([]);
3737

Attribute/AutoconfigureTag.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#[\Attribute(\Attribute::TARGET_CLASS | \Attribute::IS_REPEATABLE)]
2020
class AutoconfigureTag extends Autoconfigure
2121
{
22-
public function __construct(string $name = null, array $attributes = [])
22+
public function __construct(?string $name = null, array $attributes = [])
2323
{
2424
parent::__construct(
2525
tags: [

Compiler/AutowirePass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ private function populateAutowiringAlias(string $id): void
595595
}
596596
}
597597

598-
private function getCombinedAlias(string $type, string $name = null): ?string
598+
private function getCombinedAlias(string $type, ?string $name = null): ?string
599599
{
600600
if (str_contains($type, '&')) {
601601
$types = explode('&', $type);

Compiler/CheckTypeDeclarationsPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ private function checkTypeDeclarations(Definition $checkedDefinition, \Reflectio
164164
/**
165165
* @throws InvalidParameterTypeException When a parameter is not compatible with the declared type
166166
*/
167-
private function checkType(Definition $checkedDefinition, $value, \ReflectionParameter $parameter, ?string $envPlaceholderUniquePrefix, \ReflectionType $reflectionType = null): void
167+
private function checkType(Definition $checkedDefinition, $value, \ReflectionParameter $parameter, ?string $envPlaceholderUniquePrefix, ?\ReflectionType $reflectionType = null): void
168168
{
169169
$reflectionType = $reflectionType ?? $parameter->getType();
170170

Compiler/InlineServiceDefinitionsPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class InlineServiceDefinitionsPass extends AbstractRecursivePass
3232
private $notInlinableIds = [];
3333
private $graph;
3434

35-
public function __construct(AnalyzeServiceReferencesPass $analyzingPass = null)
35+
public function __construct(?AnalyzeServiceReferencesPass $analyzingPass = null)
3636
{
3737
$this->analyzingPass = $analyzingPass;
3838
}

Compiler/MergeExtensionConfigurationPass.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ class MergeExtensionConfigurationContainerBuilder extends ContainerBuilder
153153
{
154154
private $extensionClass;
155155

156-
public function __construct(ExtensionInterface $extension, ParameterBagInterface $parameterBag = null)
156+
public function __construct(ExtensionInterface $extension, ?ParameterBagInterface $parameterBag = null)
157157
{
158158
parent::__construct($parameterBag);
159159

@@ -187,7 +187,7 @@ public function compile(bool $resolveEnvPlaceholders = false)
187187
/**
188188
* {@inheritdoc}
189189
*/
190-
public function resolveEnvPlaceholders($value, $format = null, array &$usedEnvs = null)
190+
public function resolveEnvPlaceholders($value, $format = null, ?array &$usedEnvs = null)
191191
{
192192
if (true !== $format || !\is_string($value)) {
193193
return parent::resolveEnvPlaceholders($value, $format, $usedEnvs);

Compiler/ServiceLocatorTagPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ protected function processValue($value, bool $isRoot = false)
104104
/**
105105
* @param Reference[] $refMap
106106
*/
107-
public static function register(ContainerBuilder $container, array $refMap, string $callerId = null): Reference
107+
public static function register(ContainerBuilder $container, array $refMap, ?string $callerId = null): Reference
108108
{
109109
foreach ($refMap as $id => $ref) {
110110
if (!$ref instanceof Reference) {

Compiler/ServiceReferenceGraph.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function clear()
7474
/**
7575
* Connects 2 nodes together in the Graph.
7676
*/
77-
public function connect(?string $sourceId, $sourceValue, ?string $destId, $destValue = null, Reference $reference = null, bool $lazy = false, bool $weak = false, bool $byConstructor = false)
77+
public function connect(?string $sourceId, $sourceValue, ?string $destId, $destValue = null, ?Reference $reference = null, bool $lazy = false, bool $weak = false, bool $byConstructor = false)
7878
{
7979
if (null === $sourceId || null === $destId) {
8080
return;

Container.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class Container implements ContainerInterface, ResetInterface
6363
private $compiled = false;
6464
private $getEnv;
6565

66-
public function __construct(ParameterBagInterface $parameterBag = null)
66+
public function __construct(?ParameterBagInterface $parameterBag = null)
6767
{
6868
$this->parameterBag = $parameterBag ?? new EnvPlaceholderParameterBag();
6969
}

ContainerAwareInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ interface ContainerAwareInterface
2121
/**
2222
* Sets the container.
2323
*/
24-
public function setContainer(ContainerInterface $container = null);
24+
public function setContainer(?ContainerInterface $container = null);
2525
}

ContainerAwareTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ trait ContainerAwareTrait
2323
*/
2424
protected $container;
2525

26-
public function setContainer(ContainerInterface $container = null)
26+
public function setContainer(?ContainerInterface $container = null)
2727
{
2828
$this->container = $container;
2929
}

ContainerBuilder.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
163163
'mixed' => true,
164164
];
165165

166-
public function __construct(ParameterBagInterface $parameterBag = null)
166+
public function __construct(?ParameterBagInterface $parameterBag = null)
167167
{
168168
parent::__construct($parameterBag);
169169

@@ -440,7 +440,7 @@ public function fileExists(string $path, $trackContents = true): bool
440440
* @throws BadMethodCallException When this ContainerBuilder is compiled
441441
* @throws \LogicException if the extension is not registered
442442
*/
443-
public function loadFromExtension(string $extension, array $values = null)
443+
public function loadFromExtension(string $extension, ?array $values = null)
444444
{
445445
if ($this->isCompiled()) {
446446
throw new BadMethodCallException('Cannot load from an extension on a compiled container.');
@@ -553,7 +553,7 @@ public function get(string $id, int $invalidBehavior = ContainerInterface::EXCEP
553553
return $this->doGet($id, $invalidBehavior);
554554
}
555555

556-
private function doGet(string $id, int $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, array &$inlineServices = null, bool $isConstructorArgument = false)
556+
private function doGet(string $id, int $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, ?array &$inlineServices = null, bool $isConstructorArgument = false)
557557
{
558558
if (isset($inlineServices[$id])) {
559559
return $inlineServices[$id];
@@ -900,7 +900,7 @@ public function getAlias(string $id)
900900
*
901901
* @return Definition
902902
*/
903-
public function register(string $id, string $class = null)
903+
public function register(string $id, ?string $class = null)
904904
{
905905
return $this->setDefinition($id, new Definition($class));
906906
}
@@ -913,7 +913,7 @@ public function register(string $id, string $class = null)
913913
*
914914
* @return Definition
915915
*/
916-
public function autowire(string $id, string $class = null)
916+
public function autowire(string $id, ?string $class = null)
917917
{
918918
return $this->setDefinition($id, (new Definition($class))->setAutowired(true));
919919
}
@@ -1037,7 +1037,7 @@ public function findDefinition(string $id)
10371037
* @throws RuntimeException When the service is a synthetic service
10381038
* @throws InvalidArgumentException When configure callable is not callable
10391039
*/
1040-
private function createService(Definition $definition, array &$inlineServices, bool $isConstructorArgument = false, string $id = null, bool $tryProxy = true)
1040+
private function createService(Definition $definition, array &$inlineServices, bool $isConstructorArgument = false, ?string $id = null, bool $tryProxy = true)
10411041
{
10421042
if (null === $id && isset($inlineServices[$h = spl_object_hash($definition)])) {
10431043
return $inlineServices[$h];
@@ -1353,7 +1353,7 @@ public function registerAttributeForAutoconfiguration(string $attributeClass, ca
13531353
* "$fooBar"-named arguments with $type as type-hint. Such arguments will
13541354
* receive the service $id when autowiring is used.
13551355
*/
1356-
public function registerAliasForArgument(string $id, string $type, string $name = null): Alias
1356+
public function registerAliasForArgument(string $id, string $type, ?string $name = null): Alias
13571357
{
13581358
$name = (new Target($name ?? $id))->name;
13591359

@@ -1393,7 +1393,7 @@ public function getAutoconfiguredAttributes(): array
13931393
*
13941394
* @return mixed The value with env parameters resolved if a string or an array is passed
13951395
*/
1396-
public function resolveEnvPlaceholders($value, $format = null, array &$usedEnvs = null)
1396+
public function resolveEnvPlaceholders($value, $format = null, ?array &$usedEnvs = null)
13971397
{
13981398
if (null === $format) {
13991399
$format = '%%env(%s)%%';

Definition.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class Definition
6161
*/
6262
public $decorationOnInvalid;
6363

64-
public function __construct(string $class = null, array $arguments = [])
64+
public function __construct(?string $class = null, array $arguments = [])
6565
{
6666
if (null !== $class) {
6767
$this->setClass($class);
@@ -135,7 +135,7 @@ public function getFactory()
135135
*
136136
* @throws InvalidArgumentException in case the decorated service id and the new decorated service id are equals
137137
*/
138-
public function setDecoratedService(?string $id, string $renamedId = null, int $priority = 0, int $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE)
138+
public function setDecoratedService(?string $id, ?string $renamedId = null, int $priority = 0, int $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE)
139139
{
140140
if ($renamedId && $id === $renamedId) {
141141
throw new InvalidArgumentException(sprintf('The decorated service inner name for "%s" must be different than the service name itself.', $id));

Dumper/PhpDumper.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,7 +1031,7 @@ private function addInlineReference(string $id, Definition $definition, string $
10311031
return $code;
10321032
}
10331033

1034-
private function addInlineService(string $id, Definition $definition, Definition $inlineDef = null, bool $forConstructor = true): string
1034+
private function addInlineService(string $id, Definition $definition, ?Definition $inlineDef = null, bool $forConstructor = true): string
10351035
{
10361036
$code = '';
10371037

@@ -1088,7 +1088,7 @@ private function addInlineService(string $id, Definition $definition, Definition
10881088
return $code;
10891089
}
10901090

1091-
private function addServices(array &$services = null): string
1091+
private function addServices(?array &$services = null): string
10921092
{
10931093
$publicServices = $privateServices = '';
10941094
$definitions = $this->container->getDefinitions();
@@ -1130,7 +1130,7 @@ private function generateServiceFiles(array $services): iterable
11301130
}
11311131
}
11321132

1133-
private function addNewInstance(Definition $definition, string $return = '', string $id = null): string
1133+
private function addNewInstance(Definition $definition, string $return = '', ?string $id = null): string
11341134
{
11351135
$tail = $return ? ";\n" : '';
11361136

@@ -1704,7 +1704,7 @@ private function getServiceConditionals($value): string
17041704
return implode(' && ', $conditions);
17051705
}
17061706

1707-
private function getDefinitionsFromArguments(array $arguments, \SplObjectStorage $definitions = null, array &$calls = [], bool $byConstructor = null): \SplObjectStorage
1707+
private function getDefinitionsFromArguments(array $arguments, ?\SplObjectStorage $definitions = null, array &$calls = [], ?bool $byConstructor = null): \SplObjectStorage
17081708
{
17091709
if (null === $definitions) {
17101710
$definitions = new \SplObjectStorage();
@@ -1935,7 +1935,7 @@ private function dumpParameter(string $name): string
19351935
return sprintf('$this->parameters[%s]', $this->doExport($name));
19361936
}
19371937

1938-
private function getServiceCall(string $id, Reference $reference = null): string
1938+
private function getServiceCall(string $id, ?Reference $reference = null): string
19391939
{
19401940
while ($this->container->hasAlias($id)) {
19411941
$id = (string) $this->container->getAlias($id);

Dumper/YamlDumper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ private function dumpValue($value)
317317
return $value;
318318
}
319319

320-
private function getServiceCall(string $id, Reference $reference = null): string
320+
private function getServiceCall(string $id, ?Reference $reference = null): string
321321
{
322322
if (null !== $reference) {
323323
switch ($reference->getInvalidBehavior()) {

EnvVarProcessor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class EnvVarProcessor implements EnvVarProcessorInterface
2727
/**
2828
* @param EnvVarLoaderInterface[] $loaders
2929
*/
30-
public function __construct(ContainerInterface $container, \Traversable $loaders = null)
30+
public function __construct(ContainerInterface $container, ?\Traversable $loaders = null)
3131
{
3232
$this->container = $container;
3333
$this->loaders = $loaders ?? new \ArrayIterator();

Exception/AutowiringFailedException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class AutowiringFailedException extends RuntimeException
1919
private $serviceId;
2020
private $messageCallback;
2121

22-
public function __construct(string $serviceId, $message = '', int $code = 0, \Throwable $previous = null)
22+
public function __construct(string $serviceId, $message = '', int $code = 0, ?\Throwable $previous = null)
2323
{
2424
$this->serviceId = $serviceId;
2525

Exception/EnvParameterException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919
class EnvParameterException extends InvalidArgumentException
2020
{
21-
public function __construct(array $envs, \Throwable $previous = null, string $message = 'Incompatible use of dynamic environment variables "%s" found in parameters.')
21+
public function __construct(array $envs, ?\Throwable $previous = null, string $message = 'Incompatible use of dynamic environment variables "%s" found in parameters.')
2222
{
2323
parent::__construct(sprintf($message, implode('", "', $envs)), 0, $previous);
2424
}

Exception/ParameterCircularReferenceException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class ParameterCircularReferenceException extends RuntimeException
2020
{
2121
private $parameters;
2222

23-
public function __construct(array $parameters, \Throwable $previous = null)
23+
public function __construct(array $parameters, ?\Throwable $previous = null)
2424
{
2525
parent::__construct(sprintf('Circular reference detected for parameter "%s" ("%s" > "%s").', $parameters[0], implode('" > "', $parameters), $parameters[0]), 0, $previous);
2626

Exception/ParameterNotFoundException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class ParameterNotFoundException extends InvalidArgumentException implements Not
3434
* @param string[] $alternatives Some parameter name alternatives
3535
* @param string|null $nonNestedAlternative The alternative parameter name when the user expected dot notation for nested parameters
3636
*/
37-
public function __construct(string $key, string $sourceId = null, string $sourceKey = null, \Throwable $previous = null, array $alternatives = [], string $nonNestedAlternative = null)
37+
public function __construct(string $key, ?string $sourceId = null, ?string $sourceKey = null, ?\Throwable $previous = null, array $alternatives = [], ?string $nonNestedAlternative = null)
3838
{
3939
$this->key = $key;
4040
$this->sourceId = $sourceId;

Exception/ServiceCircularReferenceException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class ServiceCircularReferenceException extends RuntimeException
2121
private $serviceId;
2222
private $path;
2323

24-
public function __construct(string $serviceId, array $path, \Throwable $previous = null)
24+
public function __construct(string $serviceId, array $path, ?\Throwable $previous = null)
2525
{
2626
parent::__construct(sprintf('Circular reference detected for service "%s", path: "%s".', $serviceId, implode(' -> ', $path)), 0, $previous);
2727

Exception/ServiceNotFoundException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class ServiceNotFoundException extends InvalidArgumentException implements NotFo
2424
private $sourceId;
2525
private $alternatives;
2626

27-
public function __construct(string $id, string $sourceId = null, \Throwable $previous = null, array $alternatives = [], string $msg = null)
27+
public function __construct(string $id, ?string $sourceId = null, ?\Throwable $previous = null, array $alternatives = [], ?string $msg = null)
2828
{
2929
if (null !== $msg) {
3030
// no-op

ExpressionLanguage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class ExpressionLanguage extends BaseExpressionLanguage
3030
/**
3131
* {@inheritdoc}
3232
*/
33-
public function __construct(CacheItemPoolInterface $cache = null, array $providers = [], callable $serviceCompiler = null)
33+
public function __construct(?CacheItemPoolInterface $cache = null, array $providers = [], ?callable $serviceCompiler = null)
3434
{
3535
// prepend the default provider to let users override it easily
3636
array_unshift($providers, new ExpressionLanguageProvider($serviceCompiler));

ExpressionLanguageProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class ExpressionLanguageProvider implements ExpressionFunctionProviderInterface
2626
{
2727
private $serviceCompiler;
2828

29-
public function __construct(callable $serviceCompiler = null)
29+
public function __construct(?callable $serviceCompiler = null)
3030
{
3131
$this->serviceCompiler = $serviceCompiler;
3232
}

LazyProxy/ProxyHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class ProxyHelper
2121
/**
2222
* @return string|null The FQCN or builtin name of the type hint, or null when the type hint references an invalid self|parent context
2323
*/
24-
public static function getTypeHint(\ReflectionFunctionAbstract $r, \ReflectionParameter $p = null, bool $noBuiltin = false): ?string
24+
public static function getTypeHint(\ReflectionFunctionAbstract $r, ?\ReflectionParameter $p = null, bool $noBuiltin = false): ?string
2525
{
2626
if ($p instanceof \ReflectionParameter) {
2727
$type = $p->getType();

Loader/ClosureLoader.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class ClosureLoader extends Loader
2525
{
2626
private $container;
2727

28-
public function __construct(ContainerBuilder $container, string $env = null)
28+
public function __construct(ContainerBuilder $container, ?string $env = null)
2929
{
3030
$this->container = $container;
3131
parent::__construct($env);
@@ -34,15 +34,15 @@ public function __construct(ContainerBuilder $container, string $env = null)
3434
/**
3535
* {@inheritdoc}
3636
*/
37-
public function load($resource, string $type = null)
37+
public function load($resource, ?string $type = null)
3838
{
3939
return $resource($this->container, $this->env);
4040
}
4141

4242
/**
4343
* {@inheritdoc}
4444
*/
45-
public function supports($resource, string $type = null)
45+
public function supports($resource, ?string $type = null)
4646
{
4747
return $resource instanceof \Closure;
4848
}

0 commit comments

Comments
 (0)