Updated Rector to commit 6488506a36f117e947056eff9f27157a82bf102b

6488506a36 [DeadCode] Remove parent lookup on DeadReturnTagValueNodeAnalyzer (#4235)
This commit is contained in:
Tomas Votruba 2023-06-16 03:38:29 +00:00
parent d793888f8a
commit 2042d4bd59
5 changed files with 17 additions and 24 deletions

View File

@ -4,18 +4,17 @@ declare (strict_types=1);
namespace Rector\DeadCode\PhpDoc;
use PhpParser\Node;
use PhpParser\Node\Stmt\ClassLike;
use PhpParser\Node\Stmt\ClassMethod;
use PhpParser\Node\Stmt\Trait_;
use PHPStan\Analyser\Scope;
use PHPStan\PhpDocParser\Ast\PhpDoc\ReturnTagValueNode;
use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
use PHPStan\PhpDocParser\Ast\Type\ThisTypeNode;
use Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger;
use Rector\BetterPhpDocParser\ValueObject\Type\BracketsAwareUnionTypeNode;
use Rector\Core\PhpParser\Node\BetterNodeFinder;
use Rector\DeadCode\PhpDoc\Guard\StandaloneTypeRemovalGuard;
use Rector\DeadCode\TypeNodeAnalyzer\GenericTypeNodeAnalyzer;
use Rector\DeadCode\TypeNodeAnalyzer\MixedArrayTypeNodeAnalyzer;
use Rector\NodeTypeResolver\Node\AttributeKey;
use Rector\NodeTypeResolver\TypeComparator\TypeComparator;
final class DeadReturnTagValueNodeAnalyzer
{
@ -24,11 +23,6 @@ final class DeadReturnTagValueNodeAnalyzer
* @var \Rector\NodeTypeResolver\TypeComparator\TypeComparator
*/
private $typeComparator;
/**
* @readonly
* @var \Rector\Core\PhpParser\Node\BetterNodeFinder
*/
private $betterNodeFinder;
/**
* @readonly
* @var \Rector\DeadCode\TypeNodeAnalyzer\GenericTypeNodeAnalyzer
@ -49,10 +43,9 @@ final class DeadReturnTagValueNodeAnalyzer
* @var \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger
*/
private $phpDocTypeChanger;
public function __construct(TypeComparator $typeComparator, BetterNodeFinder $betterNodeFinder, GenericTypeNodeAnalyzer $genericTypeNodeAnalyzer, MixedArrayTypeNodeAnalyzer $mixedArrayTypeNodeAnalyzer, StandaloneTypeRemovalGuard $standaloneTypeRemovalGuard, PhpDocTypeChanger $phpDocTypeChanger)
public function __construct(TypeComparator $typeComparator, GenericTypeNodeAnalyzer $genericTypeNodeAnalyzer, MixedArrayTypeNodeAnalyzer $mixedArrayTypeNodeAnalyzer, StandaloneTypeRemovalGuard $standaloneTypeRemovalGuard, PhpDocTypeChanger $phpDocTypeChanger)
{
$this->typeComparator = $typeComparator;
$this->betterNodeFinder = $betterNodeFinder;
$this->genericTypeNodeAnalyzer = $genericTypeNodeAnalyzer;
$this->mixedArrayTypeNodeAnalyzer = $mixedArrayTypeNodeAnalyzer;
$this->standaloneTypeRemovalGuard = $standaloneTypeRemovalGuard;
@ -64,8 +57,8 @@ final class DeadReturnTagValueNodeAnalyzer
if ($returnType === null) {
return \false;
}
$classLike = $this->betterNodeFinder->findParentType($classMethod, ClassLike::class);
if ($classLike instanceof Trait_ && $returnTagValueNode->type instanceof ThisTypeNode) {
$scope = $classMethod->getAttribute(AttributeKey::SCOPE);
if ($scope instanceof Scope && $scope->isInTrait() && $returnTagValueNode->type instanceof ThisTypeNode) {
return \false;
}
if (!$this->typeComparator->arePhpParserAndPhpStanPhpDocTypesEqual($returnType, $returnTagValueNode->type, $classMethod)) {

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = '53c6c5fcaf92b3ff40b6f45e476ff981b9028e95';
public const PACKAGE_VERSION = '6488506a36f117e947056eff9f27157a82bf102b';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2023-06-16 03:30:30';
public const RELEASE_DATE = '2023-06-16 10:34:40';
/**
* @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 ComposerAutoloaderIniteb0064a8b8a25d42770f16ffddb22ddd::getLoader();
return ComposerAutoloaderInit6c1b27222d250a2e9dbe319129ba323c::getLoader();

View File

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