diff --git a/rules/DeadCode/Rector/Cast/RecastingRemovalRector.php b/rules/DeadCode/Rector/Cast/RecastingRemovalRector.php index 787553b52bf..85861b7adcb 100644 --- a/rules/DeadCode/Rector/Cast/RecastingRemovalRector.php +++ b/rules/DeadCode/Rector/Cast/RecastingRemovalRector.php @@ -24,6 +24,7 @@ use PHPStan\Type\ObjectType; use PHPStan\Type\StringType; use PHPStan\Type\Type; +use PHPStan\Type\UnionType; use Rector\NodeAnalyzer\ExprAnalyzer; use Rector\NodeAnalyzer\PropertyFetchAnalyzer; use Rector\Rector\AbstractRector; @@ -126,6 +127,14 @@ private function shouldSkipCall(Expr $expr) : bool } private function shouldSkip(Expr $expr) : bool { + $type = $this->getType($expr); + if ($type instanceof UnionType) { + foreach ($type->getTypes() as $unionedType) { + if ($unionedType instanceof MixedType) { + return \true; + } + } + } if (!$this->propertyFetchAnalyzer->isPropertyFetch($expr)) { return $this->exprAnalyzer->isNonTypedFromParam($expr); } diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index 220cdb92c9a..012e4287299 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 = 'a4c489ee0914233600f93379edee4932ce2d4ee4'; + public const PACKAGE_VERSION = '95a145f9311826749ea9e72f44c3a3adb2a030f3'; /** * @api * @var string */ - public const RELEASE_DATE = '2025-02-05 11:37:04'; + public const RELEASE_DATE = '2025-02-05 15:47:13'; /** * @var int */