Skip to content

Commit

Permalink
Merge branch '5.4' into 6.3
Browse files Browse the repository at this point in the history
* 5.4:
  Fix implicitly-required parameters
  List CS fix in .git-blame-ignore-revs
  Apply php-cs-fixer fix --rules nullable_type_declaration_for_default_null_value
  [Messenger][AmazonSqs] Allow async-aws/sqs version 2
  • Loading branch information
nicolas-grekas committed Jan 23, 2024
2 parents b7a6388 + 6b76343 commit 66b5482
Show file tree
Hide file tree
Showing 39 changed files with 58 additions and 58 deletions.
2 changes: 1 addition & 1 deletion Builder/ClassBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public function addMethod(string $name, string $body, array $params = []): void
$this->methods[] = new Method(strtr($body, ['NAME' => $this->camelCase($name)] + $params));
}

public function addProperty(string $name, string $classType = null, string $defaultValue = null): Property
public function addProperty(string $name, ?string $classType = null, ?string $defaultValue = null): Property
{
$property = new Property($name, '_' !== $name[0] ? $this->camelCase($name) : $name);
if (null !== $classType) {
Expand Down
2 changes: 1 addition & 1 deletion ConfigCacheInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ public function isFresh(): bool;
*
* @throws \RuntimeException When the cache file cannot be written
*/
public function write(string $content, array $metadata = null);
public function write(string $content, ?array $metadata = null);
}
2 changes: 1 addition & 1 deletion Definition/BaseNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ abstract class BaseNode implements NodeInterface
/**
* @throws \InvalidArgumentException if the name contains a period
*/
public function __construct(?string $name, NodeInterface $parent = null, string $pathSeparator = self::DEFAULT_PATH_SEPARATOR)
public function __construct(?string $name, ?NodeInterface $parent = null, string $pathSeparator = self::DEFAULT_PATH_SEPARATOR)
{
if (str_contains($name = (string) $name, $pathSeparator)) {
throw new \InvalidArgumentException('The name must not contain ".'.$pathSeparator.'".');
Expand Down
6 changes: 3 additions & 3 deletions Definition/Builder/ArrayNodeDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinition
protected $nodeBuilder;
protected $normalizeKeys = true;

public function __construct(?string $name, NodeParentInterface $parent = null)
public function __construct(?string $name, ?NodeParentInterface $parent = null)
{
parent::__construct($name, $parent);

Expand Down Expand Up @@ -126,7 +126,7 @@ public function addDefaultsIfNotSet(): static
*
* @return $this
*/
public function addDefaultChildrenIfNoneSet(int|string|array $children = null): static
public function addDefaultChildrenIfNoneSet(int|string|array|null $children = null): static
{
$this->addDefaultChildren = $children;

Expand Down Expand Up @@ -169,7 +169,7 @@ public function disallowNewKeysInSubsequentConfigs(): static
*
* @return $this
*/
public function fixXmlConfig(string $singular, string $plural = null): static
public function fixXmlConfig(string $singular, ?string $plural = null): static
{
$this->normalization()->remap($singular, $plural);

Expand Down
2 changes: 1 addition & 1 deletion Definition/Builder/BooleanNodeDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/
class BooleanNodeDefinition extends ScalarNodeDefinition
{
public function __construct(?string $name, NodeParentInterface $parent = null)
public function __construct(?string $name, ?NodeParentInterface $parent = null)
{
parent::__construct($name, $parent);

Expand Down
4 changes: 2 additions & 2 deletions Definition/Builder/ExprBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function __construct(NodeDefinition $node)
*
* @return $this
*/
public function always(\Closure $then = null): static
public function always(?\Closure $then = null): static
{
$this->ifPart = static fn () => true;
$this->allowedTypes = self::TYPE_ANY;
Expand All @@ -61,7 +61,7 @@ public function always(\Closure $then = null): static
*
* @return $this
*/
public function ifTrue(\Closure $closure = null): static
public function ifTrue(?\Closure $closure = null): static
{
$this->ifPart = $closure ?? static fn ($v) => true === $v;
$this->allowedTypes = self::TYPE_ANY;
Expand Down
2 changes: 1 addition & 1 deletion Definition/Builder/NodeBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function __construct()
*
* @return $this
*/
public function setParent(ParentNodeDefinitionInterface $parent = null): static
public function setParent(?ParentNodeDefinitionInterface $parent = null): static
{
if (1 > \func_num_args()) {
trigger_deprecation('symfony/form', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__);
Expand Down
2 changes: 1 addition & 1 deletion Definition/Builder/NodeDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ abstract class NodeDefinition implements NodeParentInterface
protected $parent;
protected $attributes = [];

public function __construct(?string $name, NodeParentInterface $parent = null)
public function __construct(?string $name, ?NodeParentInterface $parent = null)
{
$this->parent = $parent;
$this->name = $name;
Expand Down
4 changes: 2 additions & 2 deletions Definition/Builder/NormalizationBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function __construct(NodeDefinition $node)
*
* @return $this
*/
public function remap(string $key, string $plural = null): static
public function remap(string $key, ?string $plural = null): static
{
$this->remappings[] = [$key, null === $plural ? $key.'s' : $plural];

Expand All @@ -48,7 +48,7 @@ public function remap(string $key, string $plural = null): static
*
* @return ExprBuilder|$this
*/
public function before(\Closure $closure = null): ExprBuilder|static
public function before(?\Closure $closure = null): ExprBuilder|static
{
if (null !== $closure) {
$this->before[] = $closure;
Expand Down
2 changes: 1 addition & 1 deletion Definition/Builder/TreeBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class TreeBuilder implements NodeParentInterface
protected $tree;
protected $root;

public function __construct(string $name, string $type = 'array', NodeBuilder $builder = null)
public function __construct(string $name, string $type = 'array', ?NodeBuilder $builder = null)
{
$builder ??= new NodeBuilder();
$this->root = $builder->node($name, $type)->setParent($this);
Expand Down
2 changes: 1 addition & 1 deletion Definition/Builder/ValidationBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function __construct(NodeDefinition $node)
*
* @return ExprBuilder|$this
*/
public function rule(\Closure $closure = null): ExprBuilder|static
public function rule(?\Closure $closure = null): ExprBuilder|static
{
if (null !== $closure) {
$this->rules[] = $closure;
Expand Down
2 changes: 1 addition & 1 deletion Definition/Configurator/DefinitionConfigurator.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function __construct(
) {
}

public function import(string $resource, string $type = null, bool $ignoreErrors = false): void
public function import(string $resource, ?string $type = null, bool $ignoreErrors = false): void
{
$this->loader->setCurrentDir(\dirname($this->path));
$this->loader->import($resource, $type, $ignoreErrors, $this->file);
Expand Down
6 changes: 3 additions & 3 deletions Definition/Dumper/XmlReferenceDumper.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ class XmlReferenceDumper
/**
* @return string
*/
public function dump(ConfigurationInterface $configuration, string $namespace = null)
public function dump(ConfigurationInterface $configuration, ?string $namespace = null)
{
return $this->dumpNode($configuration->getConfigTreeBuilder()->buildTree(), $namespace);
}

/**
* @return string
*/
public function dumpNode(NodeInterface $node, string $namespace = null)
public function dumpNode(NodeInterface $node, ?string $namespace = null)
{
$this->reference = '';
$this->writeNode($node, 0, true, $namespace);
Expand All @@ -52,7 +52,7 @@ public function dumpNode(NodeInterface $node, string $namespace = null)
return $ref;
}

private function writeNode(NodeInterface $node, int $depth = 0, bool $root = false, string $namespace = null): void
private function writeNode(NodeInterface $node, int $depth = 0, bool $root = false, ?string $namespace = null): void
{
$rootName = ($root ? 'config' : $node->getName());
$rootNamespace = ($namespace ?: ($root ? 'http://example.org/schema/dic/'.$node->getName() : null));
Expand Down
2 changes: 1 addition & 1 deletion Definition/Dumper/YamlReferenceDumper.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function dumpNode(NodeInterface $node)
return $ref;
}

private function writeNode(NodeInterface $node, NodeInterface $parentNode = null, int $depth = 0, bool $prototypedArray = false): void
private function writeNode(NodeInterface $node, ?NodeInterface $parentNode = null, int $depth = 0, bool $prototypedArray = false): void
{
$comments = [];
$default = '';
Expand Down
2 changes: 1 addition & 1 deletion Definition/EnumNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class EnumNode extends ScalarNode
{
private array $values;

public function __construct(?string $name, NodeInterface $parent = null, array $values = [], string $pathSeparator = BaseNode::DEFAULT_PATH_SEPARATOR)
public function __construct(?string $name, ?NodeInterface $parent = null, array $values = [], string $pathSeparator = BaseNode::DEFAULT_PATH_SEPARATOR)
{
if (!$values) {
throw new \InvalidArgumentException('$values must contain at least one element.');
Expand Down
4 changes: 2 additions & 2 deletions Definition/Loader/DefinitionFileLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function __construct(
parent::__construct($locator);
}

public function load(mixed $resource, string $type = null): mixed
public function load(mixed $resource, ?string $type = null): mixed
{
// the loader variable is exposed to the included file below
$loader = $this;
Expand All @@ -57,7 +57,7 @@ public function load(mixed $resource, string $type = null): mixed
return null;
}

public function supports(mixed $resource, string $type = null): bool
public function supports(mixed $resource, ?string $type = null): bool
{
if (!\is_string($resource)) {
return false;
Expand Down
2 changes: 1 addition & 1 deletion Definition/NumericNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class NumericNode extends ScalarNode
protected $min;
protected $max;

public function __construct(?string $name, NodeInterface $parent = null, int|float $min = null, int|float $max = null, string $pathSeparator = BaseNode::DEFAULT_PATH_SEPARATOR)
public function __construct(?string $name, ?NodeInterface $parent = null, int|float|null $min = null, int|float|null $max = null, string $pathSeparator = BaseNode::DEFAULT_PATH_SEPARATOR)
{
parent::__construct($name, $parent, $pathSeparator);
$this->min = $min;
Expand Down
2 changes: 1 addition & 1 deletion Definition/Processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function processConfiguration(ConfigurationInterface $configuration, arra
* @param string $key The key to normalize
* @param string|null $plural The plural form of the key if it is irregular
*/
public static function normalizeConfig(array $config, string $key, string $plural = null): array
public static function normalizeConfig(array $config, string $key, ?string $plural = null): array
{
$plural ??= $key.'s';

Expand Down
2 changes: 1 addition & 1 deletion Exception/FileLoaderImportCircularReferenceException.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
class FileLoaderImportCircularReferenceException extends LoaderLoadException
{
public function __construct(array $resources, int $code = 0, \Throwable $previous = null)
public function __construct(array $resources, int $code = 0, ?\Throwable $previous = null)
{
$message = sprintf('Circular reference detected in "%s" ("%s" > "%s").', $this->varToString($resources[0]), implode('" > "', $resources), $resources[0]);

Expand Down
2 changes: 1 addition & 1 deletion Exception/FileLocatorFileNotFoundException.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class FileLocatorFileNotFoundException extends \InvalidArgumentException
{
private array $paths;

public function __construct(string $message = '', int $code = 0, \Throwable $previous = null, array $paths = [])
public function __construct(string $message = '', int $code = 0, ?\Throwable $previous = null, array $paths = [])
{
parent::__construct($message, $code, $previous);

Expand Down
2 changes: 1 addition & 1 deletion Exception/LoaderLoadException.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class LoaderLoadException extends \Exception
* @param \Throwable|null $previous A previous exception
* @param string|null $type The type of resource
*/
public function __construct(mixed $resource, string $sourceResource = null, int $code = 0, \Throwable $previous = null, string $type = null)
public function __construct(mixed $resource, ?string $sourceResource = null, int $code = 0, ?\Throwable $previous = null, ?string $type = null)
{
if (!\is_string($resource)) {
try {
Expand Down
2 changes: 1 addition & 1 deletion FileLocator.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function __construct(string|array $paths = [])
/**
* @return string|array
*/
public function locate(string $name, string $currentPath = null, bool $first = true)
public function locate(string $name, ?string $currentPath = null, bool $first = true)
{
if ('' === $name) {
throw new \InvalidArgumentException('An empty file name is not valid to be located.');
Expand Down
2 changes: 1 addition & 1 deletion FileLocatorInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ interface FileLocatorInterface
* @throws \InvalidArgumentException If $name is empty
* @throws FileLocatorFileNotFoundException If a file is not found
*/
public function locate(string $name, string $currentPath = null, bool $first = true);
public function locate(string $name, ?string $currentPath = null, bool $first = true);
}
4 changes: 2 additions & 2 deletions Loader/DelegatingLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function __construct(LoaderResolverInterface $resolver)
$this->resolver = $resolver;
}

public function load(mixed $resource, string $type = null): mixed
public function load(mixed $resource, ?string $type = null): mixed
{
if (false === $loader = $this->resolver->resolve($resource, $type)) {
throw new LoaderLoadException($resource, null, 0, null, $type);
Expand All @@ -37,7 +37,7 @@ public function load(mixed $resource, string $type = null): mixed
return $loader->load($resource, $type);
}

public function supports(mixed $resource, string $type = null): bool
public function supports(mixed $resource, ?string $type = null): bool
{
return false !== $this->resolver->resolve($resource, $type);
}
Expand Down
8 changes: 4 additions & 4 deletions Loader/FileLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ abstract class FileLoader extends Loader

private ?string $currentDir = null;

public function __construct(FileLocatorInterface $locator, string $env = null)
public function __construct(FileLocatorInterface $locator, ?string $env = null)
{
$this->locator = $locator;
parent::__construct($env);
Expand Down Expand Up @@ -70,7 +70,7 @@ public function getLocator(): FileLocatorInterface
* @throws FileLoaderImportCircularReferenceException
* @throws FileLocatorFileNotFoundException
*/
public function import(mixed $resource, string $type = null, bool $ignoreErrors = false, string $sourceResource = null, string|array $exclude = null)
public function import(mixed $resource, ?string $type = null, bool $ignoreErrors = false, ?string $sourceResource = null, string|array|null $exclude = null)
{
if (\is_string($resource) && \strlen($resource) !== ($i = strcspn($resource, '*?{[')) && !str_contains($resource, "\n")) {
$excluded = [];
Expand Down Expand Up @@ -101,7 +101,7 @@ public function import(mixed $resource, string $type = null, bool $ignoreErrors
/**
* @internal
*/
protected function glob(string $pattern, bool $recursive, array|GlobResource &$resource = null, bool $ignoreErrors = false, bool $forExclusion = false, array $excluded = []): iterable
protected function glob(string $pattern, bool $recursive, array|GlobResource|null &$resource = null, bool $ignoreErrors = false, bool $forExclusion = false, array $excluded = []): iterable
{
if (\strlen($pattern) === $i = strcspn($pattern, '*?{[')) {
$prefix = $pattern;
Expand Down Expand Up @@ -133,7 +133,7 @@ protected function glob(string $pattern, bool $recursive, array|GlobResource &$r
yield from $resource;
}

private function doImport(mixed $resource, string $type = null, bool $ignoreErrors = false, string $sourceResource = null): mixed
private function doImport(mixed $resource, ?string $type = null, bool $ignoreErrors = false, ?string $sourceResource = null): mixed
{
try {
$loader = $this->resolve($resource, $type);
Expand Down
4 changes: 2 additions & 2 deletions Loader/GlobFileLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
*/
class GlobFileLoader extends FileLoader
{
public function load(mixed $resource, string $type = null): mixed
public function load(mixed $resource, ?string $type = null): mixed
{
return $this->import($resource);
}

public function supports(mixed $resource, string $type = null): bool
public function supports(mixed $resource, ?string $type = null): bool
{
return 'glob' === $type;
}
Expand Down
6 changes: 3 additions & 3 deletions Loader/Loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ abstract class Loader implements LoaderInterface
protected $resolver;
protected $env;

public function __construct(string $env = null)
public function __construct(?string $env = null)
{
$this->env = $env;
}
Expand All @@ -46,7 +46,7 @@ public function setResolver(LoaderResolverInterface $resolver)
*
* @return mixed
*/
public function import(mixed $resource, string $type = null)
public function import(mixed $resource, ?string $type = null)
{
return $this->resolve($resource, $type)->load($resource, $type);
}
Expand All @@ -56,7 +56,7 @@ public function import(mixed $resource, string $type = null)
*
* @throws LoaderLoadException If no loader is found
*/
public function resolve(mixed $resource, string $type = null): LoaderInterface
public function resolve(mixed $resource, ?string $type = null): LoaderInterface
{
if ($this->supports($resource, $type)) {
return $this;
Expand Down
4 changes: 2 additions & 2 deletions Loader/LoaderInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ interface LoaderInterface
*
* @throws \Exception If something went wrong
*/
public function load(mixed $resource, string $type = null);
public function load(mixed $resource, ?string $type = null);

/**
* Returns whether this class supports the given resource.
Expand All @@ -34,7 +34,7 @@ public function load(mixed $resource, string $type = null);
*
* @return bool
*/
public function supports(mixed $resource, string $type = null);
public function supports(mixed $resource, ?string $type = null);

/**
* Gets the loader resolver.
Expand Down
2 changes: 1 addition & 1 deletion Loader/LoaderResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function __construct(array $loaders = [])
}
}

public function resolve(mixed $resource, string $type = null): LoaderInterface|false
public function resolve(mixed $resource, ?string $type = null): LoaderInterface|false
{
foreach ($this->loaders as $loader) {
if ($loader->supports($resource, $type)) {
Expand Down
2 changes: 1 addition & 1 deletion Loader/LoaderResolverInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ interface LoaderResolverInterface
*
* @param string|null $type The resource type or null if unknown
*/
public function resolve(mixed $resource, string $type = null): LoaderInterface|false;
public function resolve(mixed $resource, ?string $type = null): LoaderInterface|false;
}
Loading

0 comments on commit 66b5482

Please sign in to comment.