Skip to content

Commit

Permalink
Updated Rector to commit 7e566722a08a546858fa67d73915c9dff9a0c018
Browse files Browse the repository at this point in the history
rectorphp/rector-src@7e56672 [Php80][CodeQuality] Handle crash on ChangeSwitchToMatchRector + TernaryFalseExpressionToIfRector on under if else (#5446)
  • Loading branch information
TomasVotruba committed Jan 8, 2024
1 parent bddc91b commit 911e446
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Application/VersionResolver.php
Expand Up @@ -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
*/
Expand Down
3 changes: 2 additions & 1 deletion src/NodeTypeResolver/NodeTypeResolver.php
Expand Up @@ -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;
Expand Down Expand Up @@ -280,7 +281,7 @@ public function getFullyQualifiedClassName(TypeWithClassName $typeWithClassName)
}
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);
}
Expand Down
Expand Up @@ -51,6 +51,7 @@
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;
Expand Down Expand Up @@ -146,6 +147,11 @@ public function processNodes(array $stmts, string $filePath, ?MutatingScope $for
$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) {
Expand Down

0 comments on commit 911e446

Please sign in to comment.