mirror of
https://github.com/rectorphp/rector.git
synced 2025-03-14 12:29:43 +01:00
Updated Rector to commit 4d4c73d5957cd03b26d4a7f6b6b3e209f4506cd3
4d4c73d595
[automated] Apply Coding Standard (#3998)
This commit is contained in:
parent
c1d2a2d580
commit
80189225db
2
vendor/autoload.php
vendored
2
vendor/autoload.php
vendored
@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) {
|
||||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInit0586fe9cf1ab5723977f543bc29cddc4::getLoader();
|
||||
return ComposerAutoloaderInit2190b42f910b56ebd090b32433d91236::getLoader();
|
||||
|
10
vendor/composer/autoload_real.php
vendored
10
vendor/composer/autoload_real.php
vendored
@ -2,7 +2,7 @@
|
||||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInit0586fe9cf1ab5723977f543bc29cddc4
|
||||
class ComposerAutoloaderInit2190b42f910b56ebd090b32433d91236
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
@ -22,17 +22,17 @@ class ComposerAutoloaderInit0586fe9cf1ab5723977f543bc29cddc4
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit0586fe9cf1ab5723977f543bc29cddc4', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit2190b42f910b56ebd090b32433d91236', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit0586fe9cf1ab5723977f543bc29cddc4', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit2190b42f910b56ebd090b32433d91236', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit0586fe9cf1ab5723977f543bc29cddc4::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit2190b42f910b56ebd090b32433d91236::getInitializer($loader));
|
||||
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
$loader->register(true);
|
||||
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit0586fe9cf1ab5723977f543bc29cddc4::$files;
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit2190b42f910b56ebd090b32433d91236::$files;
|
||||
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
||||
|
8
vendor/composer/autoload_static.php
vendored
8
vendor/composer/autoload_static.php
vendored
@ -4,7 +4,7 @@
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInit0586fe9cf1ab5723977f543bc29cddc4
|
||||
class ComposerStaticInit2190b42f910b56ebd090b32433d91236
|
||||
{
|
||||
public static $files = array (
|
||||
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
||||
@ -3089,9 +3089,9 @@ class ComposerStaticInit0586fe9cf1ab5723977f543bc29cddc4
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit0586fe9cf1ab5723977f543bc29cddc4::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit0586fe9cf1ab5723977f543bc29cddc4::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit0586fe9cf1ab5723977f543bc29cddc4::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit2190b42f910b56ebd090b32433d91236::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit2190b42f910b56ebd090b32433d91236::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit2190b42f910b56ebd090b32433d91236::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
8
vendor/composer/installed.json
vendored
8
vendor/composer/installed.json
vendored
@ -1992,12 +1992,12 @@
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/rectorphp\/rector-phpunit.git",
|
||||
"reference": "905259cb5657773b14117c01681917890366c3bc"
|
||||
"reference": "659f0153a4de3c48fa6da7cc755679d74bb9f26d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-phpunit\/zipball\/905259cb5657773b14117c01681917890366c3bc",
|
||||
"reference": "905259cb5657773b14117c01681917890366c3bc",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-phpunit\/zipball\/659f0153a4de3c48fa6da7cc755679d74bb9f26d",
|
||||
"reference": "659f0153a4de3c48fa6da7cc755679d74bb9f26d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -2026,7 +2026,7 @@
|
||||
"tomasvotruba\/type-coverage": "^0.1",
|
||||
"tomasvotruba\/unused-public": "^0.1"
|
||||
},
|
||||
"time": "2023-05-28T13:53:27+00:00",
|
||||
"time": "2023-05-28T14:09:34+00:00",
|
||||
"default-branch": true,
|
||||
"type": "rector-extension",
|
||||
"extra": {
|
||||
|
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-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 bc6805c'), '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 048a728'), '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 905259c'), '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 3878c88'));
|
||||
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 bc6805c'), '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 048a728'), '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 659f015'), '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 3878c88'));
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
@ -12,7 +12,6 @@ use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
|
||||
use Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTagRemover;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\Core\ValueObject\PhpVersionFeature;
|
||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
use Rector\PhpAttribute\NodeFactory\PhpAttributeGroupFactory;
|
||||
use Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer;
|
||||
use Rector\VersionBonding\Contract\MinPhpVersionInterface;
|
||||
@ -83,53 +82,61 @@ CODE_SAMPLE
|
||||
*/
|
||||
public function getNodeTypes() : array
|
||||
{
|
||||
return [ClassMethod::class];
|
||||
return [Class_::class];
|
||||
}
|
||||
public function provideMinPhpVersion() : int
|
||||
{
|
||||
return PhpVersionFeature::ATTRIBUTES;
|
||||
}
|
||||
/**
|
||||
* @param ClassMethod $node
|
||||
* @param Class_ $node
|
||||
*/
|
||||
public function refactor(Node $node) : ?Node
|
||||
{
|
||||
if (!$this->testsNodeAnalyzer->isInTestClass($node)) {
|
||||
return null;
|
||||
}
|
||||
$phpDocInfo = $this->phpDocInfoFactory->createFromNode($node);
|
||||
if (!$phpDocInfo instanceof PhpDocInfo) {
|
||||
return null;
|
||||
}
|
||||
/** @var PhpDocTagNode[] $desiredTagValueNodes */
|
||||
$desiredTagValueNodes = $phpDocInfo->getTagsByName('depends');
|
||||
if ($desiredTagValueNodes === []) {
|
||||
return null;
|
||||
}
|
||||
$currentClass = $node->getAttribute(AttributeKey::PARENT_NODE);
|
||||
if (!$currentClass instanceof Class_) {
|
||||
return null;
|
||||
}
|
||||
$currentMethodName = $this->getName($node);
|
||||
foreach ($desiredTagValueNodes as $desiredTagValueNode) {
|
||||
if (!$desiredTagValueNode->value instanceof GenericTagValueNode) {
|
||||
$hasChanged = \false;
|
||||
foreach ($node->getMethods() as $classMethod) {
|
||||
$phpDocInfo = $this->phpDocInfoFactory->createFromNode($classMethod);
|
||||
if (!$phpDocInfo instanceof PhpDocInfo) {
|
||||
continue;
|
||||
}
|
||||
$originalAttributeValue = $desiredTagValueNode->value->value;
|
||||
$attributeNameAndValue = $this->resolveAttributeValueAndAttributeName($currentClass, $currentMethodName, $originalAttributeValue);
|
||||
if ($attributeNameAndValue === null) {
|
||||
continue;
|
||||
/** @var PhpDocTagNode[] $desiredTagValueNodes */
|
||||
$desiredTagValueNodes = $phpDocInfo->getTagsByName('depends');
|
||||
$currentMethodName = $this->getName($classMethod);
|
||||
foreach ($desiredTagValueNodes as $desiredTagValueNode) {
|
||||
$attributeNameAndValue = $this->resolveAttributeNameAndValue($desiredTagValueNode, $node, $currentMethodName);
|
||||
if ($attributeNameAndValue === []) {
|
||||
continue;
|
||||
}
|
||||
$attributeGroup = $this->phpAttributeGroupFactory->createFromClassWithItems($attributeNameAndValue[0], [$attributeNameAndValue[1]]);
|
||||
$classMethod->attrGroups[] = $attributeGroup;
|
||||
// cleanup
|
||||
$this->phpDocTagRemover->removeTagValueFromNode($phpDocInfo, $desiredTagValueNode);
|
||||
$hasChanged = \true;
|
||||
}
|
||||
$attributeGroup = $this->phpAttributeGroupFactory->createFromClassWithItems($attributeNameAndValue[0], [$attributeNameAndValue[1]]);
|
||||
$node->attrGroups[] = $attributeGroup;
|
||||
// cleanup
|
||||
$this->phpDocTagRemover->removeTagValueFromNode($phpDocInfo, $desiredTagValueNode);
|
||||
}
|
||||
if (!$phpDocInfo->hasChanged()) {
|
||||
if (!$hasChanged) {
|
||||
return null;
|
||||
}
|
||||
return $node;
|
||||
}
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
private function resolveAttributeNameAndValue(PhpDocTagNode $phpDocTagNode, Class_ $class, string $currentMethodName) : array
|
||||
{
|
||||
if (!$phpDocTagNode->value instanceof GenericTagValueNode) {
|
||||
return [];
|
||||
}
|
||||
$originalAttributeValue = $phpDocTagNode->value->value;
|
||||
$attributeNameAndValue = $this->resolveAttributeValueAndAttributeName($class, $currentMethodName, $originalAttributeValue);
|
||||
if ($attributeNameAndValue === null) {
|
||||
return [];
|
||||
}
|
||||
return $attributeNameAndValue;
|
||||
}
|
||||
/**
|
||||
* @return string[]|null
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user