Skip to content

Commit

Permalink
Updated Rector to commit 6a4d7178cc23656fabc4ea31a8d1673cdfde6e37
Browse files Browse the repository at this point in the history
rectorphp/rector-src@6a4d717 [PHPStanStaticTypeMapper] Clean up TypeUnwrapper::removeNullTypeFromUnionType() (#6220)
  • Loading branch information
TomasVotruba committed Aug 6, 2024
1 parent cfe590f commit f253bfe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/Application/VersionResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = '147c96190e99909c71c2d920a83ae96cc9b3bd57';
public const PACKAGE_VERSION = '6a4d7178cc23656fabc4ea31a8d1673cdfde6e37';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2024-08-06 12:31:33';
public const RELEASE_DATE = '2024-08-06 20:26:09';
/**
* @var int
*/
Expand Down
13 changes: 2 additions & 11 deletions src/PHPStanStaticTypeMapper/Utils/TypeUnwrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
namespace Rector\PHPStanStaticTypeMapper\Utils;

use PHPStan\Type\Type;
use PHPStan\Type\TypeCombinator;
use PHPStan\Type\TypeWithClassName;
use PHPStan\Type\UnionType;
final class TypeUnwrapper
Expand All @@ -23,16 +24,6 @@ public function unwrapFirstObjectTypeFromUnionType(Type $type) : Type
}
public function removeNullTypeFromUnionType(UnionType $unionType) : Type
{
$unionedTypesWithoutNullType = [];
foreach ($unionType->getTypes() as $type) {
if ($type instanceof UnionType) {
continue;
}
$unionedTypesWithoutNullType[] = $type;
}
if ($unionedTypesWithoutNullType !== []) {
return $unionedTypesWithoutNullType[0];
}
return new UnionType($unionedTypesWithoutNullType);
return TypeCombinator::removeNull($unionType);
}
}

0 comments on commit f253bfe

Please sign in to comment.