Skip to content

Commit

Permalink
Merge branch 'master' into trait
Browse files Browse the repository at this point in the history
  • Loading branch information
keradus authored Oct 6, 2023
2 parents 0c34457 + 2875d76 commit 836c790
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 5 deletions.
2 changes: 2 additions & 0 deletions doc/list.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2174,6 +2174,8 @@ List of Available Rules
| Default value: ``false``

Part of rule set `@PhpCsFixer <./ruleSets/PhpCsFixer.rst>`_

`Source PhpCsFixer\\Fixer\\ClassNotation\\OrderedTypesFixer <./../src/Fixer/ClassNotation/OrderedTypesFixer.php>`_
- `phpdoc_add_missing_param_annotation <./rules/phpdoc/phpdoc_add_missing_param_annotation.rst>`_

Expand Down
1 change: 1 addition & 0 deletions doc/ruleSets/PhpCsFixer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ Rules
- `no_useless_else <./../rules/control_structure/no_useless_else.rst>`_
- `no_useless_return <./../rules/return_notation/no_useless_return.rst>`_
- `ordered_class_elements <./../rules/class_notation/ordered_class_elements.rst>`_
- `ordered_types <./../rules/class_notation/ordered_types.rst>`_
- `php_unit_internal_class <./../rules/php_unit/php_unit_internal_class.rst>`_
- `php_unit_test_class_requires_covers <./../rules/php_unit/php_unit_test_class_requires_covers.rst>`_
- `phpdoc_add_missing_param_annotation <./../rules/phpdoc/phpdoc_add_missing_param_annotation.rst>`_
Expand Down
8 changes: 8 additions & 0 deletions doc/rules/class_notation/ordered_types.rst
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,11 @@ With configuration: ``['sort_algorithm' => 'none', 'null_adjustment' => 'always_
- public function bar(null|string|int $foo): string|int;
+ public function bar(string|int|null $foo): string|int;
}
Rule sets
---------

The rule is part of the following rule set:

- `@PhpCsFixer <./../../ruleSets/PhpCsFixer.rst>`_

2 changes: 1 addition & 1 deletion src/Linter/TokenizerLinter.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function lintSource(string $source): LintingResultInterface
Tokens::fromCode($source);

return new TokenizerLintingResult();
} catch (\ParseError|\CompileError $e) {
} catch (\CompileError|\ParseError $e) {
return new TokenizerLintingResult($e);
}
}
Expand Down
1 change: 1 addition & 0 deletions src/RuleSet/Sets/PhpCsFixerSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ public function getRules(): array
'no_useless_return' => true,
'nullable_type_declaration_for_default_null_value' => false,
'ordered_class_elements' => true,
'ordered_types' => true,
'php_unit_internal_class' => true,
'php_unit_test_class_requires_covers' => true,
'phpdoc_add_missing_param_annotation' => true,
Expand Down
6 changes: 3 additions & 3 deletions tests/Fixtures/Integration/misc/PHP8_0.test
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ $object = new #[ExampleAttribute] class() {
// https://wiki.php.net/rfc/union_types_v2
class Number
{
private int|float|null $number;
private null|float|int $number;

public function setNumber(int|float $number): void
public function setNumber(float|int $number): void
{
$this->number = $number;
}

public function getNumber(): int|float|null
public function getNumber(): null|float|int
{
return $this->number;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Fixtures/Integration/misc/PHP8_2.test
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ trait WithConstants
}

// https://wiki.php.net/rfc/dnf_types
function generateSlug((HasTitle&HasId)|null $post)
function generateSlug(null|(HasId&HasTitle) $post)
{
throw new \Exception('not implemented');
}
Expand Down

0 comments on commit 836c790

Please sign in to comment.