mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-18 22:08:00 +01:00
Updated Rector to commit b7359eda29da4377d8ee842c0964f981fbd42abd
b7359eda29
[Php80] Fix Non namespaced class with annotation on AnnotationToAttributeRector (#268)
This commit is contained in:
parent
98ca09597d
commit
71b64910b3
@ -10,6 +10,7 @@ use PhpParser\Node\Stmt\Class_;
|
|||||||
use PhpParser\Node\Stmt\ClassMethod;
|
use PhpParser\Node\Stmt\ClassMethod;
|
||||||
use PhpParser\Node\Stmt\Function_;
|
use PhpParser\Node\Stmt\Function_;
|
||||||
use PhpParser\Node\Stmt\Property;
|
use PhpParser\Node\Stmt\Property;
|
||||||
|
use PHPStan\PhpDocParser\Ast\PhpDoc\GenericTagValueNode;
|
||||||
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode;
|
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode;
|
||||||
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode;
|
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode;
|
||||||
use Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode;
|
use Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode;
|
||||||
@ -124,7 +125,7 @@ CODE_SAMPLE
|
|||||||
foreach ($tags as $tag) {
|
foreach ($tags as $tag) {
|
||||||
foreach ($this->annotationsToAttributes as $annotationToAttribute) {
|
foreach ($this->annotationsToAttributes as $annotationToAttribute) {
|
||||||
$annotationToAttributeTag = $annotationToAttribute->getTag();
|
$annotationToAttributeTag = $annotationToAttribute->getTag();
|
||||||
if ($phpDocInfo->hasByName($annotationToAttributeTag)) {
|
if ($this->isFoundGenericTag($phpDocInfo, $tag->value, $annotationToAttributeTag)) {
|
||||||
// 1. remove php-doc tag
|
// 1. remove php-doc tag
|
||||||
$this->phpDocTagRemover->removeByName($phpDocInfo, $annotationToAttributeTag);
|
$this->phpDocTagRemover->removeByName($phpDocInfo, $annotationToAttributeTag);
|
||||||
// 2. add attributes
|
// 2. add attributes
|
||||||
@ -147,6 +148,13 @@ CODE_SAMPLE
|
|||||||
}
|
}
|
||||||
return $hasNewAttrGroups;
|
return $hasNewAttrGroups;
|
||||||
}
|
}
|
||||||
|
private function isFoundGenericTag(\Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo $phpDocInfo, \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $phpDocTagValueNode, string $annotationToAttributeTag) : bool
|
||||||
|
{
|
||||||
|
if (!$phpDocInfo->hasByName($annotationToAttributeTag)) {
|
||||||
|
return \false;
|
||||||
|
}
|
||||||
|
return $phpDocTagValueNode instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\GenericTagValueNode;
|
||||||
|
}
|
||||||
private function shouldSkip(\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $phpDocTagValueNode, \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo $phpDocInfo, string $annotationToAttributeTag) : bool
|
private function shouldSkip(\PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode $phpDocTagValueNode, \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo $phpDocInfo, string $annotationToAttributeTag) : bool
|
||||||
{
|
{
|
||||||
$doctrineAnnotationTagValueNode = $phpDocInfo->getByAnnotationClass($annotationToAttributeTag);
|
$doctrineAnnotationTagValueNode = $phpDocInfo->getByAnnotationClass($annotationToAttributeTag);
|
||||||
|
@ -16,11 +16,11 @@ final class VersionResolver
|
|||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public const PACKAGE_VERSION = '0c035c390d4afd73b76f186313d4b7f7d906e072';
|
public const PACKAGE_VERSION = 'b7359eda29da4377d8ee842c0964f981fbd42abd';
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public const RELEASE_DATE = '2021-06-22 17:45:36';
|
public const RELEASE_DATE = '2021-06-22 18:01:49';
|
||||||
public static function resolvePackageVersion() : string
|
public static function resolvePackageVersion() : string
|
||||||
{
|
{
|
||||||
$process = new \RectorPrefix20210622\Symfony\Component\Process\Process(['git', 'log', '--pretty="%H"', '-n1', 'HEAD'], __DIR__);
|
$process = new \RectorPrefix20210622\Symfony\Component\Process\Process(['git', 'log', '--pretty="%H"', '-n1', 'HEAD'], __DIR__);
|
||||||
|
2
vendor/autoload.php
vendored
2
vendor/autoload.php
vendored
@ -4,4 +4,4 @@
|
|||||||
|
|
||||||
require_once __DIR__ . '/composer/autoload_real.php';
|
require_once __DIR__ . '/composer/autoload_real.php';
|
||||||
|
|
||||||
return ComposerAutoloaderInit3fbf0929cc1ff1fc5e070dfc2b26765b::getLoader();
|
return ComposerAutoloaderInit6cf032a1bf53c6c94774272899db7081::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
|
// autoload_real.php @generated by Composer
|
||||||
|
|
||||||
class ComposerAutoloaderInit3fbf0929cc1ff1fc5e070dfc2b26765b
|
class ComposerAutoloaderInit6cf032a1bf53c6c94774272899db7081
|
||||||
{
|
{
|
||||||
private static $loader;
|
private static $loader;
|
||||||
|
|
||||||
@ -22,15 +22,15 @@ class ComposerAutoloaderInit3fbf0929cc1ff1fc5e070dfc2b26765b
|
|||||||
return self::$loader;
|
return self::$loader;
|
||||||
}
|
}
|
||||||
|
|
||||||
spl_autoload_register(array('ComposerAutoloaderInit3fbf0929cc1ff1fc5e070dfc2b26765b', 'loadClassLoader'), true, true);
|
spl_autoload_register(array('ComposerAutoloaderInit6cf032a1bf53c6c94774272899db7081', 'loadClassLoader'), true, true);
|
||||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
|
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
|
||||||
spl_autoload_unregister(array('ComposerAutoloaderInit3fbf0929cc1ff1fc5e070dfc2b26765b', 'loadClassLoader'));
|
spl_autoload_unregister(array('ComposerAutoloaderInit6cf032a1bf53c6c94774272899db7081', 'loadClassLoader'));
|
||||||
|
|
||||||
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
||||||
if ($useStaticLoader) {
|
if ($useStaticLoader) {
|
||||||
require __DIR__ . '/autoload_static.php';
|
require __DIR__ . '/autoload_static.php';
|
||||||
|
|
||||||
call_user_func(\Composer\Autoload\ComposerStaticInit3fbf0929cc1ff1fc5e070dfc2b26765b::getInitializer($loader));
|
call_user_func(\Composer\Autoload\ComposerStaticInit6cf032a1bf53c6c94774272899db7081::getInitializer($loader));
|
||||||
} else {
|
} else {
|
||||||
$classMap = require __DIR__ . '/autoload_classmap.php';
|
$classMap = require __DIR__ . '/autoload_classmap.php';
|
||||||
if ($classMap) {
|
if ($classMap) {
|
||||||
@ -42,19 +42,19 @@ class ComposerAutoloaderInit3fbf0929cc1ff1fc5e070dfc2b26765b
|
|||||||
$loader->register(true);
|
$loader->register(true);
|
||||||
|
|
||||||
if ($useStaticLoader) {
|
if ($useStaticLoader) {
|
||||||
$includeFiles = Composer\Autoload\ComposerStaticInit3fbf0929cc1ff1fc5e070dfc2b26765b::$files;
|
$includeFiles = Composer\Autoload\ComposerStaticInit6cf032a1bf53c6c94774272899db7081::$files;
|
||||||
} else {
|
} else {
|
||||||
$includeFiles = require __DIR__ . '/autoload_files.php';
|
$includeFiles = require __DIR__ . '/autoload_files.php';
|
||||||
}
|
}
|
||||||
foreach ($includeFiles as $fileIdentifier => $file) {
|
foreach ($includeFiles as $fileIdentifier => $file) {
|
||||||
composerRequire3fbf0929cc1ff1fc5e070dfc2b26765b($fileIdentifier, $file);
|
composerRequire6cf032a1bf53c6c94774272899db7081($fileIdentifier, $file);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $loader;
|
return $loader;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function composerRequire3fbf0929cc1ff1fc5e070dfc2b26765b($fileIdentifier, $file)
|
function composerRequire6cf032a1bf53c6c94774272899db7081($fileIdentifier, $file)
|
||||||
{
|
{
|
||||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||||
require $file;
|
require $file;
|
||||||
|
8
vendor/composer/autoload_static.php
vendored
8
vendor/composer/autoload_static.php
vendored
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
namespace Composer\Autoload;
|
namespace Composer\Autoload;
|
||||||
|
|
||||||
class ComposerStaticInit3fbf0929cc1ff1fc5e070dfc2b26765b
|
class ComposerStaticInit6cf032a1bf53c6c94774272899db7081
|
||||||
{
|
{
|
||||||
public static $files = array (
|
public static $files = array (
|
||||||
'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
|
'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
|
||||||
@ -3869,9 +3869,9 @@ class ComposerStaticInit3fbf0929cc1ff1fc5e070dfc2b26765b
|
|||||||
public static function getInitializer(ClassLoader $loader)
|
public static function getInitializer(ClassLoader $loader)
|
||||||
{
|
{
|
||||||
return \Closure::bind(function () use ($loader) {
|
return \Closure::bind(function () use ($loader) {
|
||||||
$loader->prefixLengthsPsr4 = ComposerStaticInit3fbf0929cc1ff1fc5e070dfc2b26765b::$prefixLengthsPsr4;
|
$loader->prefixLengthsPsr4 = ComposerStaticInit6cf032a1bf53c6c94774272899db7081::$prefixLengthsPsr4;
|
||||||
$loader->prefixDirsPsr4 = ComposerStaticInit3fbf0929cc1ff1fc5e070dfc2b26765b::$prefixDirsPsr4;
|
$loader->prefixDirsPsr4 = ComposerStaticInit6cf032a1bf53c6c94774272899db7081::$prefixDirsPsr4;
|
||||||
$loader->classMap = ComposerStaticInit3fbf0929cc1ff1fc5e070dfc2b26765b::$classMap;
|
$loader->classMap = ComposerStaticInit6cf032a1bf53c6c94774272899db7081::$classMap;
|
||||||
|
|
||||||
}, null, ClassLoader::class);
|
}, null, ClassLoader::class);
|
||||||
}
|
}
|
||||||
|
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)) {
|
if (!class_exists('CheckoutEntityFactory', false) && !interface_exists('CheckoutEntityFactory', false) && !trait_exists('CheckoutEntityFactory', false)) {
|
||||||
spl_autoload_call('RectorPrefix20210622\CheckoutEntityFactory');
|
spl_autoload_call('RectorPrefix20210622\CheckoutEntityFactory');
|
||||||
}
|
}
|
||||||
if (!class_exists('ComposerAutoloaderInit3fbf0929cc1ff1fc5e070dfc2b26765b', false) && !interface_exists('ComposerAutoloaderInit3fbf0929cc1ff1fc5e070dfc2b26765b', false) && !trait_exists('ComposerAutoloaderInit3fbf0929cc1ff1fc5e070dfc2b26765b', false)) {
|
if (!class_exists('ComposerAutoloaderInit6cf032a1bf53c6c94774272899db7081', false) && !interface_exists('ComposerAutoloaderInit6cf032a1bf53c6c94774272899db7081', false) && !trait_exists('ComposerAutoloaderInit6cf032a1bf53c6c94774272899db7081', false)) {
|
||||||
spl_autoload_call('RectorPrefix20210622\ComposerAutoloaderInit3fbf0929cc1ff1fc5e070dfc2b26765b');
|
spl_autoload_call('RectorPrefix20210622\ComposerAutoloaderInit6cf032a1bf53c6c94774272899db7081');
|
||||||
}
|
}
|
||||||
if (!class_exists('Doctrine\Inflector\Inflector', false) && !interface_exists('Doctrine\Inflector\Inflector', false) && !trait_exists('Doctrine\Inflector\Inflector', false)) {
|
if (!class_exists('Doctrine\Inflector\Inflector', false) && !interface_exists('Doctrine\Inflector\Inflector', false) && !trait_exists('Doctrine\Inflector\Inflector', false)) {
|
||||||
spl_autoload_call('RectorPrefix20210622\Doctrine\Inflector\Inflector');
|
spl_autoload_call('RectorPrefix20210622\Doctrine\Inflector\Inflector');
|
||||||
@ -3323,9 +3323,9 @@ if (!function_exists('print_node')) {
|
|||||||
return \RectorPrefix20210622\print_node(...func_get_args());
|
return \RectorPrefix20210622\print_node(...func_get_args());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!function_exists('composerRequire3fbf0929cc1ff1fc5e070dfc2b26765b')) {
|
if (!function_exists('composerRequire6cf032a1bf53c6c94774272899db7081')) {
|
||||||
function composerRequire3fbf0929cc1ff1fc5e070dfc2b26765b() {
|
function composerRequire6cf032a1bf53c6c94774272899db7081() {
|
||||||
return \RectorPrefix20210622\composerRequire3fbf0929cc1ff1fc5e070dfc2b26765b(...func_get_args());
|
return \RectorPrefix20210622\composerRequire6cf032a1bf53c6c94774272899db7081(...func_get_args());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!function_exists('parseArgs')) {
|
if (!function_exists('parseArgs')) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user