Skip to content

Commit

Permalink
[Core] Replace deprecated $mutatingScope->enterCatch() with enterCatc…
Browse files Browse the repository at this point in the history
…hType() (#2548)
  • Loading branch information
samsonasik committed Jun 25, 2022
1 parent 82f1bb3 commit 6845975
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
use PHPStan\Reflection\BetterReflection\Reflector\MemoizingReflector;
use PHPStan\Reflection\ClassReflection;
use PHPStan\Reflection\ReflectionProvider;
use PHPStan\Type\ObjectType;
use PHPStan\Type\TypeCombinator;
use Rector\Caching\Detector\ChangedFilesDetector;
use Rector\Caching\FileSystem\DependencyResolver;
use Rector\Core\Exception\ShouldNotHappenException;
Expand Down Expand Up @@ -144,7 +146,13 @@ public function processNodes(
$varName = $catch->var instanceof Variable
? $this->nodeNameResolver->getName($catch->var)
: null;
$catchMutatingScope = $mutatingScope->enterCatch($catch->types, $varName);
$type = TypeCombinator::union(
...array_map(
static fn (Name $class): ObjectType => new ObjectType((string) $class),
$catch->types
)
);
$catchMutatingScope = $mutatingScope->enterCatchType($type, $varName);
$this->processNodes($catch->stmts, $smartFileInfo, $catchMutatingScope);
}

Expand Down

0 comments on commit 6845975

Please sign in to comment.