From ea97f93f7486034718f540071813a3769dfec768 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Thu, 14 Mar 2024 08:27:29 +0000 Subject: [PATCH] Updated Rector to commit fbba8606a56e0643a7b3d1ae9af5fded082eea06 https://github.com/rectorphp/rector-src/commit/fbba8606a56e0643a7b3d1ae9af5fded082eea06 [Php80] Skip ObjectType on ChangeSwitchToMatchRector (#5719) --- rules/Php80/Rector/Switch_/ChangeSwitchToMatchRector.php | 4 ++++ src/Application/VersionResolver.php | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/rules/Php80/Rector/Switch_/ChangeSwitchToMatchRector.php b/rules/Php80/Rector/Switch_/ChangeSwitchToMatchRector.php index 9b496fdc327..afda24fb037 100644 --- a/rules/Php80/Rector/Switch_/ChangeSwitchToMatchRector.php +++ b/rules/Php80/Rector/Switch_/ChangeSwitchToMatchRector.php @@ -9,6 +9,7 @@ use PhpParser\Node\Expr\Assign; use PhpParser\Node\Stmt\Expression; use PhpParser\Node\Stmt\Return_; use PhpParser\Node\Stmt\Switch_; +use PHPStan\Type\ObjectType; use Rector\Contract\PhpParser\Node\StmtsAwareInterface; use Rector\Php80\NodeAnalyzer\MatchSwitchAnalyzer; use Rector\Php80\NodeFactory\MatchFactory; @@ -101,6 +102,9 @@ CODE_SAMPLE continue; } $isReturn = $this->matchSwitchAnalyzer->isReturnCondsAndExprs($condAndExprs); + if ($this->nodeTypeResolver->getType($stmt->cond) instanceof ObjectType) { + continue; + } $matchResult = $this->matchFactory->createFromCondAndExprs($stmt->cond, $condAndExprs, $nextStmt); if (!$matchResult instanceof MatchResult) { continue; diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index c4bca086991..7c764004350 100644 --- a/src/Application/VersionResolver.php +++ b/src/Application/VersionResolver.php @@ -19,12 +19,12 @@ final class VersionResolver * @api * @var string */ - public const PACKAGE_VERSION = 'd01d16e9d8c7225e5a45cb2534b1b338f93e5740'; + public const PACKAGE_VERSION = 'fbba8606a56e0643a7b3d1ae9af5fded082eea06'; /** * @api * @var string */ - public const RELEASE_DATE = '2024-03-14 10:11:24'; + public const RELEASE_DATE = '2024-03-14 15:25:09'; /** * @var int */