Skip to content

Commit 471d887

Browse files
committed
handle AlwaysRememberedExpr
1 parent 394e989 commit 471d887

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Rector/ToNativeUsagesRector.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
use PhpParser\Node\Stmt\Switch_;
5151
use PhpParser\Node\VariadicPlaceholder;
5252
use PHPStan\Type\ObjectType;
53+
use PHPStan\Node\Expr\AlwaysRememberedExpr;
5354
use Rector\StaticTypeMapper\ValueObject\Type\FullyQualifiedObjectType;
5455
use Symplify\RuleDocGenerator\ValueObject\CodeSample\ConfiguredCodeSample;
5556
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
@@ -664,6 +665,9 @@ protected function refactorKey(PropertyFetch $fetch): ?Node
664665
protected function refactorMatch(Match_ $match): ?Node
665666
{
666667
$cond = $match->cond;
668+
while ($cond instanceof AlwaysRememberedExpr) {
669+
$cond = $cond->getExpr();
670+
}
667671
if (($cond instanceof PropertyFetch || $cond instanceof NullsafePropertyFetch)
668672
&& $this->inConfiguredClasses($cond->var)
669673
) {
@@ -691,6 +695,7 @@ protected function refactorMatch(Match_ $match): ?Node
691695
return new Match_($var, $match->arms, $match->getAttributes());
692696
}
693697
}
698+
dump($this->inConfiguredClasses($cond));
694699

695700
if ($this->inConfiguredClasses($cond)) {
696701
return null;

0 commit comments

Comments
 (0)