Updated Rector to commit 9d310ce5daca61f51f35e3c8755a442998f1c536

9d310ce5da Skip null type in ReturnTypeFromStrictScalarReturnExprRector as often not desired (#5462)
This commit is contained in:
Tomas Votruba 2024-01-13 09:43:24 +00:00
parent 6ab38a869f
commit 455fba49f9
2 changed files with 7 additions and 2 deletions

View File

@ -9,6 +9,7 @@ use PhpParser\Node\Stmt\ClassMethod;
use PhpParser\Node\Stmt\Function_;
use PhpParser\Node\UnionType;
use PHPStan\Analyser\Scope;
use PHPStan\Type\NullType;
use PHPStan\Type\Type;
use Rector\Contract\Rector\ConfigurableRectorInterface;
use Rector\PHPStanStaticTypeMapper\Enum\TypeKind;
@ -115,6 +116,10 @@ CODE_SAMPLE
if (!$scalarReturnType instanceof Type) {
return null;
}
// skip null as often placeholder value and not an only type
if ($scalarReturnType instanceof NullType) {
return null;
}
$returnTypeNode = $this->staticTypeMapper->mapPHPStanTypeToPhpParserNode($scalarReturnType, TypeKind::RETURN);
if (!$returnTypeNode instanceof Node) {
return null;

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = '2ac26e77e63664f3e250af12f021696c60ca0df4';
public const PACKAGE_VERSION = '9d310ce5daca61f51f35e3c8755a442998f1c536';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2024-01-13 08:49:04';
public const RELEASE_DATE = '2024-01-13 09:41:12';
/**
* @var int
*/