Skip to content

Commit

Permalink
Apply php-cs-fixer fix --rules nullable_type_declaration_for_default_…
Browse files Browse the repository at this point in the history
…null_value
  • Loading branch information
nicolas-grekas committed Jan 23, 2024
1 parent 8b5cd56 commit 9f39bd6
Show file tree
Hide file tree
Showing 44 changed files with 81 additions and 81 deletions.
2 changes: 1 addition & 1 deletion CacheWarmer/AnnotationsCacheWarmer.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class AnnotationsCacheWarmer extends AbstractPhpFileCacheWarmer
/**
* @param string $phpArrayFile The PHP file where annotations are cached
*/
public function __construct(Reader $annotationReader, string $phpArrayFile, string $excludeRegexp = null, bool $debug = false)
public function __construct(Reader $annotationReader, string $phpArrayFile, ?string $excludeRegexp = null, bool $debug = false)
{
parent::__construct($phpArrayFile);
$this->annotationReader = $annotationReader;
Expand Down
2 changes: 1 addition & 1 deletion CacheWarmer/ConfigBuilderCacheWarmer.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class ConfigBuilderCacheWarmer implements CacheWarmerInterface
private $kernel;
private $logger;

public function __construct(KernelInterface $kernel, LoggerInterface $logger = null)
public function __construct(KernelInterface $kernel, ?LoggerInterface $logger = null)
{
$this->kernel = $kernel;
$this->logger = $logger;
Expand Down
2 changes: 1 addition & 1 deletion Command/CacheClearCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class CacheClearCommand extends Command
private $cacheClearer;
private $filesystem;

public function __construct(CacheClearerInterface $cacheClearer, Filesystem $filesystem = null)
public function __construct(CacheClearerInterface $cacheClearer, ?Filesystem $filesystem = null)
{
parent::__construct();

Expand Down
2 changes: 1 addition & 1 deletion Command/CachePoolClearCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion Command/CachePoolDeleteCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,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();

Expand Down
2 changes: 1 addition & 1 deletion Command/DebugAutowiringCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class DebugAutowiringCommand extends ContainerDebugCommand
private $supportsHref;
private $fileLinkFormatter;

public function __construct(string $name = null, FileLinkFormatter $fileLinkFormatter = null)
public function __construct(?string $name = null, ?FileLinkFormatter $fileLinkFormatter = null)
{
$this->supportsHref = method_exists(OutputFormatterStyle::class, 'setHref');
$this->fileLinkFormatter = $fileLinkFormatter;
Expand Down
2 changes: 1 addition & 1 deletion Command/RouterDebugCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class RouterDebugCommand extends Command
private $router;
private $fileLinkFormatter;

public function __construct(RouterInterface $router, FileLinkFormatter $fileLinkFormatter = null)
public function __construct(RouterInterface $router, ?FileLinkFormatter $fileLinkFormatter = null)
{
parent::__construct();

Expand Down
2 changes: 1 addition & 1 deletion Command/SecretsDecryptToLocalCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ final class SecretsDecryptToLocalCommand extends Command
private $vault;
private $localVault;

public function __construct(AbstractVault $vault, AbstractVault $localVault = null)
public function __construct(AbstractVault $vault, ?AbstractVault $localVault = null)
{
$this->vault = $vault;
$this->localVault = $localVault;
Expand Down
2 changes: 1 addition & 1 deletion Command/SecretsEncryptFromLocalCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ final class SecretsEncryptFromLocalCommand extends Command
private $vault;
private $localVault;

public function __construct(AbstractVault $vault, AbstractVault $localVault = null)
public function __construct(AbstractVault $vault, ?AbstractVault $localVault = null)
{
$this->vault = $vault;
$this->localVault = $localVault;
Expand Down
2 changes: 1 addition & 1 deletion Command/SecretsGenerateKeysCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ final class SecretsGenerateKeysCommand extends Command
private $vault;
private $localVault;

public function __construct(AbstractVault $vault, AbstractVault $localVault = null)
public function __construct(AbstractVault $vault, ?AbstractVault $localVault = null)
{
$this->vault = $vault;
$this->localVault = $localVault;
Expand Down
2 changes: 1 addition & 1 deletion Command/SecretsListCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ final class SecretsListCommand extends Command
private $vault;
private $localVault;

public function __construct(AbstractVault $vault, AbstractVault $localVault = null)
public function __construct(AbstractVault $vault, ?AbstractVault $localVault = null)
{
$this->vault = $vault;
$this->localVault = $localVault;
Expand Down
2 changes: 1 addition & 1 deletion Command/SecretsRemoveCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ final class SecretsRemoveCommand extends Command
private $vault;
private $localVault;

public function __construct(AbstractVault $vault, AbstractVault $localVault = null)
public function __construct(AbstractVault $vault, ?AbstractVault $localVault = null)
{
$this->vault = $vault;
$this->localVault = $localVault;
Expand Down
2 changes: 1 addition & 1 deletion Command/SecretsSetCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ final class SecretsSetCommand extends Command
private $vault;
private $localVault;

public function __construct(AbstractVault $vault, AbstractVault $localVault = null)
public function __construct(AbstractVault $vault, ?AbstractVault $localVault = null)
{
$this->vault = $vault;
$this->localVault = $localVault;
Expand Down
2 changes: 1 addition & 1 deletion Command/TranslationDebugCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class TranslationDebugCommand extends Command
private $codePaths;
private $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();

Expand Down
2 changes: 1 addition & 1 deletion Command/TranslationUpdateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class TranslationUpdateCommand extends Command
private $codePaths;
private $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();

Expand Down
2 changes: 1 addition & 1 deletion Console/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public function get(string $name)
/**
* {@inheritdoc}
*/
public function all(string $namespace = null)
public function all(?string $namespace = null)
{
$this->registerCommands();

Expand Down
6 changes: 3 additions & 3 deletions Console/Descriptor/Descriptor.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ abstract protected function describeContainerTags(ContainerBuilder $builder, arr
*
* @param Definition|Alias|object $service
*/
abstract protected function describeContainerService(object $service, array $options = [], ContainerBuilder $builder = null);
abstract protected function describeContainerService(object $service, array $options = [], ?ContainerBuilder $builder = null);

/**
* Describes container services.
Expand All @@ -127,7 +127,7 @@ abstract protected function describeContainerDeprecations(ContainerBuilder $buil

abstract protected function describeContainerDefinition(Definition $definition, array $options = []);

abstract protected function describeContainerAlias(Alias $alias, array $options = [], ContainerBuilder $builder = null);
abstract protected function describeContainerAlias(Alias $alias, array $options = [], ?ContainerBuilder $builder = null);

abstract protected function describeContainerParameter($parameter, array $options = []);

Expand Down Expand Up @@ -304,7 +304,7 @@ protected function sortByPriority(array $tag): array
return $tag;
}

public static function getClassDescription(string $class, string &$resolvedClass = null): string
public static function getClassDescription(string $class, ?string &$resolvedClass = null): string
{
$resolvedClass = $class;
try {
Expand Down
4 changes: 2 additions & 2 deletions Console/Descriptor/JsonDescriptor.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ protected function describeContainerTags(ContainerBuilder $builder, array $optio
$this->writeData($data, $options);
}

protected function describeContainerService(object $service, array $options = [], ContainerBuilder $builder = null)
protected function describeContainerService(object $service, array $options = [], ?ContainerBuilder $builder = null)
{
if (!isset($options['id'])) {
throw new \InvalidArgumentException('An "id" option must be provided.');
Expand Down Expand Up @@ -120,7 +120,7 @@ protected function describeContainerDefinition(Definition $definition, array $op
$this->writeData($this->getContainerDefinitionData($definition, isset($options['omit_tags']) && $options['omit_tags'], isset($options['show_arguments']) && $options['show_arguments']), $options);
}

protected function describeContainerAlias(Alias $alias, array $options = [], ContainerBuilder $builder = null)
protected function describeContainerAlias(Alias $alias, array $options = [], ?ContainerBuilder $builder = null)
{
if (!$builder) {
$this->writeData($this->getContainerAliasData($alias), $options);
Expand Down
4 changes: 2 additions & 2 deletions Console/Descriptor/MarkdownDescriptor.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ protected function describeContainerTags(ContainerBuilder $builder, array $optio
}
}

protected function describeContainerService(object $service, array $options = [], ContainerBuilder $builder = null)
protected function describeContainerService(object $service, array $options = [], ?ContainerBuilder $builder = null)
{
if (!isset($options['id'])) {
throw new \InvalidArgumentException('An "id" option must be provided.');
Expand Down Expand Up @@ -253,7 +253,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 $builder = null)
protected function describeContainerAlias(Alias $alias, array $options = [], ?ContainerBuilder $builder = null)
{
$output = '- Service: `'.$alias.'`'
."\n".'- Public: '.($alias->isPublic() && !$alias->isPrivate() ? 'yes' : 'no');
Expand Down
8 changes: 4 additions & 4 deletions Console/Descriptor/TextDescriptor.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class TextDescriptor extends Descriptor
{
private $fileLinkFormatter;

public function __construct(FileLinkFormatter $fileLinkFormatter = null)
public function __construct(?FileLinkFormatter $fileLinkFormatter = null)
{
$this->fileLinkFormatter = $fileLinkFormatter;
}
Expand Down Expand Up @@ -141,7 +141,7 @@ protected function describeContainerTags(ContainerBuilder $builder, array $optio
}
}

protected function describeContainerService(object $service, array $options = [], ContainerBuilder $builder = null)
protected function describeContainerService(object $service, array $options = [], ?ContainerBuilder $builder = null)
{
if (!isset($options['id'])) {
throw new \InvalidArgumentException('An "id" option must be provided.');
Expand Down Expand Up @@ -389,7 +389,7 @@ protected function describeContainerDeprecations(ContainerBuilder $builder, arra
$options['output']->listing($formattedLogs);
}

protected function describeContainerAlias(Alias $alias, array $options = [], ContainerBuilder $builder = null)
protected function describeContainerAlias(Alias $alias, array $options = [], ?ContainerBuilder $builder = null)
{
if ($alias->isPublic() && !$alias->isPrivate()) {
$options['output']->comment(sprintf('This service is a <info>public</info> alias for the service <info>%s</info>', (string) $alias));
Expand Down Expand Up @@ -541,7 +541,7 @@ private function formatRouterConfig(array $config): string
return trim($configAsString);
}

private function formatControllerLink($controller, string $anchorText, callable $getContainer = null): string
private function formatControllerLink($controller, string $anchorText, ?callable $getContainer = null): string
{
if (null === $this->fileLinkFormatter) {
return $anchorText;
Expand Down
14 changes: 7 additions & 7 deletions Console/Descriptor/XmlDescriptor.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ protected function describeContainerTags(ContainerBuilder $builder, array $optio
$this->writeDocument($this->getContainerTagsDocument($builder, isset($options['show_hidden']) && $options['show_hidden']));
}

protected function describeContainerService(object $service, array $options = [], ContainerBuilder $builder = null)
protected function describeContainerService(object $service, array $options = [], ?ContainerBuilder $builder = null)
{
if (!isset($options['id'])) {
throw new \InvalidArgumentException('An "id" option must be provided.');
Expand All @@ -72,7 +72,7 @@ protected function describeContainerDefinition(Definition $definition, array $op
$this->writeDocument($this->getContainerDefinitionDocument($definition, $options['id'] ?? null, isset($options['omit_tags']) && $options['omit_tags'], isset($options['show_arguments']) && $options['show_arguments']));
}

protected function describeContainerAlias(Alias $alias, array $options = [], ContainerBuilder $builder = null)
protected function describeContainerAlias(Alias $alias, array $options = [], ?ContainerBuilder $builder = null)
{
$dom = new \DOMDocument('1.0', 'UTF-8');
$dom->appendChild($dom->importNode($this->getContainerAliasDocument($alias, $options['id'] ?? null)->childNodes->item(0), true));
Expand Down Expand Up @@ -155,7 +155,7 @@ private function getRouteCollectionDocument(RouteCollection $routes): \DOMDocume
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'));
Expand Down Expand Up @@ -255,7 +255,7 @@ private function getContainerTagsDocument(ContainerBuilder $builder, bool $showH
return $dom;
}

private function getContainerServiceDocument(object $service, string $id, ContainerBuilder $builder = null, bool $showArguments = false): \DOMDocument
private function getContainerServiceDocument(object $service, string $id, ?ContainerBuilder $builder = null, bool $showArguments = false): \DOMDocument
{
$dom = new \DOMDocument('1.0', 'UTF-8');

Expand All @@ -275,7 +275,7 @@ private function getContainerServiceDocument(object $service, string $id, Contai
return $dom;
}

private function getContainerServicesDocument(ContainerBuilder $builder, string $tag = null, bool $showHidden = false, bool $showArguments = false, callable $filter = null): \DOMDocument
private function getContainerServicesDocument(ContainerBuilder $builder, ?string $tag = null, bool $showHidden = false, bool $showArguments = false, ?callable $filter = null): \DOMDocument
{
$dom = new \DOMDocument('1.0', 'UTF-8');
$dom->appendChild($containerXML = $dom->createElement('container'));
Expand All @@ -301,7 +301,7 @@ private function getContainerServicesDocument(ContainerBuilder $builder, string
return $dom;
}

private function getContainerDefinitionDocument(Definition $definition, string $id = null, bool $omitTags = false, bool $showArguments = false): \DOMDocument
private function getContainerDefinitionDocument(Definition $definition, ?string $id = null, bool $omitTags = false, bool $showArguments = false): \DOMDocument
{
$dom = new \DOMDocument('1.0', 'UTF-8');
$dom->appendChild($serviceXML = $dom->createElement('definition'));
Expand Down Expand Up @@ -432,7 +432,7 @@ private function getArgumentNodes(array $arguments, \DOMDocument $dom): array
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'));
Expand Down
2 changes: 1 addition & 1 deletion Console/Helper/DescriptorHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
12 changes: 6 additions & 6 deletions Controller/AbstractController.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ protected function json($data, int $status = 200, array $headers = [], array $co
*
* @param \SplFileInfo|string $file File object or path to file to be sent as response
*/
protected function file($file, string $fileName = null, string $disposition = ResponseHeaderBag::DISPOSITION_ATTACHMENT): BinaryFileResponse
protected function file($file, ?string $fileName = null, string $disposition = ResponseHeaderBag::DISPOSITION_ATTACHMENT): BinaryFileResponse
{
$response = new BinaryFileResponse($file);
$response->setContentDisposition($disposition, null === $fileName ? $response->getFile()->getFilename() : $fileName);
Expand Down Expand Up @@ -261,7 +261,7 @@ protected function renderView(string $view, array $parameters = []): string
/**
* Renders a view.
*/
protected function render(string $view, array $parameters = [], Response $response = null): Response
protected function render(string $view, array $parameters = [], ?Response $response = null): Response
{
$content = $this->renderView($view, $parameters);

Expand All @@ -279,7 +279,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.
*/
protected function renderForm(string $view, array $parameters = [], Response $response = null): Response
protected function renderForm(string $view, array $parameters = [], ?Response $response = null): Response
{
if (null === $response) {
$response = new Response();
Expand Down Expand Up @@ -307,7 +307,7 @@ protected function renderForm(string $view, array $parameters = [], Response $re
/**
* 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".');
Expand Down Expand Up @@ -335,7 +335,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);
}
Expand All @@ -349,7 +349,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".');
Expand Down
Loading

0 comments on commit 9f39bd6

Please sign in to comment.