Updated Rector to commit b2d6fa6ee64096cb358f8e29c490386989b4cfb0

b2d6fa6ee6 Revert recursive check on always array param on phpstan 1.10 on AddMethodCallBasedStrictParamTypeRector (#3399)
This commit is contained in:
Tomas Votruba 2023-02-22 01:54:59 +00:00
parent 908a3c39d3
commit 5d735c2311
11 changed files with 45 additions and 82 deletions

View File

@ -7,7 +7,7 @@
],
"require": {
"php": "^7.2|^8.0",
"phpstan/phpstan": "^1.9.14"
"phpstan/phpstan": "^1.10.1"
},
"autoload": {
"files": [

View File

@ -6,7 +6,6 @@ namespace Rector\TypeDeclaration\NodeAnalyzer;
use PhpParser\Node\Arg;
use PhpParser\Node\Expr\MethodCall;
use PhpParser\Node\Expr\StaticCall;
use PhpParser\Node\Stmt\ClassMethod;
use PHPStan\Reflection\ReflectionProvider;
use PHPStan\Type\MixedType;
use PHPStan\Type\NullType;
@ -15,9 +14,6 @@ use PHPStan\Type\ThisType;
use PHPStan\Type\Type;
use PHPStan\Type\TypeWithClassName;
use PHPStan\Type\UnionType;
use Rector\Core\PhpParser\AstResolver;
use Rector\Core\PhpParser\Comparing\NodeComparator;
use Rector\Core\PhpParser\Node\BetterNodeFinder;
use Rector\NodeCollector\ValueObject\ArrayCallable;
use Rector\NodeTypeResolver\NodeTypeResolver;
use Rector\NodeTypeResolver\PHPStan\Type\TypeFactory;
@ -38,29 +34,11 @@ final class CallTypesResolver
* @var \PHPStan\Reflection\ReflectionProvider
*/
private $reflectionProvider;
/**
* @readonly
* @var \Rector\Core\PhpParser\Node\BetterNodeFinder
*/
private $betterNodeFinder;
/**
* @readonly
* @var \Rector\Core\PhpParser\AstResolver
*/
private $astResolver;
/**
* @readonly
* @var \Rector\Core\PhpParser\Comparing\NodeComparator
*/
private $nodeComparator;
public function __construct(NodeTypeResolver $nodeTypeResolver, TypeFactory $typeFactory, ReflectionProvider $reflectionProvider, BetterNodeFinder $betterNodeFinder, AstResolver $astResolver, NodeComparator $nodeComparator)
public function __construct(NodeTypeResolver $nodeTypeResolver, TypeFactory $typeFactory, ReflectionProvider $reflectionProvider)
{
$this->nodeTypeResolver = $nodeTypeResolver;
$this->typeFactory = $typeFactory;
$this->reflectionProvider = $reflectionProvider;
$this->betterNodeFinder = $betterNodeFinder;
$this->astResolver = $astResolver;
$this->nodeComparator = $nodeComparator;
}
/**
* @param MethodCall[]|StaticCall[]|ArrayCallable[] $calls
@ -73,9 +51,6 @@ final class CallTypesResolver
if (!$call instanceof StaticCall && !$call instanceof MethodCall) {
continue;
}
if ($this->isRecursiveCall($call)) {
return [];
}
foreach ($call->args as $position => $arg) {
if (!$arg instanceof Arg) {
continue;
@ -86,18 +61,6 @@ final class CallTypesResolver
// unite to single type
return $this->unionToSingleType($staticTypesByArgumentPosition);
}
/**
* @param \PhpParser\Node\Expr\MethodCall|\PhpParser\Node\Expr\StaticCall $call
*/
private function isRecursiveCall($call) : bool
{
$parentClassMethod = $this->betterNodeFinder->findParentType($call, ClassMethod::class);
if (!$parentClassMethod instanceof ClassMethod) {
return \false;
}
$classMethod = $this->astResolver->resolveClassMethodFromCall($call);
return $this->nodeComparator->areNodesEqual($parentClassMethod, $classMethod);
}
private function resolveStrictArgValueType(Arg $arg) : Type
{
$argValueType = $this->nodeTypeResolver->getNativeType($arg->value);

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = '648a2f5ca994605a85e8f10279936a864eefc09c';
public const PACKAGE_VERSION = 'b2d6fa6ee64096cb358f8e29c490386989b4cfb0';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2023-02-22 00:05:09';
public const RELEASE_DATE = '2023-02-22 01:49:42';
/**
* @var int
*/

2
vendor/autoload.php vendored
View File

@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) {
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit2d7c14ddc5e543b42dee64de6325b4a2::getLoader();
return ComposerAutoloaderInitf739289358f8a6d54afc95269bcfe2d8::getLoader();

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit2d7c14ddc5e543b42dee64de6325b4a2
class ComposerAutoloaderInitf739289358f8a6d54afc95269bcfe2d8
{
private static $loader;
@ -22,17 +22,17 @@ class ComposerAutoloaderInit2d7c14ddc5e543b42dee64de6325b4a2
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit2d7c14ddc5e543b42dee64de6325b4a2', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInitf739289358f8a6d54afc95269bcfe2d8', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInit2d7c14ddc5e543b42dee64de6325b4a2', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInitf739289358f8a6d54afc95269bcfe2d8', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit2d7c14ddc5e543b42dee64de6325b4a2::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInitf739289358f8a6d54afc95269bcfe2d8::getInitializer($loader));
$loader->setClassMapAuthoritative(true);
$loader->register(true);
$filesToLoad = \Composer\Autoload\ComposerStaticInit2d7c14ddc5e543b42dee64de6325b4a2::$files;
$filesToLoad = \Composer\Autoload\ComposerStaticInitf739289358f8a6d54afc95269bcfe2d8::$files;
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;

View File

@ -4,7 +4,7 @@
namespace Composer\Autoload;
class ComposerStaticInit2d7c14ddc5e543b42dee64de6325b4a2
class ComposerStaticInitf739289358f8a6d54afc95269bcfe2d8
{
public static $files = array (
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
@ -3126,9 +3126,9 @@ class ComposerStaticInit2d7c14ddc5e543b42dee64de6325b4a2
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit2d7c14ddc5e543b42dee64de6325b4a2::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit2d7c14ddc5e543b42dee64de6325b4a2::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit2d7c14ddc5e543b42dee64de6325b4a2::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInitf739289358f8a6d54afc95269bcfe2d8::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitf739289358f8a6d54afc95269bcfe2d8::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInitf739289358f8a6d54afc95269bcfe2d8::$classMap;
}, null, ClassLoader::class);
}

View File

@ -869,17 +869,17 @@
},
{
"name": "phpstan\/phpstan",
"version": "1.10.0",
"version_normalized": "1.10.0.0",
"version": "1.10.1",
"version_normalized": "1.10.1.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/phpstan\/phpstan.git",
"reference": "71b28a67f01ac231f9a8f1ce242270bf4ec1f99c"
"reference": "1cd5fc530a8b68702f3733ad64294b2a39564198"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/phpstan\/phpstan\/zipball\/71b28a67f01ac231f9a8f1ce242270bf4ec1f99c",
"reference": "71b28a67f01ac231f9a8f1ce242270bf4ec1f99c",
"url": "https:\/\/api.github.com\/repos\/phpstan\/phpstan\/zipball\/1cd5fc530a8b68702f3733ad64294b2a39564198",
"reference": "1cd5fc530a8b68702f3733ad64294b2a39564198",
"shasum": ""
},
"require": {
@ -888,7 +888,7 @@
"conflict": {
"phpstan\/phpstan-shim": "*"
},
"time": "2023-02-21T13:50:49+00:00",
"time": "2023-02-21T21:57:23+00:00",
"bin": [
"phpstan",
"phpstan.phar"
@ -911,7 +911,7 @@
],
"support": {
"issues": "https:\/\/github.com\/phpstan\/phpstan\/issues",
"source": "https:\/\/github.com\/phpstan\/phpstan\/tree\/1.10.0"
"source": "https:\/\/github.com\/phpstan\/phpstan\/tree\/1.10.1"
},
"funding": [
{
@ -931,17 +931,17 @@
},
{
"name": "phpstan\/phpstan-phpunit",
"version": "1.3.6",
"version_normalized": "1.3.6.0",
"version": "1.3.7",
"version_normalized": "1.3.7.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/phpstan\/phpstan-phpunit.git",
"reference": "4b17a2352dd70f34bc80e4fb6147609598dd4617"
"reference": "7e43c8f77c7e419730ead01c8dc787c6bcbe0e15"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/phpstan\/phpstan-phpunit\/zipball\/4b17a2352dd70f34bc80e4fb6147609598dd4617",
"reference": "4b17a2352dd70f34bc80e4fb6147609598dd4617",
"url": "https:\/\/api.github.com\/repos\/phpstan\/phpstan-phpunit\/zipball\/7e43c8f77c7e419730ead01c8dc787c6bcbe0e15",
"reference": "7e43c8f77c7e419730ead01c8dc787c6bcbe0e15",
"shasum": ""
},
"require": {
@ -957,7 +957,7 @@
"phpstan\/phpstan-strict-rules": "^1.0",
"phpunit\/phpunit": "^9.5"
},
"time": "2023-02-21T16:56:24+00:00",
"time": "2023-02-21T18:40:15+00:00",
"type": "phpstan-extension",
"extra": {
"phpstan": {
@ -980,7 +980,7 @@
"description": "PHPUnit extensions and rules for PHPStan",
"support": {
"issues": "https:\/\/github.com\/phpstan\/phpstan-phpunit\/issues",
"source": "https:\/\/github.com\/phpstan\/phpstan-phpunit\/tree\/1.3.6"
"source": "https:\/\/github.com\/phpstan\/phpstan-phpunit\/tree\/1.3.7"
},
"install-path": "..\/phpstan\/phpstan-phpunit"
},

File diff suppressed because one or more lines are too long

View File

@ -92,12 +92,12 @@ class AssertTypeSpecifyingExtensionHelper
{
if (self::$resolvers === null) {
self::$resolvers = ['InstanceOf' => static function (Scope $scope, Arg $class, Arg $object) : ?Instanceof_ {
$classType = $scope->getType($class->value)->getClassStringObjectType();
$classNames = $classType->getObjectClassNames();
$classType = $scope->getType($class->value);
$classNames = $classType->getConstantStrings();
if (count($classNames) !== 1) {
return null;
}
return new Instanceof_($object->value, new Name($classNames[0]));
return new Instanceof_($object->value, new Name($classNames[0]->getValue()));
}, 'Same' => static function (Scope $scope, Arg $expected, Arg $actual) : Identical {
return new Identical($expected->value, $actual->value);
}, 'True' => static function (Scope $scope, Arg $actual) : Identical {

Binary file not shown.

View File

@ -1,16 +1,16 @@
-----BEGIN PGP SIGNATURE-----
iQIzBAABCgAdFiEE0yaA1ZV9xxFr4pwUzxoQjQ565yAFAmP0zCIACgkQzxoQjQ56
5yDVPBAAjOsIlFKSsJGP+LXYuQ/lhBuwigOxj6SM6ZLTBPB6MGKKTyPqXayF0Js8
qZV0XxKbHN3RxeM0L4E6nEi5Zp5bf/jeF012+40oyIk8uXl3TsEnRiLP3cyu4I4D
VBtFAZTiO8i4Rrlg0lkyLiFpzq8etL0PZvY3QePtsb6Wq7Lo0rSOWQKnJYDNc9iX
gwd7PxRFBEDC1Q2X3B1NLLcjLN0aXzF0ERjXkvLgGGedsH2+G4iVy55WsG5q2XuW
l/rMGaahIEr7P3C8yyjek+u7F3o2kzLKIKWJpLT2DzzTiqhadsHQaJhMpPOrH7I5
vSWtdlIlTfXUsS34YliNOM4XC85ZG01sZ1LJsojv6sp1MHnPId1bWJcseeRo/Vje
svFC6SKbklA9Z/5ThbG0+dALDxIPS0WAQ44/oUciTCuSJ8qIDUidDk+y0RChHrpd
itrSmO/MbgmDtKMf6gkkzKkwXnkGfaMPyAVrM8OVJbpGjqSZzSeS2Dii04b9we6H
Qo/NsQLkOQT05l4bObRhzXhQNHdpnYVtxbHHH+MrhKDA/Uo0vfbSnF7eN4l4YzDw
Putzf/wLNh/bRAyetaTcE0qaDZjR0noBdgkLlAbV0p4vTdKzzerCbt98ztmeJV+6
8ROEMSoIQLqKoVET3D4l9rfKwzO2sdNYKyjqf1j3qVsTIOKfUS4=
=XHoC
iQIzBAABCgAdFiEE0yaA1ZV9xxFr4pwUzxoQjQ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