Skip to content

Commit

Permalink
Updated Rector to commit b7359ed
Browse files Browse the repository at this point in the history
rectorphp/rector-src@b7359ed [Php80] Fix Non namespaced class with annotation on AnnotationToAttributeRector (#268)
  • Loading branch information
TomasVotruba committed Jun 22, 2021
1 parent 98ca095 commit 71b6491
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 20 deletions.
10 changes: 9 additions & 1 deletion rules/Php80/Rector/Class_/AnnotationToAttributeRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use PhpParser\Node\Stmt\ClassMethod;
use PhpParser\Node\Stmt\Function_;
use PhpParser\Node\Stmt\Property;
use PHPStan\PhpDocParser\Ast\PhpDoc\GenericTagValueNode;
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode;
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode;
use Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode;
Expand Down Expand Up @@ -124,7 +125,7 @@ private function processApplyAttrGroups(array $tags, \Rector\BetterPhpDocParser\
foreach ($tags as $tag) {
foreach ($this->annotationsToAttributes as $annotationToAttribute) {
$annotationToAttributeTag = $annotationToAttribute->getTag();
if ($phpDocInfo->hasByName($annotationToAttributeTag)) {
if ($this->isFoundGenericTag($phpDocInfo, $tag->value, $annotationToAttributeTag)) {
// 1. remove php-doc tag
$this->phpDocTagRemover->removeByName($phpDocInfo, $annotationToAttributeTag);
// 2. add attributes
Expand All @@ -147,6 +148,13 @@ private function processApplyAttrGroups(array $tags, \Rector\BetterPhpDocParser\
}
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
{
$doctrineAnnotationTagValueNode = $phpDocInfo->getByAnnotationClass($annotationToAttributeTag);
Expand Down
4 changes: 2 additions & 2 deletions src/Application/VersionResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ final class VersionResolver
/**
* @var string
*/
public const PACKAGE_VERSION = '0c035c390d4afd73b76f186313d4b7f7d906e072';
public const PACKAGE_VERSION = 'b7359eda29da4377d8ee842c0964f981fbd42abd';
/**
* @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
{
$process = new \RectorPrefix20210622\Symfony\Component\Process\Process(['git', 'log', '--pretty="%H"', '-n1', 'HEAD'], __DIR__);
Expand Down
2 changes: 1 addition & 1 deletion vendor/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

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

return ComposerAutoloaderInit3fbf0929cc1ff1fc5e070dfc2b26765b::getLoader();
return ComposerAutoloaderInit6cf032a1bf53c6c94774272899db7081::getLoader();
14 changes: 7 additions & 7 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 ComposerAutoloaderInit3fbf0929cc1ff1fc5e070dfc2b26765b
class ComposerAutoloaderInit6cf032a1bf53c6c94774272899db7081
{
private static $loader;

Expand All @@ -22,15 +22,15 @@ public static function getLoader()
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__)));
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());
if ($useStaticLoader) {
require __DIR__ . '/autoload_static.php';

call_user_func(\Composer\Autoload\ComposerStaticInit3fbf0929cc1ff1fc5e070dfc2b26765b::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit6cf032a1bf53c6c94774272899db7081::getInitializer($loader));
} else {
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
Expand All @@ -42,19 +42,19 @@ public static function getLoader()
$loader->register(true);

if ($useStaticLoader) {
$includeFiles = Composer\Autoload\ComposerStaticInit3fbf0929cc1ff1fc5e070dfc2b26765b::$files;
$includeFiles = Composer\Autoload\ComposerStaticInit6cf032a1bf53c6c94774272899db7081::$files;
} else {
$includeFiles = require __DIR__ . '/autoload_files.php';
}
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequire3fbf0929cc1ff1fc5e070dfc2b26765b($fileIdentifier, $file);
composerRequire6cf032a1bf53c6c94774272899db7081($fileIdentifier, $file);
}

return $loader;
}
}

function composerRequire3fbf0929cc1ff1fc5e070dfc2b26765b($fileIdentifier, $file)
function composerRequire6cf032a1bf53c6c94774272899db7081($fileIdentifier, $file)
{
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
require $file;
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 ComposerStaticInit3fbf0929cc1ff1fc5e070dfc2b26765b
class ComposerStaticInit6cf032a1bf53c6c94774272899db7081
{
public static $files = array (
'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
Expand Down Expand Up @@ -3869,9 +3869,9 @@ class ComposerStaticInit3fbf0929cc1ff1fc5e070dfc2b26765b
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit3fbf0929cc1ff1fc5e070dfc2b26765b::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit3fbf0929cc1ff1fc5e070dfc2b26765b::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit3fbf0929cc1ff1fc5e070dfc2b26765b::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit6cf032a1bf53c6c94774272899db7081::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit6cf032a1bf53c6c94774272899db7081::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit6cf032a1bf53c6c94774272899db7081::$classMap;

}, null, ClassLoader::class);
}
Expand Down
10 changes: 5 additions & 5 deletions vendor/scoper-autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
if (!class_exists('CheckoutEntityFactory', false) && !interface_exists('CheckoutEntityFactory', false) && !trait_exists('CheckoutEntityFactory', false)) {
spl_autoload_call('RectorPrefix20210622\CheckoutEntityFactory');
}
if (!class_exists('ComposerAutoloaderInit3fbf0929cc1ff1fc5e070dfc2b26765b', false) && !interface_exists('ComposerAutoloaderInit3fbf0929cc1ff1fc5e070dfc2b26765b', false) && !trait_exists('ComposerAutoloaderInit3fbf0929cc1ff1fc5e070dfc2b26765b', false)) {
spl_autoload_call('RectorPrefix20210622\ComposerAutoloaderInit3fbf0929cc1ff1fc5e070dfc2b26765b');
if (!class_exists('ComposerAutoloaderInit6cf032a1bf53c6c94774272899db7081', false) && !interface_exists('ComposerAutoloaderInit6cf032a1bf53c6c94774272899db7081', false) && !trait_exists('ComposerAutoloaderInit6cf032a1bf53c6c94774272899db7081', false)) {
spl_autoload_call('RectorPrefix20210622\ComposerAutoloaderInit6cf032a1bf53c6c94774272899db7081');
}
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');
Expand Down Expand Up @@ -3323,9 +3323,9 @@ function print_node() {
return \RectorPrefix20210622\print_node(...func_get_args());
}
}
if (!function_exists('composerRequire3fbf0929cc1ff1fc5e070dfc2b26765b')) {
function composerRequire3fbf0929cc1ff1fc5e070dfc2b26765b() {
return \RectorPrefix20210622\composerRequire3fbf0929cc1ff1fc5e070dfc2b26765b(...func_get_args());
if (!function_exists('composerRequire6cf032a1bf53c6c94774272899db7081')) {
function composerRequire6cf032a1bf53c6c94774272899db7081() {
return \RectorPrefix20210622\composerRequire6cf032a1bf53c6c94774272899db7081(...func_get_args());
}
}
if (!function_exists('parseArgs')) {
Expand Down

0 comments on commit 71b6491

Please sign in to comment.