Updated Rector to commit e33bcf19be

e33bcf19be [Core] Override pModifiers() method to set final and abstract modifiers early on BetterStandardPrinter (#2328)
This commit is contained in:
Tomas Votruba 2022-05-18 10:48:11 +00:00
parent b0c0273ab6
commit 1bc7ee9334
8 changed files with 37 additions and 21 deletions

View File

@ -8435,7 +8435,7 @@ Add final to constants that does not have children
class SomeClass
{
- public const NAME = 'value';
+ public final const NAME = 'value';
+ final public const NAME = 'value';
}
```

View File

@ -60,7 +60,7 @@ CODE_SAMPLE
, <<<'CODE_SAMPLE'
class SomeClass
{
public final const NAME = 'value';
final public const NAME = 'value';
}
CODE_SAMPLE
)]);

View File

@ -16,11 +16,11 @@ final class VersionResolver
/**
* @var string
*/
public const PACKAGE_VERSION = '2c0f802aaf18f2fb5087c38b50f6ffc028460694';
public const PACKAGE_VERSION = 'e33bcf19bea2d31916641ad6e276c39bcec41cfe';
/**
* @var string
*/
public const RELEASE_DATE = '2022-05-18 10:07:35';
public const RELEASE_DATE = '2022-05-18 12:41:43';
/**
* @var string
*/

View File

@ -369,6 +369,22 @@ final class BetterStandardPrinter extends \PhpParser\PrettyPrinter\Standard impl
}
return $result;
}
/**
* Override parent pModifiers to set position of final and abstract modifier early, so instead of
*
* public final const MY_CONSTANT = "Hello world!";
*
* it should be
*
* final public const MY_CONSTANT = "Hello world!";
*
* @see https://github.com/rectorphp/rector/issues/6963
* @see https://github.com/nikic/PHP-Parser/pull/826
*/
protected function pModifiers(int $modifiers) : string
{
return (($modifiers & \PhpParser\Node\Stmt\Class_::MODIFIER_FINAL) !== 0 ? 'final ' : '') . (($modifiers & \PhpParser\Node\Stmt\Class_::MODIFIER_ABSTRACT) !== 0 ? 'abstract ' : '') . (($modifiers & \PhpParser\Node\Stmt\Class_::MODIFIER_PUBLIC) !== 0 ? 'public ' : '') . (($modifiers & \PhpParser\Node\Stmt\Class_::MODIFIER_PROTECTED) !== 0 ? 'protected ' : '') . (($modifiers & \PhpParser\Node\Stmt\Class_::MODIFIER_PRIVATE) !== 0 ? 'private ' : '') . (($modifiers & \PhpParser\Node\Stmt\Class_::MODIFIER_STATIC) !== 0 ? 'static ' : '') . (($modifiers & \PhpParser\Node\Stmt\Class_::MODIFIER_READONLY) !== 0 ? 'readonly ' : '');
}
private function resolveContentOnExpr(\PhpParser\Node\Expr $expr, string $content) : string
{
$parentNode = $expr->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::PARENT_NODE);

2
vendor/autoload.php vendored
View File

@ -9,4 +9,4 @@ if (PHP_VERSION_ID < 50600) {
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInitb9435aff3a150692ecf7c4d87c6aa64a::getLoader();
return ComposerAutoloaderInit1dc0cb578cfddda2604f7d6441df792e::getLoader();

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInitb9435aff3a150692ecf7c4d87c6aa64a
class ComposerAutoloaderInit1dc0cb578cfddda2604f7d6441df792e
{
private static $loader;
@ -22,19 +22,19 @@ class ComposerAutoloaderInitb9435aff3a150692ecf7c4d87c6aa64a
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInitb9435aff3a150692ecf7c4d87c6aa64a', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit1dc0cb578cfddda2604f7d6441df792e', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInitb9435aff3a150692ecf7c4d87c6aa64a', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit1dc0cb578cfddda2604f7d6441df792e', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInitb9435aff3a150692ecf7c4d87c6aa64a::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit1dc0cb578cfddda2604f7d6441df792e::getInitializer($loader));
$loader->setClassMapAuthoritative(true);
$loader->register(true);
$includeFiles = \Composer\Autoload\ComposerStaticInitb9435aff3a150692ecf7c4d87c6aa64a::$files;
$includeFiles = \Composer\Autoload\ComposerStaticInit1dc0cb578cfddda2604f7d6441df792e::$files;
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequireb9435aff3a150692ecf7c4d87c6aa64a($fileIdentifier, $file);
composerRequire1dc0cb578cfddda2604f7d6441df792e($fileIdentifier, $file);
}
return $loader;
@ -46,7 +46,7 @@ class ComposerAutoloaderInitb9435aff3a150692ecf7c4d87c6aa64a
* @param string $file
* @return void
*/
function composerRequireb9435aff3a150692ecf7c4d87c6aa64a($fileIdentifier, $file)
function composerRequire1dc0cb578cfddda2604f7d6441df792e($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 ComposerStaticInitb9435aff3a150692ecf7c4d87c6aa64a
class ComposerStaticInit1dc0cb578cfddda2604f7d6441df792e
{
public static $files = array (
'320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
@ -3907,9 +3907,9 @@ class ComposerStaticInitb9435aff3a150692ecf7c4d87c6aa64a
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInitb9435aff3a150692ecf7c4d87c6aa64a::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitb9435aff3a150692ecf7c4d87c6aa64a::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInitb9435aff3a150692ecf7c4d87c6aa64a::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit1dc0cb578cfddda2604f7d6441df792e::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit1dc0cb578cfddda2604f7d6441df792e::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit1dc0cb578cfddda2604f7d6441df792e::$classMap;
}, null, ClassLoader::class);
}

View File

@ -9,8 +9,8 @@ $loader = require_once __DIR__.'/autoload.php';
if (!class_exists('AutoloadIncluder', false) && !interface_exists('AutoloadIncluder', false) && !trait_exists('AutoloadIncluder', false)) {
spl_autoload_call('RectorPrefix20220518\AutoloadIncluder');
}
if (!class_exists('ComposerAutoloaderInitb9435aff3a150692ecf7c4d87c6aa64a', false) && !interface_exists('ComposerAutoloaderInitb9435aff3a150692ecf7c4d87c6aa64a', false) && !trait_exists('ComposerAutoloaderInitb9435aff3a150692ecf7c4d87c6aa64a', false)) {
spl_autoload_call('RectorPrefix20220518\ComposerAutoloaderInitb9435aff3a150692ecf7c4d87c6aa64a');
if (!class_exists('ComposerAutoloaderInit1dc0cb578cfddda2604f7d6441df792e', false) && !interface_exists('ComposerAutoloaderInit1dc0cb578cfddda2604f7d6441df792e', false) && !trait_exists('ComposerAutoloaderInit1dc0cb578cfddda2604f7d6441df792e', false)) {
spl_autoload_call('RectorPrefix20220518\ComposerAutoloaderInit1dc0cb578cfddda2604f7d6441df792e');
}
if (!class_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false) && !interface_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false) && !trait_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false)) {
spl_autoload_call('RectorPrefix20220518\Helmich\TypoScriptParser\Parser\AST\Statement');
@ -59,9 +59,9 @@ if (!function_exists('print_node')) {
return \RectorPrefix20220518\print_node(...func_get_args());
}
}
if (!function_exists('composerRequireb9435aff3a150692ecf7c4d87c6aa64a')) {
function composerRequireb9435aff3a150692ecf7c4d87c6aa64a() {
return \RectorPrefix20220518\composerRequireb9435aff3a150692ecf7c4d87c6aa64a(...func_get_args());
if (!function_exists('composerRequire1dc0cb578cfddda2604f7d6441df792e')) {
function composerRequire1dc0cb578cfddda2604f7d6441df792e() {
return \RectorPrefix20220518\composerRequire1dc0cb578cfddda2604f7d6441df792e(...func_get_args());
}
}
if (!function_exists('scanPath')) {