Skip to content

Commit e78db7f

Browse files
Apply php-cs-fixer fix --rules nullable_type_declaration_for_default_null_value
1 parent f387675 commit e78db7f

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

Command/LintCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class LintCommand extends Command
4343
private $directoryIteratorProvider;
4444
private $isReadableProvider;
4545

46-
public function __construct(string $name = null, callable $directoryIteratorProvider = null, callable $isReadableProvider = null)
46+
public function __construct(?string $name = null, ?callable $directoryIteratorProvider = null, ?callable $isReadableProvider = null)
4747
{
4848
parent::__construct($name);
4949

@@ -133,7 +133,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
133133
return $this->display($io, $filesInfo);
134134
}
135135

136-
private function validate(string $content, int $flags, string $file = null)
136+
private function validate(string $content, int $flags, ?string $file = null)
137137
{
138138
$prevErrorHandler = set_error_handler(function ($level, $message, $file, $line) use (&$prevErrorHandler) {
139139
if (\E_USER_DEPRECATED === $level) {

Exception/ParseException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class ParseException extends RuntimeException
2929
* @param string|null $snippet The snippet of code near the problem
3030
* @param string|null $parsedFile The file name where the error occurred
3131
*/
32-
public function __construct(string $message, int $parsedLine = -1, string $snippet = null, string $parsedFile = null, \Throwable $previous = null)
32+
public function __construct(string $message, int $parsedLine = -1, ?string $snippet = null, ?string $parsedFile = null, ?\Throwable $previous = null)
3333
{
3434
$this->parsedFile = $parsedFile;
3535
$this->parsedLine = $parsedLine;

Inline.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class Inline
3434
private static $objectForMap = false;
3535
private static $constantSupport = false;
3636

37-
public static function initialize(int $flags, int $parsedLineNumber = null, string $parsedFilename = null)
37+
public static function initialize(int $flags, ?int $parsedLineNumber = null, ?string $parsedFilename = null)
3838
{
3939
self::$exceptionOnInvalidType = (bool) (Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE & $flags);
4040
self::$objectSupport = (bool) (Yaml::PARSE_OBJECT & $flags);
@@ -58,7 +58,7 @@ public static function initialize(int $flags, int $parsedLineNumber = null, stri
5858
*
5959
* @throws ParseException
6060
*/
61-
public static function parse(string $value = null, int $flags = 0, array &$references = [])
61+
public static function parse(?string $value = null, int $flags = 0, array &$references = [])
6262
{
6363
if (null === $value) {
6464
return '';
@@ -269,7 +269,7 @@ private static function dumpNull(int $flags): string
269269
*
270270
* @throws ParseException When malformed inline YAML string is parsed
271271
*/
272-
public static function parseScalar(string $scalar, int $flags = 0, array $delimiters = null, int &$i = 0, bool $evaluate = true, array &$references = [], bool &$isQuoted = null)
272+
public static function parseScalar(string $scalar, int $flags = 0, ?array $delimiters = null, int &$i = 0, bool $evaluate = true, array &$references = [], ?bool &$isQuoted = null)
273273
{
274274
if (\in_array($scalar[$i], ['"', "'"], true)) {
275275
// quoted scalar
@@ -562,7 +562,7 @@ private static function parseMapping(string $mapping, int $flags, int &$i = 0, a
562562
*
563563
* @throws ParseException when object parsing support was disabled and the parser detected a PHP object or when a reference could not be resolved
564564
*/
565-
private static function evaluateScalar(string $scalar, int $flags, array &$references = [], bool &$isQuotedString = null)
565+
private static function evaluateScalar(string $scalar, int $flags, array &$references = [], ?bool &$isQuotedString = null)
566566
{
567567
$isQuotedString = false;
568568
$scalar = trim($scalar);

Parser.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ private function getCurrentLineIndentation(): int
576576
*
577577
* @throws ParseException When indentation problem are detected
578578
*/
579-
private function getNextEmbedBlock(int $indentation = null, bool $inSequence = false): string
579+
private function getNextEmbedBlock(?int $indentation = null, bool $inSequence = false): string
580580
{
581581
$oldLineIndentation = $this->getCurrentLineIndentation();
582582

@@ -1082,7 +1082,7 @@ private function isStringUnIndentedCollectionItem(): bool
10821082
*
10831083
* @internal
10841084
*/
1085-
public static function preg_match(string $pattern, string $subject, array &$matches = null, int $flags = 0, int $offset = 0): int
1085+
public static function preg_match(string $pattern, string $subject, ?array &$matches = null, int $flags = 0, int $offset = 0): int
10861086
{
10871087
if (false === $ret = preg_match($pattern, $subject, $matches, $flags, $offset)) {
10881088
switch (preg_last_error()) {

0 commit comments

Comments
 (0)