Skip to content

Commit

Permalink
[Php71] Remove direct return STOP_TRAVERSAL on CountOnNullRector (#4189)
Browse files Browse the repository at this point in the history
Co-authored-by: GitHub Action <actions@github.com>
  • Loading branch information
samsonasik and actions-user committed Jun 12, 2023
1 parent a9efd72 commit 5612c7f
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions rules/Php71/Rector/FuncCall/CountOnNullRector.php
Expand Up @@ -17,7 +17,6 @@
use PhpParser\Node\Name;
use PhpParser\Node\Name\FullyQualified;
use PhpParser\Node\Scalar\LNumber;
use PhpParser\Node\Stmt\Trait_;
use PhpParser\NodeTraverser;
use PHPStan\Analyser\Scope;
use PHPStan\Type\ArrayType;
Expand Down Expand Up @@ -78,19 +77,14 @@ public function getRuleDefinition(): RuleDefinition
*/
public function getNodeTypes(): array
{
return [Trait_::class, FuncCall::class, Ternary::class];
return [FuncCall::class, Ternary::class];
}

/**
* @param Trait_|FuncCall|Ternary $node
* @param FuncCall|Ternary $node
*/
public function refactorWithScope(Node $node, Scope $scope): int|Ternary|null|FuncCall
{
if ($node instanceof Trait_) {
// skip contents in traits, as hard to analyze
return NodeTraverser::STOP_TRAVERSAL;
}

if ($node instanceof Ternary) {
if ($this->shouldSkipTernaryIfElseCountFuncCall($node)) {
return NodeTraverser::DONT_TRAVERSE_CHILDREN;
Expand Down

0 comments on commit 5612c7f

Please sign in to comment.