diff --git a/rules-tests/CodingStyle/Rector/ClassLike/NewlineBetweenClassLikeStmtsRector/Fixture/use_trait_after_property.php.inc b/rules-tests/CodingStyle/Rector/ClassLike/NewlineBetweenClassLikeStmtsRector/Fixture/use_trait_after_property.php.inc new file mode 100644 index 00000000000..ed0321d7401 --- /dev/null +++ b/rules-tests/CodingStyle/Rector/ClassLike/NewlineBetweenClassLikeStmtsRector/Fixture/use_trait_after_property.php.inc @@ -0,0 +1,24 @@ + +----- + \ No newline at end of file diff --git a/rules/CodeQuality/Rector/FuncCall/SortNamedParamRector.php b/rules/CodeQuality/Rector/FuncCall/SortNamedParamRector.php index 0a459c628ff..ceefebd412d 100644 --- a/rules/CodeQuality/Rector/FuncCall/SortNamedParamRector.php +++ b/rules/CodeQuality/Rector/FuncCall/SortNamedParamRector.php @@ -75,6 +75,7 @@ public function refactor(Node $node): ?Node if ($node instanceof CallLike && $node->isFirstClassCallable()) { return null; } + $args = $node instanceof Attribute ? $node->args : $node->getArgs(); if (count($args) <= 1) { diff --git a/rules/CodingStyle/Rector/ClassLike/NewlineBetweenClassLikeStmtsRector.php b/rules/CodingStyle/Rector/ClassLike/NewlineBetweenClassLikeStmtsRector.php index c0115b98710..db4cc27accd 100644 --- a/rules/CodingStyle/Rector/ClassLike/NewlineBetweenClassLikeStmtsRector.php +++ b/rules/CodingStyle/Rector/ClassLike/NewlineBetweenClassLikeStmtsRector.php @@ -86,13 +86,13 @@ private function processAddNewLine(ClassLike $classLike, bool $hasChanged, int $ break; } - if ($classLike->stmts[$key + 1] instanceof TraitUse) { - continue; - } - $stmt = $classLike->stmts[$key]; $nextStmt = $classLike->stmts[$key + 1]; + if ($stmt instanceof TraitUse && $nextStmt instanceof TraitUse) { + continue; + } + $endLine = $stmt->getEndLine(); $rangeLine = $nextStmt->getStartLine() - $endLine;