Updated Rector to commit eb34dee89488a8869ae5b726b03c16fe2979f7f5

eb34dee894 [automated] Re-Generate Nodes/Rectors Documentation (#3617)
This commit is contained in:
Tomas Votruba 2023-04-16 08:10:58 +00:00
parent b35ad51c2c
commit 8754b18496
7 changed files with 28 additions and 53 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 ComposerAutoloaderInitfc1cd8174534fed6ba9bb884b8e44a20::getLoader();
return ComposerAutoloaderInit47a8d3b6abfafc07c5df59b33d5605cd::getLoader();

View File

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

View File

@ -2056,12 +2056,12 @@
"source": {
"type": "git",
"url": "https:\/\/github.com\/rectorphp\/rector-phpunit.git",
"reference": "93fb89edc1d567c3ee0e405da9c91cdf1bd378fa"
"reference": "ead7e42283e2b0cdd08e7b3823a76b16cae6458d"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-phpunit\/zipball\/93fb89edc1d567c3ee0e405da9c91cdf1bd378fa",
"reference": "93fb89edc1d567c3ee0e405da9c91cdf1bd378fa",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-phpunit\/zipball\/ead7e42283e2b0cdd08e7b3823a76b16cae6458d",
"reference": "ead7e42283e2b0cdd08e7b3823a76b16cae6458d",
"shasum": ""
},
"require": {
@ -2090,7 +2090,7 @@
"tomasvotruba\/type-coverage": "^0.0.9",
"tomasvotruba\/unused-public": "^0.0.34"
},
"time": "2023-04-16T07:51:47+00:00",
"time": "2023-04-16T08:04:46+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 b88c766'), '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 23e55c6'), '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 93fb89e'), '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 d1e6641'));
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 b88c766'), '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 23e55c6'), '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 ead7e42'), '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 d1e6641'));
private function __construct()
{
}

View File

@ -6,6 +6,7 @@ namespace Rector\PHPUnit\Rector\Class_;
use PhpParser\Node;
use PhpParser\Node\AttributeGroup;
use PhpParser\Node\Stmt\Class_;
use PhpParser\Node\Stmt\ClassMethod;
use PHPStan\PhpDocParser\Ast\PhpDoc\GenericTagValueNode;
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode;
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
@ -82,27 +83,25 @@ CODE_SAMPLE
*/
public function getNodeTypes() : array
{
return [Class_::class];
return [Class_::class, ClassMethod::class];
}
public function provideMinPhpVersion() : int
{
return PhpVersionFeature::ATTRIBUTES;
}
/**
* @param Class_ $node
* @param Class_|ClassMethod $node
*/
public function refactor(Node $node) : ?Node
{
if (!$this->testsNodeAnalyzer->isInTestClass($node)) {
return null;
}
$coversClassAttributeGroups = $this->resolveCoversClassAttributeGroups($node);
$coversFunctionsAttributeGroups = $this->resolveCoversFunctionAttributeGroups($node);
$attributeGroups = \array_merge($coversClassAttributeGroups, $coversFunctionsAttributeGroups);
if ($attributeGroups === []) {
$coversAttributeGroups = $this->resolveCoversAttributeGroups($node);
if ($coversAttributeGroups === []) {
return null;
}
$node->attrGroups = \array_merge($node->attrGroups, $attributeGroups);
$node->attrGroups = $coversAttributeGroups;
return $node;
}
private function createAttributeGroup(string $annotationValue) : AttributeGroup
@ -118,49 +117,25 @@ CODE_SAMPLE
}
/**
* @return AttributeGroup[]
* @param \PhpParser\Node\Stmt\Class_|\PhpParser\Node\Stmt\ClassMethod $node
*/
private function resolveCoversClassAttributeGroups(Class_ $class) : array
private function resolveCoversAttributeGroups($node) : array
{
// resolve covers class first
$classPhpDocInfo = $this->phpDocInfoFactory->createFromNode($class);
if (!$classPhpDocInfo instanceof PhpDocInfo) {
$phpDocInfo = $this->phpDocInfoFactory->createFromNode($node);
if (!$phpDocInfo instanceof PhpDocInfo) {
return [];
}
$attributeGroups = [];
/** @var PhpDocTagNode[] $desiredTagValueNodes */
$desiredTagValueNodes = $classPhpDocInfo->getTagsByName('covers');
$desiredTagValueNodes = $phpDocInfo->getTagsByName('covers');
foreach ($desiredTagValueNodes as $desiredTagValueNode) {
if (!$desiredTagValueNode->value instanceof GenericTagValueNode) {
continue;
}
$attributeGroups[] = $this->createAttributeGroup($desiredTagValueNode->value->value);
// cleanup
$this->phpDocTagRemover->removeTagValueFromNode($classPhpDocInfo, $desiredTagValueNode);
}
return $attributeGroups;
}
/**
* @return AttributeGroup[]
*/
private function resolveCoversFunctionAttributeGroups(Class_ $class) : array
{
$attributeGroups = [];
// resolve covers function
foreach ($class->getMethods() as $classMethod) {
$classMethodPhpDocInfo = $this->phpDocInfoFactory->createFromNode($classMethod);
if (!$classMethodPhpDocInfo instanceof PhpDocInfo) {
continue;
}
/** @var PhpDocTagNode[] $desiredTagValueNodes */
$desiredTagValueNodes = $classMethodPhpDocInfo->getTagsByName('covers');
foreach ($desiredTagValueNodes as $desiredTagValueNode) {
if (!$desiredTagValueNode->value instanceof GenericTagValueNode) {
continue;
}
$attributeGroups[] = $this->createAttributeGroup($desiredTagValueNode->value->value);
// cleanup
$this->phpDocTagRemover->removeTagValueFromNode($classMethodPhpDocInfo, $desiredTagValueNode);
}
$this->phpDocTagRemover->removeTagValueFromNode($phpDocInfo, $desiredTagValueNode);
}
return $attributeGroups;
}