Updated Rector to commit 6095e3216f057fbf8dded18cf982bfab034f8086

6095e3216f  [TypeDeclaration] Allow abs() to return int when pass int arg on ReturnTypeFromStrictTypedCallRector (#5653)
This commit is contained in:
Tomas Votruba 2024-02-21 19:55:12 +00:00
parent 283153802a
commit 9ae89c0674
2 changed files with 9 additions and 4 deletions

View File

@ -3,7 +3,6 @@
declare (strict_types=1); declare (strict_types=1);
namespace Rector\TypeDeclaration\TypeAnalyzer; namespace Rector\TypeDeclaration\TypeAnalyzer;
use PHPStan\Reflection\ParametersAcceptorSelector;
use PhpParser\Node; use PhpParser\Node;
use PhpParser\Node\Expr; use PhpParser\Node\Expr;
use PhpParser\Node\Expr\Array_; use PhpParser\Node\Expr\Array_;
@ -26,6 +25,8 @@ use PHPStan\Type\MixedType;
use PHPStan\Type\StaticType; use PHPStan\Type\StaticType;
use PHPStan\Type\Type; use PHPStan\Type\Type;
use PHPStan\Type\TypeTraverser; use PHPStan\Type\TypeTraverser;
use Rector\NodeTypeResolver\Node\AttributeKey;
use Rector\NodeTypeResolver\PHPStan\ParametersAcceptorSelectorVariantsWrapper;
use Rector\PHPStanStaticTypeMapper\Enum\TypeKind; use Rector\PHPStanStaticTypeMapper\Enum\TypeKind;
use Rector\Reflection\ReflectionResolver; use Rector\Reflection\ReflectionResolver;
use Rector\StaticTypeMapper\StaticTypeMapper; use Rector\StaticTypeMapper\StaticTypeMapper;
@ -99,7 +100,11 @@ final class ReturnStrictTypeAnalyzer
if ($methodReflection === null) { if ($methodReflection === null) {
return null; return null;
} }
$parametersAcceptorWithPhpDocs = ParametersAcceptorSelector::combineAcceptors($methodReflection->getVariants()); $scope = $call->getAttribute(AttributeKey::SCOPE);
if (!$scope instanceof Scope) {
return null;
}
$parametersAcceptorWithPhpDocs = ParametersAcceptorSelectorVariantsWrapper::select($methodReflection, $call, $scope);
if ($parametersAcceptorWithPhpDocs instanceof FunctionVariantWithPhpDocs) { if ($parametersAcceptorWithPhpDocs instanceof FunctionVariantWithPhpDocs) {
// native return type is needed, as docblock can be false // native return type is needed, as docblock can be false
$returnType = $parametersAcceptorWithPhpDocs->getNativeReturnType(); $returnType = $parametersAcceptorWithPhpDocs->getNativeReturnType();

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api * @api
* @var string * @var string
*/ */
public const PACKAGE_VERSION = '99a79f8df18f4202f7c939b7996b9714abb78fe4'; public const PACKAGE_VERSION = '6095e3216f057fbf8dded18cf982bfab034f8086';
/** /**
* @api * @api
* @var string * @var string
*/ */
public const RELEASE_DATE = '2024-02-21 23:16:34'; public const RELEASE_DATE = '2024-02-22 02:52:54';
/** /**
* @var int * @var int
*/ */