Skip to content

Commit

Permalink
Updated Rector to commit 1da22824edd107108e087d40233769817a2cbe25
Browse files Browse the repository at this point in the history
rectorphp/rector-src@1da2282 [PostRector] Skip remove unused use on used as ConstFetchNode, eg: TypeKind::* (#3560)
  • Loading branch information
TomasVotruba committed Apr 4, 2023
1 parent a6db719 commit c2fef6b
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 12 deletions.
22 changes: 22 additions & 0 deletions packages/BetterPhpDocParser/PhpDocInfo/PhpDocInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
declare (strict_types=1);
namespace Rector\BetterPhpDocParser\PhpDocInfo;

use PHPStan\PhpDocParser\Ast\ConstExpr\ConstFetchNode;
use PHPStan\PhpDocParser\Ast\Node;
use PHPStan\PhpDocParser\Ast\PhpDoc\InvalidTagValueNode;
use PHPStan\PhpDocParser\Ast\PhpDoc\MethodTagValueNode;
Expand All @@ -15,6 +16,7 @@
use PHPStan\PhpDocParser\Ast\PhpDoc\ReturnTagValueNode;
use PHPStan\PhpDocParser\Ast\PhpDoc\TemplateTagValueNode;
use PHPStan\PhpDocParser\Ast\PhpDoc\VarTagValueNode;
use PHPStan\PhpDocParser\Ast\Type\ConstTypeNode;
use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
use PHPStan\PhpDocParser\Lexer\Lexer;
use PHPStan\Type\MixedType;
Expand All @@ -25,6 +27,7 @@
use Rector\BetterPhpDocParser\PhpDocNodeFinder\PhpDocNodeByTypeFinder;
use Rector\BetterPhpDocParser\PhpDocNodeVisitor\ChangedPhpDocNodeVisitor;
use Rector\BetterPhpDocParser\ValueObject\Parser\BetterTokenIterator;
use Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey;
use Rector\BetterPhpDocParser\ValueObject\Type\ShortenedIdentifierTypeNode;
use Rector\ChangesReporting\Collector\RectorChangeCollector;
use Rector\Core\Configuration\CurrentNodeProvider;
Expand Down Expand Up @@ -411,6 +414,25 @@ public function getAnnotationClassNames() : array
}
return $resolvedClasses;
}
/**
* @return string[]
*/
public function getConstFetchNodeClassNames() : array
{
$phpDocNodeTraverser = new PhpDocNodeTraverser();
$classNames = [];
$phpDocNodeTraverser->traverseWithCallable($this->phpDocNode, '', static function (Node $node) use(&$classNames) : ?ConstTypeNode {
if (!$node instanceof ConstTypeNode) {
return null;
}
if (!$node->constExpr instanceof ConstFetchNode) {
return null;
}
$classNames[] = $node->constExpr->getAttribute(PhpDocAttributeKey::RESOLVED_CLASS);
return $node;
});
return $classNames;
}
private function resolveNameForPhpDocTagValueNode(PhpDocTagValueNode $phpDocTagValueNode) : ?string
{
foreach (self::TAGS_TYPES_TO_NAMES as $tagValueNodeType => $name) {
Expand Down
2 changes: 2 additions & 0 deletions packages/PostRector/Rector/UnusedImportRemovingPostRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ private function findNamesInDocBlocks($namespace) : array
}
$phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($node);
$names = \array_merge($names, $phpDocInfo->getAnnotationClassNames());
$constFetchNodeNames = $phpDocInfo->getConstFetchNodeClassNames();
$names = \array_merge($names, $constFetchNodeNames);
});
return $names;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Application/VersionResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = '622e93f2aa7c4cdcfb8a32388d27ae43df95bb9a';
public const PACKAGE_VERSION = '1da22824edd107108e087d40233769817a2cbe25';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2023-04-04 01:22:06';
public const RELEASE_DATE = '2023-04-04 07:52:59';
/**
* @var int
*/
Expand Down
2 changes: 1 addition & 1 deletion vendor/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@

require_once __DIR__ . '/composer/autoload_real.php';

return ComposerAutoloaderInitbf34321edf24c05d9f6b115e015e4c7f::getLoader();
return ComposerAutoloaderInit4fd1f544aa8f7722ab02524f353da142::getLoader();
10 changes: 5 additions & 5 deletions vendor/composer/autoload_real.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// autoload_real.php @generated by Composer

class ComposerAutoloaderInitbf34321edf24c05d9f6b115e015e4c7f
class ComposerAutoloaderInit4fd1f544aa8f7722ab02524f353da142
{
private static $loader;

Expand All @@ -22,17 +22,17 @@ public static function getLoader()
return self::$loader;
}

spl_autoload_register(array('ComposerAutoloaderInitbf34321edf24c05d9f6b115e015e4c7f', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit4fd1f544aa8f7722ab02524f353da142', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInitbf34321edf24c05d9f6b115e015e4c7f', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit4fd1f544aa8f7722ab02524f353da142', 'loadClassLoader'));

require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInitbf34321edf24c05d9f6b115e015e4c7f::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit4fd1f544aa8f7722ab02524f353da142::getInitializer($loader));

$loader->setClassMapAuthoritative(true);
$loader->register(true);

$filesToLoad = \Composer\Autoload\ComposerStaticInitbf34321edf24c05d9f6b115e015e4c7f::$files;
$filesToLoad = \Composer\Autoload\ComposerStaticInit4fd1f544aa8f7722ab02524f353da142::$files;
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
Expand Down
8 changes: 4 additions & 4 deletions vendor/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Composer\Autoload;

class ComposerStaticInitbf34321edf24c05d9f6b115e015e4c7f
class ComposerStaticInit4fd1f544aa8f7722ab02524f353da142
{
public static $files = array (
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
Expand Down Expand Up @@ -3131,9 +3131,9 @@ class ComposerStaticInitbf34321edf24c05d9f6b115e015e4c7f
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInitbf34321edf24c05d9f6b115e015e4c7f::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitbf34321edf24c05d9f6b115e015e4c7f::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInitbf34321edf24c05d9f6b115e015e4c7f::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit4fd1f544aa8f7722ab02524f353da142::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit4fd1f544aa8f7722ab02524f353da142::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit4fd1f544aa8f7722ab02524f353da142::$classMap;

}, null, ClassLoader::class);
}
Expand Down

0 comments on commit c2fef6b

Please sign in to comment.