mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-18 22:08:00 +01:00
Updated Rector to commit 6a3f274f2458e74d96bb365d78aef6de2a8e2ef8
6a3f274f24
bump deps (#301)
This commit is contained in:
parent
2037399677
commit
9a8c076100
@ -26,7 +26,7 @@ final class CurrentAndParentClassMethodComparator
|
||||
/**
|
||||
* @var \Rector\NodeTypeResolver\MethodParameterTypeResolver
|
||||
*/
|
||||
private $methodReflectionProvider;
|
||||
private $methodParameterTypeResolver;
|
||||
/**
|
||||
* @var \Rector\DeadCode\Comparator\Parameter\ParameterDefaultsComparator
|
||||
*/
|
||||
@ -39,10 +39,10 @@ final class CurrentAndParentClassMethodComparator
|
||||
* @var \Rector\Core\PhpParser\Comparing\NodeComparator
|
||||
*/
|
||||
private $nodeComparator;
|
||||
public function __construct(\Rector\NodeNameResolver\NodeNameResolver $nodeNameResolver, \Rector\NodeTypeResolver\MethodParameterTypeResolver $methodReflectionProvider, \Rector\DeadCode\Comparator\Parameter\ParameterDefaultsComparator $parameterDefaultsComparator, \Rector\DeadCode\Comparator\Parameter\ParameterTypeComparator $parameterTypeComparator, \Rector\Core\PhpParser\Comparing\NodeComparator $nodeComparator)
|
||||
public function __construct(\Rector\NodeNameResolver\NodeNameResolver $nodeNameResolver, \Rector\NodeTypeResolver\MethodParameterTypeResolver $methodParameterTypeResolver, \Rector\DeadCode\Comparator\Parameter\ParameterDefaultsComparator $parameterDefaultsComparator, \Rector\DeadCode\Comparator\Parameter\ParameterTypeComparator $parameterTypeComparator, \Rector\Core\PhpParser\Comparing\NodeComparator $nodeComparator)
|
||||
{
|
||||
$this->nodeNameResolver = $nodeNameResolver;
|
||||
$this->methodReflectionProvider = $methodReflectionProvider;
|
||||
$this->methodParameterTypeResolver = $methodParameterTypeResolver;
|
||||
$this->parameterDefaultsComparator = $parameterDefaultsComparator;
|
||||
$this->parameterTypeComparator = $parameterTypeComparator;
|
||||
$this->nodeComparator = $nodeComparator;
|
||||
@ -145,7 +145,7 @@ final class CurrentAndParentClassMethodComparator
|
||||
}
|
||||
private function areParameterDefaultsDifferent(\PhpParser\Node\Stmt\ClassMethod $classMethod, \PHPStan\Reflection\MethodReflection $methodReflection) : bool
|
||||
{
|
||||
$parameterReflections = $this->methodReflectionProvider->getParameterReflectionsFromMethodReflection($methodReflection);
|
||||
$parameterReflections = $this->methodParameterTypeResolver->getParameterReflectionsFromMethodReflection($methodReflection);
|
||||
foreach ($parameterReflections as $key => $parameterReflection) {
|
||||
if (!isset($classMethod->params[$key])) {
|
||||
if ($parameterReflection->getDefaultValue() !== null) {
|
||||
|
@ -11,15 +11,15 @@ final class ParameterTypeComparator
|
||||
/**
|
||||
* @var \Rector\NodeTypeResolver\MethodParameterTypeResolver
|
||||
*/
|
||||
private $methodReflectionProvider;
|
||||
public function __construct(\Rector\NodeTypeResolver\MethodParameterTypeResolver $methodReflectionProvider)
|
||||
private $methodParameterTypeResolver;
|
||||
public function __construct(\Rector\NodeTypeResolver\MethodParameterTypeResolver $methodParameterTypeResolver)
|
||||
{
|
||||
$this->methodReflectionProvider = $methodReflectionProvider;
|
||||
$this->methodParameterTypeResolver = $methodParameterTypeResolver;
|
||||
}
|
||||
public function compareCurrentClassMethodAndParentStaticCall(\PhpParser\Node\Stmt\ClassMethod $classMethod, \PhpParser\Node\Expr\StaticCall $staticCall) : bool
|
||||
{
|
||||
$currentParameterTypes = $this->methodReflectionProvider->provideParameterTypesByClassMethod($classMethod);
|
||||
$parentParameterTypes = $this->methodReflectionProvider->provideParameterTypesByStaticCall($staticCall);
|
||||
$currentParameterTypes = $this->methodParameterTypeResolver->provideParameterTypesByClassMethod($classMethod);
|
||||
$parentParameterTypes = $this->methodParameterTypeResolver->provideParameterTypesByStaticCall($staticCall);
|
||||
foreach ($currentParameterTypes as $key => $currentParameterType) {
|
||||
if (!isset($parentParameterTypes[$key])) {
|
||||
continue;
|
||||
|
@ -12,7 +12,6 @@ use PHPStan\Type\ObjectType;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\Core\Reflection\ReflectionResolver;
|
||||
use Rector\NodeCollector\StaticAnalyzer;
|
||||
use Rector\NodeTypeResolver\MethodParameterTypeResolver;
|
||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
@ -26,18 +25,13 @@ final class ThisCallOnStaticMethodToStaticCallRector extends \Rector\Core\Rector
|
||||
* @var \Rector\NodeCollector\StaticAnalyzer
|
||||
*/
|
||||
private $staticAnalyzer;
|
||||
/**
|
||||
* @var \Rector\NodeTypeResolver\MethodParameterTypeResolver
|
||||
*/
|
||||
private $methodReflectionProvider;
|
||||
/**
|
||||
* @var \Rector\Core\Reflection\ReflectionResolver
|
||||
*/
|
||||
private $reflectionResolver;
|
||||
public function __construct(\Rector\NodeCollector\StaticAnalyzer $staticAnalyzer, \Rector\NodeTypeResolver\MethodParameterTypeResolver $methodReflectionProvider, \Rector\Core\Reflection\ReflectionResolver $reflectionResolver)
|
||||
public function __construct(\Rector\NodeCollector\StaticAnalyzer $staticAnalyzer, \Rector\Core\Reflection\ReflectionResolver $reflectionResolver)
|
||||
{
|
||||
$this->staticAnalyzer = $staticAnalyzer;
|
||||
$this->methodReflectionProvider = $methodReflectionProvider;
|
||||
$this->reflectionResolver = $reflectionResolver;
|
||||
}
|
||||
public function getRuleDefinition() : \Symplify\RuleDocGenerator\ValueObject\RuleDefinition
|
||||
|
@ -8,6 +8,7 @@ use PhpParser\Node\Stmt\ClassMethod;
|
||||
use Rector\Core\Reflection\ReflectionResolver;
|
||||
use Rector\Core\ValueObject\MethodName;
|
||||
use Rector\Testing\PHPUnit\StaticPHPUnitEnvironment;
|
||||
use ReflectionMethod;
|
||||
use ReflectionNamedType;
|
||||
/**
|
||||
* Decorate setUp() and tearDown() with "void" when local TestClass class uses them
|
||||
@ -29,7 +30,7 @@ final class PHPUnitTypeDeclarationDecorator
|
||||
return;
|
||||
}
|
||||
$reflectionMethod = $this->reflectionResolver->resolveNativeClassMethodReflection('PHPUnit\\Framework\\TestCase', \Rector\Core\ValueObject\MethodName::SET_UP);
|
||||
if ($reflectionMethod === null) {
|
||||
if (!$reflectionMethod instanceof \ReflectionMethod) {
|
||||
return;
|
||||
}
|
||||
if (!$reflectionMethod->hasReturnType()) {
|
||||
|
@ -16,11 +16,11 @@ final class VersionResolver
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '04981badaadd4a5950b85cea5a39b9c03cb28c68';
|
||||
public const PACKAGE_VERSION = '6a3f274f2458e74d96bb365d78aef6de2a8e2ef8';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2021-06-26 13:17:39';
|
||||
public const RELEASE_DATE = '2021-06-26 14:20:46';
|
||||
public static function resolvePackageVersion() : string
|
||||
{
|
||||
$process = new \RectorPrefix20210626\Symfony\Component\Process\Process(['git', 'log', '--pretty="%H"', '-n1', 'HEAD'], __DIR__);
|
||||
|
@ -5,6 +5,7 @@ namespace Rector\Core\PhpParser;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr\MethodCall;
|
||||
use PhpParser\Node\Expr\StaticCall;
|
||||
use PhpParser\Node\Stmt\Class_;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
use PhpParser\Node\Stmt\Function_;
|
||||
@ -144,19 +145,26 @@ final class AstResolver
|
||||
}
|
||||
public function resolveClassMethodFromMethodCall(\PhpParser\Node\Expr\MethodCall $methodCall) : ?\PhpParser\Node\Stmt\ClassMethod
|
||||
{
|
||||
$callerStaticType = $this->nodeTypeResolver->getStaticType($methodCall->var);
|
||||
return $this->resolveClassMethodFromCall($methodCall);
|
||||
}
|
||||
/**
|
||||
* @param \PhpParser\Node\Expr\MethodCall|\PhpParser\Node\Expr\StaticCall $call
|
||||
*/
|
||||
public function resolveClassMethodFromCall($call) : ?\PhpParser\Node\Stmt\ClassMethod
|
||||
{
|
||||
if ($call instanceof \PhpParser\Node\Expr\MethodCall) {
|
||||
$callerStaticType = $this->nodeTypeResolver->resolve($call->var);
|
||||
} else {
|
||||
$callerStaticType = $this->nodeTypeResolver->resolve($call->class);
|
||||
}
|
||||
if (!$callerStaticType instanceof \PHPStan\Type\TypeWithClassName) {
|
||||
return null;
|
||||
}
|
||||
$methodName = $this->nodeNameResolver->getName($methodCall->name);
|
||||
$methodName = $this->nodeNameResolver->getName($call->name);
|
||||
if ($methodName === null) {
|
||||
return null;
|
||||
}
|
||||
$methodReflection = $this->reflectionResolver->resolveMethodReflection($callerStaticType->getClassName(), $methodName);
|
||||
if ($methodReflection === null) {
|
||||
return null;
|
||||
}
|
||||
return $this->resolveClassMethodFromMethodReflection($methodReflection);
|
||||
return $this->resolveClassMethod($callerStaticType->getClassName(), $methodName);
|
||||
}
|
||||
private function resolveClassFromClassReflection(\PHPStan\Reflection\ClassReflection $classReflection, string $className) : ?\PhpParser\Node\Stmt\Class_
|
||||
{
|
||||
|
2
vendor/autoload.php
vendored
2
vendor/autoload.php
vendored
@ -4,4 +4,4 @@
|
||||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInit9380aed6d13833c846de1f471f6fda33::getLoader();
|
||||
return ComposerAutoloaderInit837da7d5638942e228c6f2fe5261416f::getLoader();
|
||||
|
14
vendor/composer/autoload_real.php
vendored
14
vendor/composer/autoload_real.php
vendored
@ -2,7 +2,7 @@
|
||||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInit9380aed6d13833c846de1f471f6fda33
|
||||
class ComposerAutoloaderInit837da7d5638942e228c6f2fe5261416f
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
@ -22,15 +22,15 @@ class ComposerAutoloaderInit9380aed6d13833c846de1f471f6fda33
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit9380aed6d13833c846de1f471f6fda33', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit837da7d5638942e228c6f2fe5261416f', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit9380aed6d13833c846de1f471f6fda33', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit837da7d5638942e228c6f2fe5261416f', '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\ComposerStaticInit9380aed6d13833c846de1f471f6fda33::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit837da7d5638942e228c6f2fe5261416f::getInitializer($loader));
|
||||
} else {
|
||||
$classMap = require __DIR__ . '/autoload_classmap.php';
|
||||
if ($classMap) {
|
||||
@ -42,19 +42,19 @@ class ComposerAutoloaderInit9380aed6d13833c846de1f471f6fda33
|
||||
$loader->register(true);
|
||||
|
||||
if ($useStaticLoader) {
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInit9380aed6d13833c846de1f471f6fda33::$files;
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInit837da7d5638942e228c6f2fe5261416f::$files;
|
||||
} else {
|
||||
$includeFiles = require __DIR__ . '/autoload_files.php';
|
||||
}
|
||||
foreach ($includeFiles as $fileIdentifier => $file) {
|
||||
composerRequire9380aed6d13833c846de1f471f6fda33($fileIdentifier, $file);
|
||||
composerRequire837da7d5638942e228c6f2fe5261416f($fileIdentifier, $file);
|
||||
}
|
||||
|
||||
return $loader;
|
||||
}
|
||||
}
|
||||
|
||||
function composerRequire9380aed6d13833c846de1f471f6fda33($fileIdentifier, $file)
|
||||
function composerRequire837da7d5638942e228c6f2fe5261416f($fileIdentifier, $file)
|
||||
{
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
require $file;
|
||||
|
8
vendor/composer/autoload_static.php
vendored
8
vendor/composer/autoload_static.php
vendored
@ -4,7 +4,7 @@
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInit9380aed6d13833c846de1f471f6fda33
|
||||
class ComposerStaticInit837da7d5638942e228c6f2fe5261416f
|
||||
{
|
||||
public static $files = array (
|
||||
'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
|
||||
@ -3834,9 +3834,9 @@ class ComposerStaticInit9380aed6d13833c846de1f471f6fda33
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit9380aed6d13833c846de1f471f6fda33::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit9380aed6d13833c846de1f471f6fda33::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit9380aed6d13833c846de1f471f6fda33::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit837da7d5638942e228c6f2fe5261416f::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit837da7d5638942e228c6f2fe5261416f::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit837da7d5638942e228c6f2fe5261416f::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
30
vendor/composer/installed.json
vendored
30
vendor/composer/installed.json
vendored
@ -1288,17 +1288,17 @@
|
||||
},
|
||||
{
|
||||
"name": "rector\/rector-nette",
|
||||
"version": "0.11.9",
|
||||
"version_normalized": "0.11.9.0",
|
||||
"version": "0.11.10",
|
||||
"version_normalized": "0.11.10.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/rectorphp\/rector-nette.git",
|
||||
"reference": "a8ab801753c9ddd54790be6ec74e5195276b62b2"
|
||||
"reference": "f014b55cf626a0257f70a3cf42913a002de59001"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-nette\/zipball\/a8ab801753c9ddd54790be6ec74e5195276b62b2",
|
||||
"reference": "a8ab801753c9ddd54790be6ec74e5195276b62b2",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-nette\/zipball\/f014b55cf626a0257f70a3cf42913a002de59001",
|
||||
"reference": "f014b55cf626a0257f70a3cf42913a002de59001",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -1324,7 +1324,7 @@
|
||||
"symplify\/phpstan-rules": "^9.3",
|
||||
"symplify\/rule-doc-generator": "^9.3"
|
||||
},
|
||||
"time": "2021-06-26T11:35:36+00:00",
|
||||
"time": "2021-06-26T11:53:53+00:00",
|
||||
"type": "rector-extension",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
@ -1349,23 +1349,23 @@
|
||||
"description": "Rector upgrades rules for Nette Framework",
|
||||
"support": {
|
||||
"issues": "https:\/\/github.com\/rectorphp\/rector-nette\/issues",
|
||||
"source": "https:\/\/github.com\/rectorphp\/rector-nette\/tree\/0.11.9"
|
||||
"source": "https:\/\/github.com\/rectorphp\/rector-nette\/tree\/0.11.10"
|
||||
},
|
||||
"install-path": "..\/rector\/rector-nette"
|
||||
},
|
||||
{
|
||||
"name": "rector\/rector-phpunit",
|
||||
"version": "0.11.2",
|
||||
"version_normalized": "0.11.2.0",
|
||||
"version": "0.11.3",
|
||||
"version_normalized": "0.11.3.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/rectorphp\/rector-phpunit.git",
|
||||
"reference": "83a8f9bb9ba3c76da4ec7cdd27130be8bba56105"
|
||||
"reference": "99805ade54e87c7cf9c836be4f2bb477822bfc1a"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-phpunit\/zipball\/83a8f9bb9ba3c76da4ec7cdd27130be8bba56105",
|
||||
"reference": "83a8f9bb9ba3c76da4ec7cdd27130be8bba56105",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-phpunit\/zipball\/99805ade54e87c7cf9c836be4f2bb477822bfc1a",
|
||||
"reference": "99805ade54e87c7cf9c836be4f2bb477822bfc1a",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -1378,13 +1378,13 @@
|
||||
"phpstan\/extension-installer": "^1.1",
|
||||
"phpunit\/phpunit": "^9.5",
|
||||
"rector\/rector-phpstan-rules": "^0.2.6",
|
||||
"rector\/rector-src": "^0.11",
|
||||
"rector\/rector-src": "dev-main",
|
||||
"symplify\/easy-coding-standard": "^9.3",
|
||||
"symplify\/phpstan-extensions": "^9.3",
|
||||
"symplify\/phpstan-rules": "^9.2",
|
||||
"symplify\/rule-doc-generator": "^9.3"
|
||||
},
|
||||
"time": "2021-06-24T16:34:55+00:00",
|
||||
"time": "2021-06-26T12:01:58+00:00",
|
||||
"type": "rector-extension",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
@ -1409,7 +1409,7 @@
|
||||
"description": "Rector upgrades rules for PHPUnit",
|
||||
"support": {
|
||||
"issues": "https:\/\/github.com\/rectorphp\/rector-phpunit\/issues",
|
||||
"source": "https:\/\/github.com\/rectorphp\/rector-phpunit\/tree\/0.11.2"
|
||||
"source": "https:\/\/github.com\/rectorphp\/rector-phpunit\/tree\/0.11.3"
|
||||
},
|
||||
"install-path": "..\/rector\/rector-phpunit"
|
||||
},
|
||||
|
2
vendor/composer/installed.php
vendored
2
vendor/composer/installed.php
vendored
File diff suppressed because one or more lines are too long
@ -9,7 +9,7 @@ namespace Rector\RectorInstaller;
|
||||
*/
|
||||
final class GeneratedConfig
|
||||
{
|
||||
public const EXTENSIONS = array('rector/rector-cakephp' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-cakephp', 'relative_install_path' => '../../rector-cakephp', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.3'), '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' => '0.11.6'), 'rector/rector-laravel' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-laravel', 'relative_install_path' => '../../rector-laravel', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.2'), 'rector/rector-nette' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-nette', 'relative_install_path' => '../../rector-nette', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.9'), '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' => '0.11.2'), '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' => '0.11.7'), 'ssch/typo3-rector' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/ssch/typo3-rector', 'relative_install_path' => '../../../ssch/typo3-rector', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'v0.11.17'));
|
||||
public const EXTENSIONS = array('rector/rector-cakephp' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-cakephp', 'relative_install_path' => '../../rector-cakephp', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.3'), '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' => '0.11.6'), 'rector/rector-laravel' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-laravel', 'relative_install_path' => '../../rector-laravel', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.2'), 'rector/rector-nette' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-nette', 'relative_install_path' => '../../rector-nette', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.10'), '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' => '0.11.3'), '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' => '0.11.7'), 'ssch/typo3-rector' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/ssch/typo3-rector', 'relative_install_path' => '../../../ssch/typo3-rector', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'v0.11.17'));
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
@ -8,7 +8,6 @@ use PhpParser\Node\Expr\ArrayDimFetch;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
use PHPStan\Type\TypeWithClassName;
|
||||
use Rector\Core\PhpParser\AstResolver;
|
||||
use Rector\Core\Reflection\ReflectionResolver;
|
||||
use Rector\Nette\Contract\FormControlTypeResolverInterface;
|
||||
use Rector\Nette\Naming\NetteControlNaming;
|
||||
use Rector\Nette\NodeAnalyzer\ControlDimFetchAnalyzer;
|
||||
@ -32,21 +31,16 @@ final class ArrayDimFetchControlTypeResolver implements \Rector\Nette\Contract\F
|
||||
* @var \Rector\TypeDeclaration\TypeInferer\ReturnTypeInferer
|
||||
*/
|
||||
private $returnTypeInferer;
|
||||
/**
|
||||
* @var \Rector\Core\Reflection\ReflectionResolver
|
||||
*/
|
||||
private $reflectionResolver;
|
||||
/**
|
||||
* @var \Rector\Core\PhpParser\AstResolver
|
||||
*/
|
||||
private $astResolver;
|
||||
public function __construct(\Rector\Nette\NodeAnalyzer\ControlDimFetchAnalyzer $controlDimFetchAnalyzer, \Rector\Nette\Naming\NetteControlNaming $netteControlNaming, \Rector\NodeTypeResolver\NodeTypeResolver $nodeTypeResolver, \Rector\TypeDeclaration\TypeInferer\ReturnTypeInferer $returnTypeInferer, \Rector\Core\Reflection\ReflectionResolver $reflectionResolver, \Rector\Core\PhpParser\AstResolver $astResolver)
|
||||
public function __construct(\Rector\Nette\NodeAnalyzer\ControlDimFetchAnalyzer $controlDimFetchAnalyzer, \Rector\Nette\Naming\NetteControlNaming $netteControlNaming, \Rector\NodeTypeResolver\NodeTypeResolver $nodeTypeResolver, \Rector\TypeDeclaration\TypeInferer\ReturnTypeInferer $returnTypeInferer, \Rector\Core\PhpParser\AstResolver $astResolver)
|
||||
{
|
||||
$this->controlDimFetchAnalyzer = $controlDimFetchAnalyzer;
|
||||
$this->netteControlNaming = $netteControlNaming;
|
||||
$this->nodeTypeResolver = $nodeTypeResolver;
|
||||
$this->returnTypeInferer = $returnTypeInferer;
|
||||
$this->reflectionResolver = $reflectionResolver;
|
||||
$this->astResolver = $astResolver;
|
||||
}
|
||||
/**
|
||||
|
@ -9,7 +9,6 @@ use PHPStan\Reflection\ClassReflection;
|
||||
use PHPStan\Reflection\ReflectionProvider;
|
||||
use PHPStan\Type\TypeWithClassName;
|
||||
use Rector\Core\PhpParser\AstResolver;
|
||||
use Rector\Core\Reflection\ReflectionResolver;
|
||||
use Rector\Core\ValueObject\MethodName;
|
||||
use Rector\Nette\Contract\FormControlTypeResolverInterface;
|
||||
use Rector\Nette\NodeResolver\MethodNamesByInputNamesResolver;
|
||||
@ -33,20 +32,15 @@ final class MagicNetteFactoryInterfaceFormControlTypeResolver implements \Rector
|
||||
* @var \PHPStan\Reflection\ReflectionProvider
|
||||
*/
|
||||
private $reflectionProvider;
|
||||
/**
|
||||
* @var \Rector\Core\Reflection\ReflectionResolver
|
||||
*/
|
||||
private $reflectionResolver;
|
||||
/**
|
||||
* @var \Rector\Core\PhpParser\AstResolver
|
||||
*/
|
||||
private $astResolver;
|
||||
public function __construct(\Rector\NodeNameResolver\NodeNameResolver $nodeNameResolver, \Rector\NodeTypeResolver\NodeTypeResolver $nodeTypeResolver, \PHPStan\Reflection\ReflectionProvider $reflectionProvider, \Rector\Core\Reflection\ReflectionResolver $reflectionResolver, \Rector\Core\PhpParser\AstResolver $astResolver)
|
||||
public function __construct(\Rector\NodeNameResolver\NodeNameResolver $nodeNameResolver, \Rector\NodeTypeResolver\NodeTypeResolver $nodeTypeResolver, \PHPStan\Reflection\ReflectionProvider $reflectionProvider, \Rector\Core\PhpParser\AstResolver $astResolver)
|
||||
{
|
||||
$this->nodeNameResolver = $nodeNameResolver;
|
||||
$this->nodeTypeResolver = $nodeTypeResolver;
|
||||
$this->reflectionProvider = $reflectionProvider;
|
||||
$this->reflectionResolver = $reflectionResolver;
|
||||
$this->astResolver = $astResolver;
|
||||
}
|
||||
/**
|
||||
|
@ -6,7 +6,6 @@ namespace Rector\Nette\FormControlTypeResolver;
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr\New_;
|
||||
use Rector\Core\PhpParser\AstResolver;
|
||||
use Rector\Core\Reflection\ReflectionResolver;
|
||||
use Rector\Core\ValueObject\MethodName;
|
||||
use Rector\Nette\Contract\FormControlTypeResolverInterface;
|
||||
use Rector\Nette\NodeResolver\MethodNamesByInputNamesResolver;
|
||||
@ -21,18 +20,13 @@ final class NewFormControlTypeResolver implements \Rector\Nette\Contract\FormCon
|
||||
* @var \Rector\NodeNameResolver\NodeNameResolver
|
||||
*/
|
||||
private $nodeNameResolver;
|
||||
/**
|
||||
* @var \Rector\Core\Reflection\ReflectionResolver
|
||||
*/
|
||||
private $reflectionResolver;
|
||||
/**
|
||||
* @var \Rector\Core\PhpParser\AstResolver
|
||||
*/
|
||||
private $astResolver;
|
||||
public function __construct(\Rector\NodeNameResolver\NodeNameResolver $nodeNameResolver, \Rector\Core\Reflection\ReflectionResolver $reflectionResolver, \Rector\Core\PhpParser\AstResolver $astResolver)
|
||||
public function __construct(\Rector\NodeNameResolver\NodeNameResolver $nodeNameResolver, \Rector\Core\PhpParser\AstResolver $astResolver)
|
||||
{
|
||||
$this->nodeNameResolver = $nodeNameResolver;
|
||||
$this->reflectionResolver = $reflectionResolver;
|
||||
$this->astResolver = $astResolver;
|
||||
}
|
||||
/**
|
||||
|
@ -8,7 +8,6 @@ use PhpParser\Node\Expr\Variable;
|
||||
use PHPStan\Reflection\ReflectionProvider;
|
||||
use PHPStan\Type\TypeWithClassName;
|
||||
use Rector\Core\PhpParser\AstResolver;
|
||||
use Rector\Core\Reflection\ReflectionResolver;
|
||||
use Rector\Core\ValueObject\MethodName;
|
||||
use Rector\Nette\Contract\FormControlTypeResolverInterface;
|
||||
use Rector\Nette\NodeResolver\MethodNamesByInputNamesResolver;
|
||||
@ -32,20 +31,15 @@ final class VariableConstructorFormControlTypeResolver implements \Rector\Nette\
|
||||
* @var \PHPStan\Reflection\ReflectionProvider
|
||||
*/
|
||||
private $reflectionProvider;
|
||||
/**
|
||||
* @var \Rector\Core\Reflection\ReflectionResolver
|
||||
*/
|
||||
private $reflectionResolver;
|
||||
/**
|
||||
* @var \Rector\Core\PhpParser\AstResolver
|
||||
*/
|
||||
private $astResolver;
|
||||
public function __construct(\Rector\NodeTypeResolver\NodeTypeResolver $nodeTypeResolver, \Rector\NodeNameResolver\NodeNameResolver $nodeNameResolver, \PHPStan\Reflection\ReflectionProvider $reflectionProvider, \Rector\Core\Reflection\ReflectionResolver $reflectionResolver, \Rector\Core\PhpParser\AstResolver $astResolver)
|
||||
public function __construct(\Rector\NodeTypeResolver\NodeTypeResolver $nodeTypeResolver, \Rector\NodeNameResolver\NodeNameResolver $nodeNameResolver, \PHPStan\Reflection\ReflectionProvider $reflectionProvider, \Rector\Core\PhpParser\AstResolver $astResolver)
|
||||
{
|
||||
$this->nodeTypeResolver = $nodeTypeResolver;
|
||||
$this->nodeNameResolver = $nodeNameResolver;
|
||||
$this->reflectionProvider = $reflectionProvider;
|
||||
$this->reflectionResolver = $reflectionResolver;
|
||||
$this->astResolver = $astResolver;
|
||||
}
|
||||
/**
|
||||
|
2
vendor/rector/rector-phpunit/composer.json
vendored
2
vendor/rector/rector-phpunit/composer.json
vendored
@ -7,7 +7,7 @@
|
||||
"php": ">=8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"rector\/rector-src": "^0.11",
|
||||
"rector\/rector-src": "dev-main",
|
||||
"phpunit\/phpunit": "^9.5",
|
||||
"symplify\/phpstan-rules": "^9.2",
|
||||
"symplify\/phpstan-extensions": "^9.3",
|
||||
|
@ -9,16 +9,12 @@ use PhpParser\Node\Expr\StaticCall;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\GenericTagValueNode;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode;
|
||||
use Rector\Core\PHPStan\Reflection\CallReflectionResolver;
|
||||
use PHPStan\Type\TypeWithClassName;
|
||||
use Rector\Core\PhpParser\AstResolver;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\Core\Reflection\ClassMethodReflectionFactory;
|
||||
use Rector\Core\Reflection\FunctionLikeReflectionParser;
|
||||
use Rector\FileSystemRector\Parser\FileInfoParser;
|
||||
use Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer;
|
||||
use ReflectionMethod;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
/**
|
||||
* @see https://phpunit.readthedocs.io/en/7.3/annotations.html#doesnotperformassertions
|
||||
* @see https://github.com/sebastianbergmann/phpunit/issues/2484
|
||||
@ -41,37 +37,18 @@ final class AddDoesNotPerformAssertionToNonAssertingTestRector extends \Rector\C
|
||||
* @var bool[]
|
||||
*/
|
||||
private $containsAssertCallByClassMethod = [];
|
||||
/**
|
||||
* @var ClassMethod[][]|null[][]
|
||||
*/
|
||||
private $analyzedMethodsInFileName = [];
|
||||
/**
|
||||
* @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer
|
||||
*/
|
||||
private $testsNodeAnalyzer;
|
||||
/**
|
||||
* @var \Rector\Core\Reflection\ClassMethodReflectionFactory
|
||||
* @var \Rector\Core\PhpParser\AstResolver
|
||||
*/
|
||||
private $classMethodReflectionFactory;
|
||||
/**
|
||||
* @var \Rector\FileSystemRector\Parser\FileInfoParser
|
||||
*/
|
||||
private $fileInfoParser;
|
||||
/**
|
||||
* @var \Rector\Core\PHPStan\Reflection\CallReflectionResolver
|
||||
*/
|
||||
private $callReflectionResolver;
|
||||
/**
|
||||
* @var \Rector\Core\Reflection\FunctionLikeReflectionParser
|
||||
*/
|
||||
private $functionLikeReflectionParser;
|
||||
public function __construct(\Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer $testsNodeAnalyzer, \Rector\Core\Reflection\ClassMethodReflectionFactory $classMethodReflectionFactory, \Rector\FileSystemRector\Parser\FileInfoParser $fileInfoParser, \Rector\Core\PHPStan\Reflection\CallReflectionResolver $callReflectionResolver, \Rector\Core\Reflection\FunctionLikeReflectionParser $functionLikeReflectionParser)
|
||||
private $astResolver;
|
||||
public function __construct(\Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer $testsNodeAnalyzer, \Rector\Core\PhpParser\AstResolver $astResolver)
|
||||
{
|
||||
$this->testsNodeAnalyzer = $testsNodeAnalyzer;
|
||||
$this->classMethodReflectionFactory = $classMethodReflectionFactory;
|
||||
$this->fileInfoParser = $fileInfoParser;
|
||||
$this->callReflectionResolver = $callReflectionResolver;
|
||||
$this->functionLikeReflectionParser = $functionLikeReflectionParser;
|
||||
$this->astResolver = $astResolver;
|
||||
}
|
||||
public function getRuleDefinition() : \Symplify\RuleDocGenerator\ValueObject\RuleDefinition
|
||||
{
|
||||
@ -194,7 +171,7 @@ CODE_SAMPLE
|
||||
if (!$node instanceof \PhpParser\Node\Expr\MethodCall && !$node instanceof \PhpParser\Node\Expr\StaticCall) {
|
||||
return \false;
|
||||
}
|
||||
$classMethod = $this->findClassMethodByParsingReflection($node);
|
||||
$classMethod = $this->resolveClassMethodFromCall($node);
|
||||
// skip circular self calls
|
||||
if ($currentClassMethod === $classMethod) {
|
||||
return \false;
|
||||
@ -206,49 +183,23 @@ CODE_SAMPLE
|
||||
});
|
||||
}
|
||||
/**
|
||||
* @param MethodCall|StaticCall $node
|
||||
* @param \PhpParser\Node\Expr\StaticCall|\PhpParser\Node\Expr\MethodCall $call
|
||||
*/
|
||||
private function findClassMethodByParsingReflection(\PhpParser\Node $node) : ?\PhpParser\Node\Stmt\ClassMethod
|
||||
private function resolveClassMethodFromCall($call) : ?\PhpParser\Node\Stmt\ClassMethod
|
||||
{
|
||||
$methodName = $this->getName($node->name);
|
||||
if ($call instanceof \PhpParser\Node\Expr\MethodCall) {
|
||||
$objectType = $this->getObjectType($call->var);
|
||||
} else {
|
||||
// StaticCall
|
||||
$objectType = $this->getObjectType($call->class);
|
||||
}
|
||||
if (!$objectType instanceof \PHPStan\Type\TypeWithClassName) {
|
||||
return null;
|
||||
}
|
||||
$methodName = $this->getName($call->name);
|
||||
if ($methodName === null) {
|
||||
return null;
|
||||
}
|
||||
if ($node instanceof \PhpParser\Node\Expr\MethodCall) {
|
||||
$objectType = $this->getObjectType($node->var);
|
||||
} else {
|
||||
// StaticCall
|
||||
$objectType = $this->getObjectType($node->class);
|
||||
}
|
||||
$reflectionMethod = $this->classMethodReflectionFactory->createFromPHPStanTypeAndMethodName($objectType, $methodName);
|
||||
if (!$reflectionMethod instanceof \ReflectionMethod) {
|
||||
return null;
|
||||
}
|
||||
$fileName = $reflectionMethod->getFileName();
|
||||
if (!$fileName) {
|
||||
return null;
|
||||
}
|
||||
if (!\file_exists($fileName)) {
|
||||
return null;
|
||||
}
|
||||
return $this->findClassMethodInFile($fileName, $methodName);
|
||||
}
|
||||
private function findClassMethodInFile(string $fileName, string $methodName) : ?\PhpParser\Node\Stmt\ClassMethod
|
||||
{
|
||||
// skip already anayzed method to prevent cycling
|
||||
if (isset($this->analyzedMethodsInFileName[$fileName][$methodName])) {
|
||||
return $this->analyzedMethodsInFileName[$fileName][$methodName];
|
||||
}
|
||||
$smartFileInfo = new \Symplify\SmartFileSystem\SmartFileInfo($fileName);
|
||||
$examinedMethodNodes = $this->fileInfoParser->parseFileInfoToNodesAndDecorate($smartFileInfo);
|
||||
/** @var ClassMethod|null $examinedClassMethod */
|
||||
$examinedClassMethod = $this->betterNodeFinder->findFirst($examinedMethodNodes, function (\PhpParser\Node $node) use($methodName) : bool {
|
||||
if (!$node instanceof \PhpParser\Node\Stmt\ClassMethod) {
|
||||
return \false;
|
||||
}
|
||||
return $this->isName($node, $methodName);
|
||||
});
|
||||
$this->analyzedMethodsInFileName[$fileName][$methodName] = $examinedClassMethod;
|
||||
return $examinedClassMethod;
|
||||
return $this->astResolver->resolveClassMethod($objectType->getClassName(), $methodName);
|
||||
}
|
||||
}
|
||||
|
10
vendor/scoper-autoload.php
vendored
10
vendor/scoper-autoload.php
vendored
@ -21,8 +21,8 @@ if (!class_exists('SomeTestCase', false) && !interface_exists('SomeTestCase', fa
|
||||
if (!class_exists('CheckoutEntityFactory', false) && !interface_exists('CheckoutEntityFactory', false) && !trait_exists('CheckoutEntityFactory', false)) {
|
||||
spl_autoload_call('RectorPrefix20210626\CheckoutEntityFactory');
|
||||
}
|
||||
if (!class_exists('ComposerAutoloaderInit9380aed6d13833c846de1f471f6fda33', false) && !interface_exists('ComposerAutoloaderInit9380aed6d13833c846de1f471f6fda33', false) && !trait_exists('ComposerAutoloaderInit9380aed6d13833c846de1f471f6fda33', false)) {
|
||||
spl_autoload_call('RectorPrefix20210626\ComposerAutoloaderInit9380aed6d13833c846de1f471f6fda33');
|
||||
if (!class_exists('ComposerAutoloaderInit837da7d5638942e228c6f2fe5261416f', false) && !interface_exists('ComposerAutoloaderInit837da7d5638942e228c6f2fe5261416f', false) && !trait_exists('ComposerAutoloaderInit837da7d5638942e228c6f2fe5261416f', false)) {
|
||||
spl_autoload_call('RectorPrefix20210626\ComposerAutoloaderInit837da7d5638942e228c6f2fe5261416f');
|
||||
}
|
||||
if (!class_exists('Doctrine\Inflector\Inflector', false) && !interface_exists('Doctrine\Inflector\Inflector', false) && !trait_exists('Doctrine\Inflector\Inflector', false)) {
|
||||
spl_autoload_call('RectorPrefix20210626\Doctrine\Inflector\Inflector');
|
||||
@ -3320,9 +3320,9 @@ if (!function_exists('print_node')) {
|
||||
return \RectorPrefix20210626\print_node(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('composerRequire9380aed6d13833c846de1f471f6fda33')) {
|
||||
function composerRequire9380aed6d13833c846de1f471f6fda33() {
|
||||
return \RectorPrefix20210626\composerRequire9380aed6d13833c846de1f471f6fda33(...func_get_args());
|
||||
if (!function_exists('composerRequire837da7d5638942e228c6f2fe5261416f')) {
|
||||
function composerRequire837da7d5638942e228c6f2fe5261416f() {
|
||||
return \RectorPrefix20210626\composerRequire837da7d5638942e228c6f2fe5261416f(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('parseArgs')) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user