Updated Rector to commit 20c0d2eca8

20c0d2eca8 [PHPStan 1.0] Remove ReflectionWithFilename (#1118)
This commit is contained in:
Tomas Votruba 2021-10-31 18:04:12 +00:00
parent 54f8d6dc33
commit 0420629279
13 changed files with 47 additions and 88 deletions

View File

@ -112,7 +112,7 @@ CODE_SAMPLE
return null;
}
// skip those in vendor
if ($this->vendorLocationDetector->detectFunctionLikeReflection($methodReflection)) {
if ($this->vendorLocationDetector->detectMethodReflection($methodReflection)) {
return null;
}
$spreadParameterReflections = $this->spreadVariablesCollector->resolveFromMethodReflection($methodReflection);

View File

@ -3,9 +3,7 @@
declare (strict_types=1);
namespace Rector\CodingStyle\Reflection;
use PHPStan\Reflection\FunctionReflection;
use PHPStan\Reflection\MethodReflection;
use PHPStan\Reflection\ReflectionWithFilename;
use RectorPrefix20211031\Symplify\SmartFileSystem\Normalizer\PathNormalizer;
final class VendorLocationDetector
{
@ -17,12 +15,10 @@ final class VendorLocationDetector
{
$this->pathNormalizer = $pathNormalizer;
}
/**
* @param \PHPStan\Reflection\FunctionReflection|\PHPStan\Reflection\MethodReflection|\PHPStan\Reflection\ReflectionWithFilename $reflection
*/
public function detectFunctionLikeReflection($reflection) : bool
public function detectMethodReflection(\PHPStan\Reflection\MethodReflection $methodReflection) : bool
{
$fileName = $this->resolveReflectionFileName($reflection);
$declaringClassReflection = $methodReflection->getDeclaringClass();
$fileName = $declaringClassReflection->getFileName();
// probably internal
if ($fileName === null) {
return \false;
@ -30,18 +26,4 @@ final class VendorLocationDetector
$normalizedFileName = $this->pathNormalizer->normalizePath($fileName);
return \strpos($normalizedFileName, '/vendor/') !== \false;
}
/**
* @param \PHPStan\Reflection\FunctionReflection|\PHPStan\Reflection\MethodReflection|\PHPStan\Reflection\ReflectionWithFilename $reflection
*/
private function resolveReflectionFileName($reflection) : ?string
{
if ($reflection instanceof \PHPStan\Reflection\ReflectionWithFilename) {
return $reflection->getFileName();
}
if ($reflection instanceof \PHPStan\Reflection\FunctionReflection) {
return $reflection->getFileName();
}
$declaringClassReflection = $reflection->getDeclaringClass();
return $declaringClassReflection->getFileName();
}
}

View File

@ -161,7 +161,7 @@ CODE_SAMPLE
*/
private function resolveExpectedArgParamOrderIfDifferent(\PHPStan\Reflection\MethodReflection $methodReflection, array $argsOrParams) : ?array
{
if ($this->vendorLocationDetector->detectFunctionLikeReflection($methodReflection)) {
if ($this->vendorLocationDetector->detectMethodReflection($methodReflection)) {
return null;
}
$parametersAcceptor = \PHPStan\Reflection\ParametersAcceptorSelector::selectSingle($methodReflection->getVariants());

View File

@ -16,11 +16,11 @@ final class VersionResolver
/**
* @var string
*/
public const PACKAGE_VERSION = 'da4d598bf0fc20b831e138407263b82645109bdf';
public const PACKAGE_VERSION = '20c0d2eca882793ce82b9c692ae9b475695a7c61';
/**
* @var string
*/
public const RELEASE_DATE = '2021-10-31 16:11:30';
public const RELEASE_DATE = '2021-10-31 17:44:44';
public static function resolvePackageVersion() : string
{
$process = new \RectorPrefix20211031\Symfony\Component\Process\Process(['git', 'log', '--pretty="%H"', '-n1', 'HEAD'], __DIR__);

2
vendor/autoload.php vendored
View File

@ -4,4 +4,4 @@
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit6ead72988a16b4d62b8b807662972d67::getLoader();
return ComposerAutoloaderInitf420dadddc42464f58a1fb565370ec9c::getLoader();

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit6ead72988a16b4d62b8b807662972d67
class ComposerAutoloaderInitf420dadddc42464f58a1fb565370ec9c
{
private static $loader;
@ -22,15 +22,15 @@ class ComposerAutoloaderInit6ead72988a16b4d62b8b807662972d67
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit6ead72988a16b4d62b8b807662972d67', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInitf420dadddc42464f58a1fb565370ec9c', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
spl_autoload_unregister(array('ComposerAutoloaderInit6ead72988a16b4d62b8b807662972d67', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInitf420dadddc42464f58a1fb565370ec9c', 'loadClassLoader'));
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
if ($useStaticLoader) {
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit6ead72988a16b4d62b8b807662972d67::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInitf420dadddc42464f58a1fb565370ec9c::getInitializer($loader));
} else {
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
@ -42,19 +42,19 @@ class ComposerAutoloaderInit6ead72988a16b4d62b8b807662972d67
$loader->register(true);
if ($useStaticLoader) {
$includeFiles = Composer\Autoload\ComposerStaticInit6ead72988a16b4d62b8b807662972d67::$files;
$includeFiles = Composer\Autoload\ComposerStaticInitf420dadddc42464f58a1fb565370ec9c::$files;
} else {
$includeFiles = require __DIR__ . '/autoload_files.php';
}
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequire6ead72988a16b4d62b8b807662972d67($fileIdentifier, $file);
composerRequiref420dadddc42464f58a1fb565370ec9c($fileIdentifier, $file);
}
return $loader;
}
}
function composerRequire6ead72988a16b4d62b8b807662972d67($fileIdentifier, $file)
function composerRequiref420dadddc42464f58a1fb565370ec9c($fileIdentifier, $file)
{
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
require $file;

View File

@ -4,7 +4,7 @@
namespace Composer\Autoload;
class ComposerStaticInit6ead72988a16b4d62b8b807662972d67
class ComposerStaticInitf420dadddc42464f58a1fb565370ec9c
{
public static $files = array (
'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
@ -3888,9 +3888,9 @@ class ComposerStaticInit6ead72988a16b4d62b8b807662972d67
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit6ead72988a16b4d62b8b807662972d67::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit6ead72988a16b4d62b8b807662972d67::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit6ead72988a16b4d62b8b807662972d67::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInitf420dadddc42464f58a1fb565370ec9c::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitf420dadddc42464f58a1fb565370ec9c::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInitf420dadddc42464f58a1fb565370ec9c::$classMap;
}, null, ClassLoader::class);
}

View File

@ -833,12 +833,12 @@
"source": {
"type": "git",
"url": "https:\/\/github.com\/phpstan\/phpstan.git",
"reference": "90f09b0be365c5d7619b1ccbe969fb566de89cf6"
"reference": "4453ce4f09ef4a52ff5dedbc3e36061ace5e83d2"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/phpstan\/phpstan\/zipball\/90f09b0be365c5d7619b1ccbe969fb566de89cf6",
"reference": "90f09b0be365c5d7619b1ccbe969fb566de89cf6",
"url": "https:\/\/api.github.com\/repos\/phpstan\/phpstan\/zipball\/4453ce4f09ef4a52ff5dedbc3e36061ace5e83d2",
"reference": "4453ce4f09ef4a52ff5dedbc3e36061ace5e83d2",
"shasum": ""
},
"require": {
@ -847,7 +847,7 @@
"conflict": {
"phpstan\/phpstan-shim": "*"
},
"time": "2021-10-31T14:20:02+00:00",
"time": "2021-10-31T16:21:01+00:00",
"default-branch": true,
"bin": [
"phpstan",
@ -4278,12 +4278,12 @@
"source": {
"type": "git",
"url": "https:\/\/github.com\/symplify\/package-builder.git",
"reference": "09fac6ba61ebe908911f7312b7b6449dcd3a57d1"
"reference": "7e6d72a355b51a79be3f441d4f86080a2f64a578"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/symplify\/package-builder\/zipball\/09fac6ba61ebe908911f7312b7b6449dcd3a57d1",
"reference": "09fac6ba61ebe908911f7312b7b6449dcd3a57d1",
"url": "https:\/\/api.github.com\/repos\/symplify\/package-builder\/zipball\/7e6d72a355b51a79be3f441d4f86080a2f64a578",
"reference": "7e6d72a355b51a79be3f441d4f86080a2f64a578",
"shasum": ""
},
"require": {
@ -4330,7 +4330,7 @@
"require-dev": {
"phpunit\/phpunit": "^9.5"
},
"time": "2021-10-30T00:10:09+00:00",
"time": "2021-10-31T17:28:48+00:00",
"default-branch": true,
"type": "library",
"extra": {

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -1,16 +1,16 @@
-----BEGIN PGP SIGNATURE-----
iQIzBAABCgAdFiEE0yaA1ZV9xxFr4pwUzxoQjQ565yAFAmF+phIACgkQzxoQjQ56
5yCqtw//XVPOksNf9UmM5B4tpfhe6cxD4fH4EiIN/fckbrGdntZc9K8BW7vspHWY
P7xkTDZ+E3IFKEyWMTMoLIVWvjSTb+zw4YGqgSUPbVmlne09C4ATA1bQjNlQfRVC
04dHumiF7xn3XcJn4orOfC23X4t9pd+UPUG3gBlk0PgQ0XJZ68b5AT3Wyb1syegD
zkfHChmckRYFyv/ZevVnTIYZ3TInXq1eKltIPkn0FK0v8hyT3JtAUsPBqDm8rRC9
5ZyNxAE+5krc6i3WDkDolWkStgAtOiAlDrj4eL99Gyfte+j6byzNl4R8s89lt1JO
5Ebh0TvGmgywTZesuXWBzdcThat/GG8PcNVZdNb6g8YzWB8YvR4cI30j3p04+nnx
V59x5PwN2Zq0co8YX47s+KXXz70Yb/EZyNdGQXylAC4/uuNAWJGZ9Gh71l1GQtyk
ZMRbQhfGT5VcS/DgFEDbLEQ6K3VcCROGXCmbZWRLuIIAldAICFG0WiNrP/NcA7GK
iVbw+PN1tftU8bJ2uDRqWSoCOoMrJbFLPnW9wgZsiAZg/BzhyW1LrSRVpzmLWXtI
bjYKc+jp+eE1wTma0I4M0SWMd71M4idrFxJgvXzI2fTGNx775wQCbGfZTemE/8AU
D7UPq6TOobc7UC3WbLMnmqbCWTqvmDj3i7zLVEssf56CK9xj95E=
=Qk/l
iQIzBAABCgAdFiEE0yaA1ZV9xxFr4pwUzxoQjQ565yAFAmF+wm0ACgkQzxoQjQ56
5yBMOQ/9GL6mpTscC1zSutC4AIDeBHuCGJFxA25YN27THPnUFz6lVsefaByVusd/
va0F0pW5pH0fuO0fkoTc0IrkdRZqVpyKIspJakgyXdH8uhMKv5ChLIJWGfkjAsxu
hKY92smyTiGn7UfvQGAsrS14fILqM+4IfQuCZHBFV8TsjnNDs4wIAbK1b/HmzOi5
dmr377e7cV8VY0idVPPnY2nzXgIm6B/dWfaMcdRnljO/UHg9VlWLI9uVfjX5GJsk
XkyVS7kROPLOmEKkQ8TxhgdAOzYpM642WvLBhUKVKDvfXJVzHPLozIHhq2Zd3Llj
QgB3ih7HSoulf9NRdzsc3Irgtc/5uV5CBRPbwVST6jP2ZJsg8TnW83gK3GAzeXDY
Jxi3pRV9UobjlPmOqpgghR/JTu2wR1igeGeUU/7xOidpdMKFZugnyxFfOhk3YBS8
y8e7ONYCG+05UEVzRr39B/4OER4GDiVSgtasZd5xOoOJkntOEbrDHk0fDDSPRPU+
QDlIQM5OY7+6H6NcjB7PHKu0Ybayox2HgcpEp1NnEMr9fu2WuIIR00EBYcmA9yVA
prsuxoG0sT7zqxLnkU2ZJkBwr4NxRCc4TssQ/jNcHkpW9gj+IuOnVQqkSu8PjsiA
zQvLTrCbHh4ZccKXVet/reLX/EvvvwyWFElzpRZpgAc4+UNFYvA=
=gJ4L
-----END PGP SIGNATURE-----

View File

@ -9,8 +9,8 @@ $loader = require_once __DIR__.'/autoload.php';
if (!class_exists('AutoloadIncluder', false) && !interface_exists('AutoloadIncluder', false) && !trait_exists('AutoloadIncluder', false)) {
spl_autoload_call('RectorPrefix20211031\AutoloadIncluder');
}
if (!class_exists('ComposerAutoloaderInit6ead72988a16b4d62b8b807662972d67', false) && !interface_exists('ComposerAutoloaderInit6ead72988a16b4d62b8b807662972d67', false) && !trait_exists('ComposerAutoloaderInit6ead72988a16b4d62b8b807662972d67', false)) {
spl_autoload_call('RectorPrefix20211031\ComposerAutoloaderInit6ead72988a16b4d62b8b807662972d67');
if (!class_exists('ComposerAutoloaderInitf420dadddc42464f58a1fb565370ec9c', false) && !interface_exists('ComposerAutoloaderInitf420dadddc42464f58a1fb565370ec9c', false) && !trait_exists('ComposerAutoloaderInitf420dadddc42464f58a1fb565370ec9c', false)) {
spl_autoload_call('RectorPrefix20211031\ComposerAutoloaderInitf420dadddc42464f58a1fb565370ec9c');
}
if (!class_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false) && !interface_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false) && !trait_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false)) {
spl_autoload_call('RectorPrefix20211031\Helmich\TypoScriptParser\Parser\AST\Statement');
@ -3306,9 +3306,9 @@ if (!function_exists('print_node')) {
return \RectorPrefix20211031\print_node(...func_get_args());
}
}
if (!function_exists('composerRequire6ead72988a16b4d62b8b807662972d67')) {
function composerRequire6ead72988a16b4d62b8b807662972d67() {
return \RectorPrefix20211031\composerRequire6ead72988a16b4d62b8b807662972d67(...func_get_args());
if (!function_exists('composerRequiref420dadddc42464f58a1fb565370ec9c')) {
function composerRequiref420dadddc42464f58a1fb565370ec9c() {
return \RectorPrefix20211031\composerRequiref420dadddc42464f58a1fb565370ec9c(...func_get_args());
}
}
if (!function_exists('parseArgs')) {

View File

@ -29,10 +29,6 @@ abstract class AbstractKernelTestCase extends \RectorPrefix20211031\PHPUnit\Fram
* @var \Symfony\Component\DependencyInjection\ContainerInterface|null
*/
protected static $container;
/**
* @var array<string, KernelInterface>
*/
private static $kernelsByHash = [];
/**
* @param class-string<KernelInterface> $kernelClass
* @param string[]|SmartFileInfo[] $configs
@ -47,25 +43,6 @@ abstract class AbstractKernelTestCase extends \RectorPrefix20211031\PHPUnit\Fram
static::$kernel = $bootedKernel;
return $bootedKernel;
}
/**
* @param class-string<KernelInterface> $kernelClass
* @param string[]|SmartFileInfo[] $configs
*/
protected function bootKernelWithConfigsAndStaticCache($kernelClass, $configs) : \RectorPrefix20211031\Symfony\Component\HttpKernel\KernelInterface
{
// unwrap file infos to real paths
$configFilePaths = $this->resolveConfigFilePaths($configs);
$configsHash = $this->resolveConfigsHash($configFilePaths);
if (isset(self::$kernelsByHash[$configsHash])) {
static::$kernel = self::$kernelsByHash[$configsHash];
self::$container = static::$kernel->getContainer();
} else {
$bootedKernel = $this->createBootedKernelFromConfigs($kernelClass, $configsHash, $configFilePaths);
static::$kernel = $bootedKernel;
self::$kernelsByHash[$configsHash] = $bootedKernel;
}
return static::$kernel;
}
/**
* Syntax sugger to remove static from the test cases vission
*
@ -76,7 +53,7 @@ abstract class AbstractKernelTestCase extends \RectorPrefix20211031\PHPUnit\Fram
protected function getService($type)
{
if (self::$container === null) {
throw new \RectorPrefix20211031\Symplify\SymplifyKernel\Exception\ShouldNotHappenException('First, crewate container with booKernel(KernelClass::class)');
throw new \RectorPrefix20211031\Symplify\SymplifyKernel\Exception\ShouldNotHappenException('First, create container with booKernel(KernelClass::class)');
}
$service = self::$container->get($type);
if ($service === null) {