Skip to content

Commit

Permalink
Merge branch '2.18' into 3879-AlignMultiline-before-Phpdoc
Browse files Browse the repository at this point in the history
  • Loading branch information
keradus committed Mar 17, 2021
2 parents 98ce7bf + cbe98ff commit f49f879
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Fixer/ClassNotation/ClassAttributesSeparationFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ private function fixSpaceBelowClassMethod(Tokens $tokens, $classEndIndex, $eleme
*/
private function fixSpaceAboveClassElement(Tokens $tokens, $classStartIndex, $elementIndex, $spacing)
{
static $methodAttr = [T_PRIVATE, T_PROTECTED, T_PUBLIC, T_ABSTRACT, T_FINAL, T_STATIC, T_STRING, T_NS_SEPARATOR, T_VAR, CT::T_NULLABLE_TYPE, CT::T_ARRAY_TYPEHINT];
static $methodAttr = [T_PRIVATE, T_PROTECTED, T_PUBLIC, T_ABSTRACT, T_FINAL, T_STATIC, T_STRING, T_NS_SEPARATOR, T_VAR, CT::T_NULLABLE_TYPE, CT::T_ARRAY_TYPEHINT, CT::T_TYPE_ALTERNATION];

$nonWhiteAbove = null;

Expand Down
22 changes: 21 additions & 1 deletion tests/Fixer/ClassNotation/ClassAttributesSeparationFixerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1416,7 +1416,7 @@ class User3
}',
];

yield [
yield 'constructor property promotion' => [
'<?php
class Foo {
private array $foo;
Expand All @@ -1440,5 +1440,25 @@ public function __construct(
) {}
}',
];

yield 'typed properties' => [
'<?php
class Foo {
private static int | float | null $a;
private static int | float | null $b;
private int | float | null $c;
private int | float | null $d;
}',
'<?php
class Foo {
private static int | float | null $a;
private static int | float | null $b;
private int | float | null $c;
private int | float | null $d;
}',
];
}
}

0 comments on commit f49f879

Please sign in to comment.