Skip to content

Commit

Permalink
[Performance] Reduce double traverse on StrictNativeFunctionReturnTyp…
Browse files Browse the repository at this point in the history
…eAnalyzer (#6320)
  • Loading branch information
samsonasik authored Sep 21, 2024
1 parent fbcf76d commit 92f64ff
Showing 1 changed file with 0 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
namespace Rector\TypeDeclaration\NodeAnalyzer\ReturnTypeAnalyzer;

use PhpParser\Node\Expr\CallLike;
use PhpParser\Node\Expr\Yield_;
use PhpParser\Node\Expr\YieldFrom;
use PhpParser\Node\Stmt\ClassMethod;
use PhpParser\Node\Stmt\Function_;
use Rector\PhpParser\Node\BetterNodeFinder;
Expand All @@ -31,13 +29,6 @@ public function matchAlwaysReturnNativeCallLikes(ClassMethod|Function_ $function
return null;
}

if ($this->betterNodeFinder->hasInstancesOfInFunctionLikeScoped(
$functionLike,
[Yield_::class, YieldFrom::class]
)) {
return null;
}

$returns = $this->betterNodeFinder->findReturnsScoped($functionLike);
if (! $this->returnAnalyzer->hasOnlyReturnWithExpr($functionLike, $returns)) {
return null;
Expand Down

0 comments on commit 92f64ff

Please sign in to comment.