Updated Rector to commit e68c8d23cbbdb9dbfef66133af6bb4f1857015ad

e68c8d23cb Fix CallableTypeParameterNode and IdentifierTypeParameterNode crash (#3353)
This commit is contained in:
Tomas Votruba 2023-02-07 12:32:23 +00:00
parent 1e09b81ddb
commit f397ad92ed
7 changed files with 59 additions and 18 deletions

2
vendor/autoload.php vendored
View File

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

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit5b0ca69862d434be44bbaf85cee23928
class ComposerAutoloaderInit616a216755b8ab017029b929301de442
{
private static $loader;
@ -22,17 +22,17 @@ class ComposerAutoloaderInit5b0ca69862d434be44bbaf85cee23928
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit5b0ca69862d434be44bbaf85cee23928', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit616a216755b8ab017029b929301de442', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInit5b0ca69862d434be44bbaf85cee23928', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit616a216755b8ab017029b929301de442', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit5b0ca69862d434be44bbaf85cee23928::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit616a216755b8ab017029b929301de442::getInitializer($loader));
$loader->setClassMapAuthoritative(true);
$loader->register(true);
$filesToLoad = \Composer\Autoload\ComposerStaticInit5b0ca69862d434be44bbaf85cee23928::$files;
$filesToLoad = \Composer\Autoload\ComposerStaticInit616a216755b8ab017029b929301de442::$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 ComposerStaticInit5b0ca69862d434be44bbaf85cee23928
class ComposerStaticInit616a216755b8ab017029b929301de442
{
public static $files = array (
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
@ -3089,9 +3089,9 @@ class ComposerStaticInit5b0ca69862d434be44bbaf85cee23928
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit5b0ca69862d434be44bbaf85cee23928::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit5b0ca69862d434be44bbaf85cee23928::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit5b0ca69862d434be44bbaf85cee23928::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit616a216755b8ab017029b929301de442::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit616a216755b8ab017029b929301de442::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit616a216755b8ab017029b929301de442::$classMap;
}, null, ClassLoader::class);
}

View File

@ -2059,12 +2059,12 @@
"source": {
"type": "git",
"url": "https:\/\/github.com\/rectorphp\/rector-phpunit.git",
"reference": "dcfdf20afde70255c8621828d915747b65575949"
"reference": "1ced18f1a5639d095307dd3c90be752afe09c316"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-phpunit\/zipball\/dcfdf20afde70255c8621828d915747b65575949",
"reference": "dcfdf20afde70255c8621828d915747b65575949",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-phpunit\/zipball\/1ced18f1a5639d095307dd3c90be752afe09c316",
"reference": "1ced18f1a5639d095307dd3c90be752afe09c316",
"shasum": ""
},
"require": {
@ -2093,7 +2093,7 @@
"tomasvotruba\/type-coverage": "^0.0.9",
"tomasvotruba\/unused-public": "^0.0.34"
},
"time": "2023-02-06T18:30:45+00:00",
"time": "2023-02-07T12:28:09+00:00",
"default-branch": true,
"type": "rector-extension",
"extra": {

File diff suppressed because one or more lines are too long

View File

@ -9,7 +9,7 @@ namespace Rector\RectorInstaller;
*/
final class GeneratedConfig
{
public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main ea9cf46'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 46346e2'), 'rector/rector-php-parser' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-php-parser', 'relative_install_path' => '../../rector-php-parser', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 9639ef9'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main dcfdf20'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 89e994f'));
public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main ea9cf46'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 46346e2'), 'rector/rector-php-parser' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-php-parser', 'relative_install_path' => '../../rector-php-parser', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 9639ef9'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 1ced18f'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 89e994f'));
private function __construct()
{
}

View File

@ -6,7 +6,10 @@ namespace Rector\PHPUnit\NodeFinder;
use PhpParser\Node\Stmt\Class_;
use PhpParser\Node\Stmt\ClassMethod;
use PHPStan\PhpDocParser\Ast\PhpDoc\GenericTagValueNode;
use PHPStan\Reflection\ClassReflection;
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
use Rector\Core\PhpParser\AstResolver;
use Rector\Core\Reflection\ReflectionResolver;
final class DataProviderClassMethodFinder
{
/**
@ -14,16 +17,34 @@ final class DataProviderClassMethodFinder
* @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory
*/
private $phpDocInfoFactory;
public function __construct(PhpDocInfoFactory $phpDocInfoFactory)
/**
* @readonly
* @var \Rector\Core\Reflection\ReflectionResolver
*/
private $reflectionResolver;
/**
* @readonly
* @var \Rector\Core\PhpParser\AstResolver
*/
private $astResolver;
public function __construct(PhpDocInfoFactory $phpDocInfoFactory, ReflectionResolver $reflectionResolver, AstResolver $astResolver)
{
$this->phpDocInfoFactory = $phpDocInfoFactory;
$this->reflectionResolver = $reflectionResolver;
$this->astResolver = $astResolver;
}
/**
* @return ClassMethod[]
*/
public function find(Class_ $class) : array
{
$dataProviderMethodNames = $this->resolverDataProviderClassMethodNames($class);
$parentAbstractClasses = $this->resolveParentAbstractClasses($class);
$targetClasses = \array_merge([$class], $parentAbstractClasses);
// foreach to find method names
$dataProviderMethodNames = [];
foreach ($targetClasses as $targetClass) {
$dataProviderMethodNames = \array_merge($dataProviderMethodNames, $this->resolverDataProviderClassMethodNames($targetClass));
}
$dataProviderClassMethods = [];
foreach ($dataProviderMethodNames as $dataProviderMethodName) {
$dataProviderClassMethod = $class->getMethod($dataProviderMethodName);
@ -60,4 +81,24 @@ final class DataProviderClassMethodFinder
$rawValue = $genericTagValueNode->value;
return \trim($rawValue, '()');
}
/**
* @return Class_[]
*/
private function resolveParentAbstractClasses(Class_ $class) : array
{
// resolve from parent one?
$classReflection = $this->reflectionResolver->resolveClassReflection($class);
if (!$classReflection instanceof ClassReflection) {
return [];
}
$parentClasses = [];
foreach ($classReflection->getParents() as $parentClassReflection) {
// is the top parent class? stop
if ($parentClassReflection->getName() === 'PHPUnit\\Framework\\TestCase') {
break;
}
$parentClasses[] = $this->astResolver->resolveClassFromClassReflection($parentClassReflection);
}
return $parentClasses;
}
}