Skip to content

Commit f4118e1

Browse files
Apply php-cs-fixer fix --rules nullable_type_declaration_for_default_null_value
1 parent 09cc9c7 commit f4118e1

File tree

1,243 files changed

+1988
-1987
lines changed

Some content is hidden

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

1,243 files changed

+1988
-1987
lines changed

.php-cs-fixer.dist.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
'@Symfony:risky' => true,
3131
'protected_to_private' => false,
3232
'native_constant_invocation' => ['strict' => false],
33+
'nullable_type_declaration_for_default_null_value' => true,
3334
'header_comment' => ['header' => $fileHeaderComment],
3435
])
3536
->setRiskyAllowed(true)

src/Symfony/Bridge/Doctrine/ContainerAwareEventManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function __construct(ContainerInterface $container, array $subscriberIds
5050
*
5151
* @return void
5252
*/
53-
public function dispatchEvent($eventName, EventArgs $eventArgs = null)
53+
public function dispatchEvent($eventName, ?EventArgs $eventArgs = null)
5454
{
5555
if (!$this->initializedSubscribers) {
5656
$this->initializeSubscribers();

src/Symfony/Bridge/Doctrine/DataCollector/DoctrineDataCollector.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class DoctrineDataCollector extends DataCollector
3939
*/
4040
private $loggers = [];
4141

42-
public function __construct(ManagerRegistry $registry, DebugDataHolder $debugDataHolder = null)
42+
public function __construct(ManagerRegistry $registry, ?DebugDataHolder $debugDataHolder = null)
4343
{
4444
$this->registry = $registry;
4545
$this->connections = $registry->getConnectionNames();
@@ -58,7 +58,7 @@ public function addLogger(string $name, DebugStack $logger)
5858
/**
5959
* {@inheritdoc}
6060
*/
61-
public function collect(Request $request, Response $response, \Throwable $exception = null)
61+
public function collect(Request $request, Response $response, ?\Throwable $exception = null)
6262
{
6363
$this->data = [
6464
'queries' => $this->collectQueries(),

src/Symfony/Bridge/Doctrine/Form/ChoiceList/DoctrineChoiceLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class DoctrineChoiceLoader extends AbstractChoiceLoader
3535
*
3636
* @param string $class The class name of the loaded objects
3737
*/
38-
public function __construct(ObjectManager $manager, string $class, IdReader $idReader = null, EntityLoaderInterface $objectLoader = null)
38+
public function __construct(ObjectManager $manager, string $class, ?IdReader $idReader = null, ?EntityLoaderInterface $objectLoader = null)
3939
{
4040
$classMetadata = $manager->getClassMetadata($class);
4141

src/Symfony/Bridge/Doctrine/Form/ChoiceList/IdReader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public function isIntId(): bool
7878
*
7979
* This method assumes that the object has a single-column ID.
8080
*/
81-
public function getIdValue(object $object = null): string
81+
public function getIdValue(?object $object = null): string
8282
{
8383
if (!$object) {
8484
return '';

src/Symfony/Bridge/Doctrine/IdGenerator/UlidGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ final class UlidGenerator extends AbstractIdGenerator
2121
{
2222
private $factory;
2323

24-
public function __construct(UlidFactory $factory = null)
24+
public function __construct(?UlidFactory $factory = null)
2525
{
2626
$this->factory = $factory;
2727
}

src/Symfony/Bridge/Doctrine/IdGenerator/UuidGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ final class UuidGenerator extends AbstractIdGenerator
2323
private $factory;
2424
private $entityGetter;
2525

26-
public function __construct(UuidFactory $factory = null)
26+
public function __construct(?UuidFactory $factory = null)
2727
{
2828
$this->protoFactory = $this->factory = $factory ?? new UuidFactory();
2929
}

src/Symfony/Bridge/Doctrine/Logger/DbalLogger.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class DbalLogger implements SQLLogger
2626
protected $logger;
2727
protected $stopwatch;
2828

29-
public function __construct(LoggerInterface $logger = null, Stopwatch $stopwatch = null)
29+
public function __construct(?LoggerInterface $logger = null, ?Stopwatch $stopwatch = null)
3030
{
3131
$this->logger = $logger;
3232
$this->stopwatch = $stopwatch;
@@ -37,7 +37,7 @@ public function __construct(LoggerInterface $logger = null, Stopwatch $stopwatch
3737
*
3838
* @return void
3939
*/
40-
public function startQuery($sql, array $params = null, array $types = null)
40+
public function startQuery($sql, ?array $params = null, ?array $types = null)
4141
{
4242
if (null !== $this->stopwatch) {
4343
$this->stopwatch->start('doctrine', 'doctrine');

src/Symfony/Bridge/Doctrine/Messenger/AbstractDoctrineMiddleware.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ abstract class AbstractDoctrineMiddleware implements MiddlewareInterface
2828
protected $managerRegistry;
2929
protected $entityManagerName;
3030

31-
public function __construct(ManagerRegistry $managerRegistry, string $entityManagerName = null)
31+
public function __construct(ManagerRegistry $managerRegistry, ?string $entityManagerName = null)
3232
{
3333
$this->managerRegistry = $managerRegistry;
3434
$this->entityManagerName = $entityManagerName;

src/Symfony/Bridge/Doctrine/Messenger/DoctrineOpenTransactionLoggerMiddleware.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class DoctrineOpenTransactionLoggerMiddleware extends AbstractDoctrineMiddleware
2929
/** @var bool */
3030
private $isHandling = false;
3131

32-
public function __construct(ManagerRegistry $managerRegistry, string $entityManagerName = null, LoggerInterface $logger = null)
32+
public function __construct(ManagerRegistry $managerRegistry, ?string $entityManagerName = null, ?LoggerInterface $logger = null)
3333
{
3434
parent::__construct($managerRegistry, $entityManagerName);
3535

src/Symfony/Bridge/Doctrine/Middleware/Debug/DBAL3/Statement.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function __construct(
3636
DebugDataHolder $debugDataHolder,
3737
string $connectionName,
3838
string $sql,
39-
Stopwatch $stopwatch = null
39+
?Stopwatch $stopwatch = null
4040
) {
4141
$this->stopwatch = $stopwatch;
4242
$this->connectionName = $connectionName;

src/Symfony/Bridge/Doctrine/Security/User/EntityUserProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class EntityUserProvider implements UserProviderInterface, PasswordUpgraderInter
3939
private $class;
4040
private $property;
4141

42-
public function __construct(ManagerRegistry $registry, string $classOrAlias, string $property = null, string $managerName = null)
42+
public function __construct(ManagerRegistry $registry, string $classOrAlias, ?string $property = null, ?string $managerName = null)
4343
{
4444
$this->registry = $registry;
4545
$this->managerName = $managerName;

src/Symfony/Bridge/Doctrine/Test/DoctrineTestHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class DoctrineTestHelper
4040
*
4141
* @return EntityManager
4242
*/
43-
public static function createTestEntityManager(Configuration $config = null)
43+
public static function createTestEntityManager(?Configuration $config = null)
4444
{
4545
if (!\extension_loaded('pdo_sqlite')) {
4646
TestCase::markTestSkipped('Extension pdo_sqlite is required.');

src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,7 @@ public function testOverrideChoicesValuesWithCallable()
783783
'em' => 'default',
784784
'class' => self::ITEM_GROUP_CLASS,
785785
'choice_label' => 'name',
786-
'choice_value' => function (GroupableEntity $entity = null) {
786+
'choice_value' => function (?GroupableEntity $entity = null) {
787787
if (null === $entity) {
788788
return '';
789789
}

src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/DoctrineExtractorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public function testTestGetPropertiesWithEmbedded()
123123
/**
124124
* @dataProvider typesProvider
125125
*/
126-
public function testExtract(string $property, array $type = null)
126+
public function testExtract(string $property, ?array $type = null)
127127
{
128128
$this->assertEquals($type, $this->createExtractor()->getTypes(DoctrineDummy::class, $property, []));
129129
}

src/Symfony/Bridge/Doctrine/Tests/Validator/DoctrineLoaderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ public function testFieldMappingsConfiguration()
211211
/**
212212
* @dataProvider regexpProvider
213213
*/
214-
public function testClassValidator(bool $expected, string $classValidatorRegexp = null)
214+
public function testClassValidator(bool $expected, ?string $classValidatorRegexp = null)
215215
{
216216
$doctrineLoader = new DoctrineLoader(DoctrineTestHelper::createTestEntityManager(), $classValidatorRegexp, false);
217217

src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntity.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,14 @@ class UniqueEntity extends Constraint
4646
*/
4747
public function __construct(
4848
$fields,
49-
string $message = null,
50-
string $service = null,
51-
string $em = null,
52-
string $entityClass = null,
53-
string $repositoryMethod = null,
54-
string $errorPath = null,
55-
bool $ignoreNull = null,
56-
array $groups = null,
49+
?string $message = null,
50+
?string $service = null,
51+
?string $em = null,
52+
?string $entityClass = null,
53+
?string $repositoryMethod = null,
54+
?string $errorPath = null,
55+
?bool $ignoreNull = null,
56+
?array $groups = null,
5757
$payload = null,
5858
array $options = []
5959
) {

src/Symfony/Bridge/Doctrine/Validator/DoctrineLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ final class DoctrineLoader implements LoaderInterface
3636
private $entityManager;
3737
private $classValidatorRegexp;
3838

39-
public function __construct(EntityManagerInterface $entityManager, string $classValidatorRegexp = null)
39+
public function __construct(EntityManagerInterface $entityManager, ?string $classValidatorRegexp = null)
4040
{
4141
$this->entityManager = $entityManager;
4242
$this->classValidatorRegexp = $classValidatorRegexp;

src/Symfony/Bridge/Monolog/Formatter/ConsoleFormatter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ private function replacePlaceHolder(array $record): array
182182
return $record;
183183
}
184184

185-
private function dumpData($data, bool $colors = null): string
185+
private function dumpData($data, ?bool $colors = null): string
186186
{
187187
if (null === $this->dumper) {
188188
return '';

src/Symfony/Bridge/Monolog/Formatter/VarDumperFormatter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class VarDumperFormatter implements FormatterInterface
2121
{
2222
private $cloner;
2323

24-
public function __construct(VarCloner $cloner = null)
24+
public function __construct(?VarCloner $cloner = null)
2525
{
2626
$this->cloner = $cloner ?? new VarCloner();
2727
}

src/Symfony/Bridge/Monolog/Handler/ConsoleHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class ConsoleHandler extends AbstractProcessingHandler implements EventSubscribe
6060
* @param array $verbosityLevelMap Array that maps the OutputInterface verbosity to a minimum logging
6161
* level (leave empty to use the default mapping)
6262
*/
63-
public function __construct(OutputInterface $output = null, bool $bubble = true, array $verbosityLevelMap = [], array $consoleFormatterOptions = [])
63+
public function __construct(?OutputInterface $output = null, bool $bubble = true, array $verbosityLevelMap = [], array $consoleFormatterOptions = [])
6464
{
6565
parent::__construct(Logger::DEBUG, $bubble);
6666
$this->output = $output;

src/Symfony/Bridge/Monolog/Handler/ElasticsearchLogstashHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class ElasticsearchLogstashHandler extends AbstractHandler
5858
/**
5959
* @param string|int $level The minimum logging level at which this handler will be triggered
6060
*/
61-
public function __construct(string $endpoint = 'http://127.0.0.1:9200', string $index = 'monolog', HttpClientInterface $client = null, $level = Logger::DEBUG, bool $bubble = true, string $elasticsearchVersion = '1.0.0')
61+
public function __construct(string $endpoint = 'http://127.0.0.1:9200', string $index = 'monolog', ?HttpClientInterface $client = null, $level = Logger::DEBUG, bool $bubble = true, string $elasticsearchVersion = '1.0.0')
6262
{
6363
if (!interface_exists(HttpClientInterface::class)) {
6464
throw new \LogicException(sprintf('The "%s" handler needs an HTTP client. Try running "composer require symfony/http-client".', __CLASS__));

src/Symfony/Bridge/Monolog/Logger.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class Logger extends BaseLogger implements DebugLoggerInterface, ResetInterface
2525
/**
2626
* {@inheritdoc}
2727
*/
28-
public function getLogs(Request $request = null)
28+
public function getLogs(?Request $request = null)
2929
{
3030
if ($logger = $this->getDebugLogger()) {
3131
return $logger->getLogs($request);
@@ -37,7 +37,7 @@ public function getLogs(Request $request = null)
3737
/**
3838
* {@inheritdoc}
3939
*/
40-
public function countErrors(Request $request = null)
40+
public function countErrors(?Request $request = null)
4141
{
4242
if ($logger = $this->getDebugLogger()) {
4343
return $logger->countErrors($request);

src/Symfony/Bridge/Monolog/Processor/DebugProcessor.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class DebugProcessor implements DebugLoggerInterface, ResetInterface
2323
private $errorCount = [];
2424
private $requestStack;
2525

26-
public function __construct(RequestStack $requestStack = null)
26+
public function __construct(?RequestStack $requestStack = null)
2727
{
2828
$this->requestStack = $requestStack;
2929
}
@@ -68,7 +68,7 @@ public function __invoke(array $record)
6868
/**
6969
* {@inheritdoc}
7070
*/
71-
public function getLogs(Request $request = null)
71+
public function getLogs(?Request $request = null)
7272
{
7373
if (null !== $request) {
7474
return $this->records[spl_object_hash($request)] ?? [];
@@ -84,7 +84,7 @@ public function getLogs(Request $request = null)
8484
/**
8585
* {@inheritdoc}
8686
*/
87-
public function countErrors(Request $request = null)
87+
public function countErrors(?Request $request = null)
8888
{
8989
if (null !== $request) {
9090
return $this->errorCount[spl_object_hash($request)] ?? 0;

src/Symfony/Bridge/Monolog/Processor/WebProcessor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
*/
2626
class WebProcessor extends BaseWebProcessor implements EventSubscriberInterface
2727
{
28-
public function __construct(array $extraFields = null)
28+
public function __construct(?array $extraFields = null)
2929
{
3030
// Pass an empty array as the default null value would access $_SERVER
3131
parent::__construct([], $extraFields);

src/Symfony/Bridge/Monolog/Tests/ClassThatInheritLogger.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616

1717
class ClassThatInheritLogger extends Logger
1818
{
19-
public function getLogs(Request $request = null): array
19+
public function getLogs(?Request $request = null): array
2020
{
2121
return parent::getLogs($request);
2222
}
2323

24-
public function countErrors(Request $request = null): int
24+
public function countErrors(?Request $request = null): int
2525
{
2626
return parent::countErrors($request);
2727
}

src/Symfony/Bridge/Monolog/Tests/Processor/ClassThatInheritDebugProcessor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616

1717
class ClassThatInheritDebugProcessor extends DebugProcessor
1818
{
19-
public function getLogs(Request $request = null): array
19+
public function getLogs(?Request $request = null): array
2020
{
2121
return parent::getLogs($request);
2222
}
2323

24-
public function countErrors(Request $request = null): int
24+
public function countErrors(?Request $request = null): int
2525
{
2626
return parent::countErrors($request);
2727
}

src/Symfony/Bridge/PhpUnit/CoverageListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class CoverageListener implements TestListener
2626
private $sutFqcnResolver;
2727
private $warningOnSutNotFound;
2828

29-
public function __construct(callable $sutFqcnResolver = null, bool $warningOnSutNotFound = false)
29+
public function __construct(?callable $sutFqcnResolver = null, bool $warningOnSutNotFound = false)
3030
{
3131
$this->sutFqcnResolver = $sutFqcnResolver ?? static function (Test $test): ?string {
3232
$class = \get_class($test);

src/Symfony/Bridge/Twig/Command/DebugCommand.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class DebugCommand extends Command
4444
private $filesystemLoaders;
4545
private $fileLinkFormatter;
4646

47-
public function __construct(Environment $twig, string $projectDir = null, array $bundlesMetadata = [], string $twigDefaultPath = null, FileLinkFormatter $fileLinkFormatter = null)
47+
public function __construct(Environment $twig, ?string $projectDir = null, array $bundlesMetadata = [], ?string $twigDefaultPath = null, ?FileLinkFormatter $fileLinkFormatter = null)
4848
{
4949
parent::__construct();
5050

@@ -218,7 +218,7 @@ private function displayPathsJson(SymfonyStyle $io, string $name)
218218
$io->writeln(json_encode($data));
219219
}
220220

221-
private function displayGeneralText(SymfonyStyle $io, string $filter = null)
221+
private function displayGeneralText(SymfonyStyle $io, ?string $filter = null)
222222
{
223223
$decorated = $io->isDecorated();
224224
$types = ['functions', 'filters', 'tests', 'globals'];
@@ -280,7 +280,7 @@ private function displayGeneralJson(SymfonyStyle $io, ?string $filter)
280280
$io->writeln($decorated ? OutputFormatter::escape($data) : $data);
281281
}
282282

283-
private function getLoaderPaths(string $name = null): array
283+
private function getLoaderPaths(?string $name = null): array
284284
{
285285
$loaderPaths = [];
286286
foreach ($this->getFilesystemLoaders() as $loader) {

src/Symfony/Bridge/Twig/Command/LintCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ private function displayJson(OutputInterface $output, array $filesInfo)
236236
return min($errors, 1);
237237
}
238238

239-
private function renderException(SymfonyStyle $output, string $template, Error $exception, string $file = null, GithubActionReporter $githubReporter = null)
239+
private function renderException(SymfonyStyle $output, string $template, Error $exception, ?string $file = null, ?GithubActionReporter $githubReporter = null)
240240
{
241241
$line = $exception->getTemplateLine();
242242

src/Symfony/Bridge/Twig/DataCollector/TwigDataCollector.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class TwigDataCollector extends DataCollector implements LateDataCollectorInterf
3232
private $twig;
3333
private $computed;
3434

35-
public function __construct(Profile $profile, Environment $twig = null)
35+
public function __construct(Profile $profile, ?Environment $twig = null)
3636
{
3737
$this->profile = $profile;
3838
$this->twig = $twig;
@@ -41,7 +41,7 @@ public function __construct(Profile $profile, Environment $twig = null)
4141
/**
4242
* {@inheritdoc}
4343
*/
44-
public function collect(Request $request, Response $response, \Throwable $exception = null)
44+
public function collect(Request $request, Response $response, ?\Throwable $exception = null)
4545
{
4646
}
4747

src/Symfony/Bridge/Twig/ErrorRenderer/TwigErrorRenderer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class TwigErrorRenderer implements ErrorRendererInterface
3232
/**
3333
* @param bool|callable $debug The debugging mode as a boolean or a callable that should return it
3434
*/
35-
public function __construct(Environment $twig, HtmlErrorRenderer $fallbackErrorRenderer = null, $debug = false)
35+
public function __construct(Environment $twig, ?HtmlErrorRenderer $fallbackErrorRenderer = null, $debug = false)
3636
{
3737
if (!\is_bool($debug) && !\is_callable($debug)) {
3838
throw new \TypeError(sprintf('Argument 3 passed to "%s()" must be a boolean or a callable, "%s" given.', __METHOD__, get_debug_type($debug)));

0 commit comments

Comments
 (0)