Updated Rector to commit 7e566722a08a546858fa67d73915c9dff9a0c018

7e566722a0 [Php80][CodeQuality] Handle crash on ChangeSwitchToMatchRector + TernaryFalseExpressionToIfRector on under if else (#5446)
This commit is contained in:
Tomas Votruba 2024-01-08 13:46:06 +00:00
parent bddc91bccd
commit 911e446bd5
3 changed files with 10 additions and 3 deletions

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = 'b71c3265d5f90745d52b081a1201e3d97617e14a';
public const PACKAGE_VERSION = '7e566722a08a546858fa67d73915c9dff9a0c018';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2024-01-07 17:54:29';
public const RELEASE_DATE = '2024-01-08 20:43:57';
/**
* @var int
*/

View File

@ -3,6 +3,7 @@
declare (strict_types=1);
namespace Rector\NodeTypeResolver;
use PhpParser\Node\Expr\NullsafeMethodCall;
use PhpParser\Node;
use PhpParser\Node\Expr;
use PhpParser\Node\Expr\ArrayDimFetch;
@ -280,7 +281,7 @@ final class NodeTypeResolver
}
public function isMethodStaticCallOrClassMethodObjectType(Node $node, ObjectType $objectType) : bool
{
if ($node instanceof MethodCall || $node instanceof Expr\NullsafeMethodCall) {
if ($node instanceof MethodCall || $node instanceof NullsafeMethodCall) {
// method call is variable return
return $this->isObjectType($node->var, $objectType);
}

View File

@ -51,6 +51,7 @@ use PHPStan\Node\UnreachableStatementNode;
use PHPStan\Reflection\ReflectionProvider;
use PHPStan\Type\ObjectType;
use PHPStan\Type\TypeCombinator;
use Rector\Contract\PhpParser\Node\StmtsAwareInterface;
use Rector\Exception\ShouldNotHappenException;
use Rector\NodeAnalyzer\ClassAnalyzer;
use Rector\NodeNameResolver\NodeNameResolver;
@ -146,6 +147,11 @@ final class PHPStanNodeScopeResolver
$this->nodeScopeResolver->processNodes($node->stmts, $mutatingScope, $nodeCallback);
return;
}
if ($node instanceof StmtsAwareInterface && $node->stmts !== null) {
foreach ($node->stmts as $stmt) {
$stmt->setAttribute(AttributeKey::SCOPE, $mutatingScope);
}
}
if (($node instanceof Expression || $node instanceof Return_ || $node instanceof EnumCase || $node instanceof Cast) && $node->expr instanceof Expr) {
$node->expr->setAttribute(AttributeKey::SCOPE, $mutatingScope);
} elseif ($node instanceof Assign || $node instanceof AssignOp) {