8000 minor #53544 CS: enable ordered_types.null_adjustment=always_last (ke… · symfony/symfony@744d0ac · GitHub
[go: up one dir, main page]

Skip to content

Commit 744d0ac

Browse files
committed
minor #53544 CS: enable ordered_types.null_adjustment=always_last (keradus)
This PR was squashed before being merged into the 7.1 branch. Discussion ---------- CS: enable ordered_types.null_adjustment=always_last | Q | A | ------------- | --- | Branch? | 7.1 | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Issues | Fix CS | License | MIT This PR is to apply rule to put `null` as last type variant for type declaration. Sf ruleset is already having enabled very same rule for types in phpdoc. Diff is very minimal, most of codebase already follows it. If merged, we can adjust official ruleset (PR already prepared by community: PHP-CS-Fixer/PHP-CS-Fixer#7356 ) Commits ------- 67a5d2d CS: enable ordered_types.null_adjustment=always_last
2 parents b004c3c + 67a5d2d commit 744d0ac

File tree

9 files changed

+9
-8
lines changed

9 files changed

+9
-8
lines changed

.php-cs-fixer.dist.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
'modernize_strpos' => true,
3939
'get_class_to_class_keyword' => true,
4040
'nullable_type_declaration' => true,
41+
'ordered_types' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'],
4142
'trailing_comma_in_multiline' => ['elements' => ['arrays', 'match', 'parameters']],
4243
])
4344
->setRiskyAllowed(true)

src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinition
3333
protected ?string $key = null;
3434
protected bool $removeKeyItem = false;
3535
protected bool $addDefaults = false;
36-
protected int|string|array|null|false $addDefaultChildren = false;
36+
protected int|string|array|false|null $addDefaultChildren = false;
3737
protected NodeBuilder $nodeBuilder;
3838
protected bool $normalizeKeys = true;
3939

src/Symfony/Component/Console/Input/InputArgument.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class InputArgument
3030
public const IS_ARRAY = 4;
3131

3232
private int $mode;
33-
private string|int|bool|array|null|float $default;
33+
private string|int|bool|array|float|null $default;
3434

3535
/**
3636
* @param string $name The argument name

src/Symfony/Component/Console/Input/InputOption.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class InputOption
5353
private string $name;
5454
private string|array|null $shortcut;
5555
private int $mode;
56-
private string|int|bool|array|null|float $default;
56+
private string|int|bool|array|float|null $default;
5757

5858
/**
5959
* @param string|array|null $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts

src/Symfony/Component/Console/Question/Question.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class Question
3636
*/
3737
public function __construct(
3838
private string $question,
39-
private null|string|bool|int|float $default = null,
39+
private string|bool|int|float|null $default = null,
4040
) {
4141
}
4242

src/Symfony/Component/ErrorHandler/ErrorRenderer/FileLinkFormatter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function __construct(
3333
string|array $fileLinkFormat = null,
3434
private ?RequestStack $requestStack = null,
3535
private ?string $baseDir = null,
36-
private null|string|\Closure $urlFormat = null,
36+
private string|\Closure|null $urlFormat = null,
3737
) {
3838
$fileLinkFormat ??= $_ENV['SYMFONY_IDE'] ?? $_SERVER['SYMFONY_IDE'] ?? '';
3939

src/Symfony/Component/Form/FormRegistry.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class FormRegistry implements FormRegistryInterface
3333
*/
3434
private array $types = [];
3535

36-
private FormTypeGuesserInterface|null|false $guesser = false;
36+
private FormTypeGuesserInterface|false|null $guesser = false;
3737
private ResolvedFormTypeFactoryInterface $resolvedTypeFactory;
3838
private array $checkedTypes = [];
3939

src/Symfony/Component/HttpKernel/HttpCache/ResponseCacheStrategy.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class ResponseCacheStrategy implements ResponseCacheStrategyInterface
3737
private int $embeddedResponses = 0;
3838
private bool $isNotCacheableResponseEmbedded = false;
3939
private int $age = 0;
40-
private \DateTimeInterface|null|false $lastModified = null;
40+
private \DateTimeInterface|false|null $lastModified = null;
4141
private array $flagDirectives = [
4242
'no-cache' => null,
4343
'no-store' => null,

src/Symfony/Component/Process/Tests/ProcessTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ public static function provideInvalidInputValues()
349349
/**
350350
* @dataProvider provideInputValues
351351
*/
352-
public function testValidInput(?string $expected, null|float|string $value)
352+
public function testValidInput(?string $expected, float|string|null $value)
353353
{
354354
$process = $this->getProcess('foo');
355355
$process->setInput($value);

0 commit comments

Comments
 (0)
0