mirror of https://github.com/rectorphp/rector.git
Updated Rector to commit 651e283c439ef593c6609ccc2623e11142544f4f
651e283c43
The php-parser 5.0 is far away from release, no need to include it for now (#3355)
This commit is contained in:
parent
b971f67811
commit
0a33500839
|
@ -23,7 +23,6 @@
|
||||||
"rector/rector-phpunit": "*",
|
"rector/rector-phpunit": "*",
|
||||||
"rector/rector-symfony": "*",
|
"rector/rector-symfony": "*",
|
||||||
"rector/rector-doctrine": "*",
|
"rector/rector-doctrine": "*",
|
||||||
"rector/rector-php-parser": "*",
|
|
||||||
"rector/rector-downgrade-php": "*"
|
"rector/rector-downgrade-php": "*"
|
||||||
},
|
},
|
||||||
"minimum-stability": "dev",
|
"minimum-stability": "dev",
|
||||||
|
|
|
@ -19,12 +19,12 @@ final class VersionResolver
|
||||||
* @api
|
* @api
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public const PACKAGE_VERSION = '51fcdc2639267a875c3d5c1a985800104e984ead';
|
public const PACKAGE_VERSION = '651e283c439ef593c6609ccc2623e11142544f4f';
|
||||||
/**
|
/**
|
||||||
* @api
|
* @api
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public const RELEASE_DATE = '2023-02-07 16:50:52';
|
public const RELEASE_DATE = '2023-02-07 16:57:06';
|
||||||
/**
|
/**
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) {
|
||||||
|
|
||||||
require_once __DIR__ . '/composer/autoload_real.php';
|
require_once __DIR__ . '/composer/autoload_real.php';
|
||||||
|
|
||||||
return ComposerAutoloaderInitcc56f372859d250d46691667baa25a8f::getLoader();
|
return ComposerAutoloaderInit576dff0c2e3cd10b4aa48e61961493e9::getLoader();
|
||||||
|
|
|
@ -2348,8 +2348,6 @@ return array(
|
||||||
'Rector\\PhpDocParser\\PhpParser\\SmartPhpParserFactory' => $baseDir . '/packages/PhpDocParser/PhpParser/SmartPhpParserFactory.php',
|
'Rector\\PhpDocParser\\PhpParser\\SmartPhpParserFactory' => $baseDir . '/packages/PhpDocParser/PhpParser/SmartPhpParserFactory.php',
|
||||||
'Rector\\PhpDocParser\\TypeAnalyzer\\ClassMethodReturnTypeResolver' => $baseDir . '/packages/PhpDocParser/TypeAnalyzer/ClassMethodReturnTypeResolver.php',
|
'Rector\\PhpDocParser\\TypeAnalyzer\\ClassMethodReturnTypeResolver' => $baseDir . '/packages/PhpDocParser/TypeAnalyzer/ClassMethodReturnTypeResolver.php',
|
||||||
'Rector\\PhpDocParser\\ValueObject\\AttributeKey' => $baseDir . '/packages/PhpDocParser/ValueObject/AttributeKey.php',
|
'Rector\\PhpDocParser\\ValueObject\\AttributeKey' => $baseDir . '/packages/PhpDocParser/ValueObject/AttributeKey.php',
|
||||||
'Rector\\PhpParser\\Rector\\MethodCall\\ParserFactoryRector' => $vendorDir . '/rector/rector-php-parser/src/Rector/MethodCall/ParserFactoryRector.php',
|
|
||||||
'Rector\\PhpParser\\Set\\PhpParserSetList' => $vendorDir . '/rector/rector-php-parser/src/Set/PhpParserSetList.php',
|
|
||||||
'Rector\\PostRector\\Application\\PostFileProcessor' => $baseDir . '/packages/PostRector/Application/PostFileProcessor.php',
|
'Rector\\PostRector\\Application\\PostFileProcessor' => $baseDir . '/packages/PostRector/Application/PostFileProcessor.php',
|
||||||
'Rector\\PostRector\\Collector\\NodesToAddCollector' => $baseDir . '/packages/PostRector/Collector/NodesToAddCollector.php',
|
'Rector\\PostRector\\Collector\\NodesToAddCollector' => $baseDir . '/packages/PostRector/Collector/NodesToAddCollector.php',
|
||||||
'Rector\\PostRector\\Collector\\NodesToRemoveCollector' => $baseDir . '/packages/PostRector/Collector/NodesToRemoveCollector.php',
|
'Rector\\PostRector\\Collector\\NodesToRemoveCollector' => $baseDir . '/packages/PostRector/Collector/NodesToRemoveCollector.php',
|
||||||
|
|
|
@ -12,7 +12,6 @@ return array(
|
||||||
'Rector\\Utils\\' => array($baseDir . '/utils'),
|
'Rector\\Utils\\' => array($baseDir . '/utils'),
|
||||||
'Rector\\Symfony\\' => array($vendorDir . '/rector/rector-symfony/src'),
|
'Rector\\Symfony\\' => array($vendorDir . '/rector/rector-symfony/src'),
|
||||||
'Rector\\RectorInstaller\\' => array($vendorDir . '/rector/extension-installer/src'),
|
'Rector\\RectorInstaller\\' => array($vendorDir . '/rector/extension-installer/src'),
|
||||||
'Rector\\PhpParser\\' => array($vendorDir . '/rector/rector-php-parser/src'),
|
|
||||||
'Rector\\PHPUnit\\' => array($vendorDir . '/rector/rector-phpunit/src'),
|
'Rector\\PHPUnit\\' => array($vendorDir . '/rector/rector-phpunit/src'),
|
||||||
'Rector\\Doctrine\\' => array($vendorDir . '/rector/rector-doctrine/src'),
|
'Rector\\Doctrine\\' => array($vendorDir . '/rector/rector-doctrine/src'),
|
||||||
'Rector\\Core\\' => array($baseDir . '/src'),
|
'Rector\\Core\\' => array($baseDir . '/src'),
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
// autoload_real.php @generated by Composer
|
// autoload_real.php @generated by Composer
|
||||||
|
|
||||||
class ComposerAutoloaderInitcc56f372859d250d46691667baa25a8f
|
class ComposerAutoloaderInit576dff0c2e3cd10b4aa48e61961493e9
|
||||||
{
|
{
|
||||||
private static $loader;
|
private static $loader;
|
||||||
|
|
||||||
|
@ -22,17 +22,17 @@ class ComposerAutoloaderInitcc56f372859d250d46691667baa25a8f
|
||||||
return self::$loader;
|
return self::$loader;
|
||||||
}
|
}
|
||||||
|
|
||||||
spl_autoload_register(array('ComposerAutoloaderInitcc56f372859d250d46691667baa25a8f', 'loadClassLoader'), true, true);
|
spl_autoload_register(array('ComposerAutoloaderInit576dff0c2e3cd10b4aa48e61961493e9', 'loadClassLoader'), true, true);
|
||||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||||
spl_autoload_unregister(array('ComposerAutoloaderInitcc56f372859d250d46691667baa25a8f', 'loadClassLoader'));
|
spl_autoload_unregister(array('ComposerAutoloaderInit576dff0c2e3cd10b4aa48e61961493e9', 'loadClassLoader'));
|
||||||
|
|
||||||
require __DIR__ . '/autoload_static.php';
|
require __DIR__ . '/autoload_static.php';
|
||||||
call_user_func(\Composer\Autoload\ComposerStaticInitcc56f372859d250d46691667baa25a8f::getInitializer($loader));
|
call_user_func(\Composer\Autoload\ComposerStaticInit576dff0c2e3cd10b4aa48e61961493e9::getInitializer($loader));
|
||||||
|
|
||||||
$loader->setClassMapAuthoritative(true);
|
$loader->setClassMapAuthoritative(true);
|
||||||
$loader->register(true);
|
$loader->register(true);
|
||||||
|
|
||||||
$filesToLoad = \Composer\Autoload\ComposerStaticInitcc56f372859d250d46691667baa25a8f::$files;
|
$filesToLoad = \Composer\Autoload\ComposerStaticInit576dff0c2e3cd10b4aa48e61961493e9::$files;
|
||||||
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
|
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
|
||||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||||
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
namespace Composer\Autoload;
|
namespace Composer\Autoload;
|
||||||
|
|
||||||
class ComposerStaticInitcc56f372859d250d46691667baa25a8f
|
class ComposerStaticInit576dff0c2e3cd10b4aa48e61961493e9
|
||||||
{
|
{
|
||||||
public static $files = array (
|
public static $files = array (
|
||||||
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
||||||
|
@ -31,7 +31,6 @@ class ComposerStaticInitcc56f372859d250d46691667baa25a8f
|
||||||
'Rector\\Utils\\' => 13,
|
'Rector\\Utils\\' => 13,
|
||||||
'Rector\\Symfony\\' => 15,
|
'Rector\\Symfony\\' => 15,
|
||||||
'Rector\\RectorInstaller\\' => 23,
|
'Rector\\RectorInstaller\\' => 23,
|
||||||
'Rector\\PhpParser\\' => 17,
|
|
||||||
'Rector\\PHPUnit\\' => 15,
|
'Rector\\PHPUnit\\' => 15,
|
||||||
'Rector\\Doctrine\\' => 16,
|
'Rector\\Doctrine\\' => 16,
|
||||||
'Rector\\Core\\' => 12,
|
'Rector\\Core\\' => 12,
|
||||||
|
@ -100,10 +99,6 @@ class ComposerStaticInitcc56f372859d250d46691667baa25a8f
|
||||||
array (
|
array (
|
||||||
0 => __DIR__ . '/..' . '/rector/extension-installer/src',
|
0 => __DIR__ . '/..' . '/rector/extension-installer/src',
|
||||||
),
|
),
|
||||||
'Rector\\PhpParser\\' =>
|
|
||||||
array (
|
|
||||||
0 => __DIR__ . '/..' . '/rector/rector-php-parser/src',
|
|
||||||
),
|
|
||||||
'Rector\\PHPUnit\\' =>
|
'Rector\\PHPUnit\\' =>
|
||||||
array (
|
array (
|
||||||
0 => __DIR__ . '/..' . '/rector/rector-phpunit/src',
|
0 => __DIR__ . '/..' . '/rector/rector-phpunit/src',
|
||||||
|
@ -2600,8 +2595,6 @@ class ComposerStaticInitcc56f372859d250d46691667baa25a8f
|
||||||
'Rector\\PhpDocParser\\PhpParser\\SmartPhpParserFactory' => __DIR__ . '/../..' . '/packages/PhpDocParser/PhpParser/SmartPhpParserFactory.php',
|
'Rector\\PhpDocParser\\PhpParser\\SmartPhpParserFactory' => __DIR__ . '/../..' . '/packages/PhpDocParser/PhpParser/SmartPhpParserFactory.php',
|
||||||
'Rector\\PhpDocParser\\TypeAnalyzer\\ClassMethodReturnTypeResolver' => __DIR__ . '/../..' . '/packages/PhpDocParser/TypeAnalyzer/ClassMethodReturnTypeResolver.php',
|
'Rector\\PhpDocParser\\TypeAnalyzer\\ClassMethodReturnTypeResolver' => __DIR__ . '/../..' . '/packages/PhpDocParser/TypeAnalyzer/ClassMethodReturnTypeResolver.php',
|
||||||
'Rector\\PhpDocParser\\ValueObject\\AttributeKey' => __DIR__ . '/../..' . '/packages/PhpDocParser/ValueObject/AttributeKey.php',
|
'Rector\\PhpDocParser\\ValueObject\\AttributeKey' => __DIR__ . '/../..' . '/packages/PhpDocParser/ValueObject/AttributeKey.php',
|
||||||
'Rector\\PhpParser\\Rector\\MethodCall\\ParserFactoryRector' => __DIR__ . '/..' . '/rector/rector-php-parser/src/Rector/MethodCall/ParserFactoryRector.php',
|
|
||||||
'Rector\\PhpParser\\Set\\PhpParserSetList' => __DIR__ . '/..' . '/rector/rector-php-parser/src/Set/PhpParserSetList.php',
|
|
||||||
'Rector\\PostRector\\Application\\PostFileProcessor' => __DIR__ . '/../..' . '/packages/PostRector/Application/PostFileProcessor.php',
|
'Rector\\PostRector\\Application\\PostFileProcessor' => __DIR__ . '/../..' . '/packages/PostRector/Application/PostFileProcessor.php',
|
||||||
'Rector\\PostRector\\Collector\\NodesToAddCollector' => __DIR__ . '/../..' . '/packages/PostRector/Collector/NodesToAddCollector.php',
|
'Rector\\PostRector\\Collector\\NodesToAddCollector' => __DIR__ . '/../..' . '/packages/PostRector/Collector/NodesToAddCollector.php',
|
||||||
'Rector\\PostRector\\Collector\\NodesToRemoveCollector' => __DIR__ . '/../..' . '/packages/PostRector/Collector/NodesToRemoveCollector.php',
|
'Rector\\PostRector\\Collector\\NodesToRemoveCollector' => __DIR__ . '/../..' . '/packages/PostRector/Collector/NodesToRemoveCollector.php',
|
||||||
|
@ -3106,9 +3099,9 @@ class ComposerStaticInitcc56f372859d250d46691667baa25a8f
|
||||||
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 = ComposerStaticInitcc56f372859d250d46691667baa25a8f::$prefixLengthsPsr4;
|
$loader->prefixLengthsPsr4 = ComposerStaticInit576dff0c2e3cd10b4aa48e61961493e9::$prefixLengthsPsr4;
|
||||||
$loader->prefixDirsPsr4 = ComposerStaticInitcc56f372859d250d46691667baa25a8f::$prefixDirsPsr4;
|
$loader->prefixDirsPsr4 = ComposerStaticInit576dff0c2e3cd10b4aa48e61961493e9::$prefixDirsPsr4;
|
||||||
$loader->classMap = ComposerStaticInitcc56f372859d250d46691667baa25a8f::$classMap;
|
$loader->classMap = ComposerStaticInit576dff0c2e3cd10b4aa48e61961493e9::$classMap;
|
||||||
|
|
||||||
}, null, ClassLoader::class);
|
}, null, ClassLoader::class);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1983,75 +1983,6 @@
|
||||||
},
|
},
|
||||||
"install-path": "..\/rector\/rector-downgrade-php"
|
"install-path": "..\/rector\/rector-downgrade-php"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "rector\/rector-php-parser",
|
|
||||||
"version": "dev-main",
|
|
||||||
"version_normalized": "dev-main",
|
|
||||||
"source": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https:\/\/github.com\/rectorphp\/rector-php-parser.git",
|
|
||||||
"reference": "9639ef9429f74c14fdc3c7dad9d3b0d916663de0"
|
|
||||||
},
|
|
||||||
"dist": {
|
|
||||||
"type": "zip",
|
|
||||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-php-parser\/zipball\/9639ef9429f74c14fdc3c7dad9d3b0d916663de0",
|
|
||||||
"reference": "9639ef9429f74c14fdc3c7dad9d3b0d916663de0",
|
|
||||||
"shasum": ""
|
|
||||||
},
|
|
||||||
"require": {
|
|
||||||
"php": ">=8.1"
|
|
||||||
},
|
|
||||||
"conflict": {
|
|
||||||
"rector\/rector": "<0.12"
|
|
||||||
},
|
|
||||||
"require-dev": {
|
|
||||||
"phpstan\/extension-installer": "^1.1",
|
|
||||||
"phpstan\/phpstan": "^1.8.2",
|
|
||||||
"phpstan\/phpstan-strict-rules": "^1.3",
|
|
||||||
"phpstan\/phpstan-webmozart-assert": "^1.2",
|
|
||||||
"phpunit\/phpunit": "^10.0",
|
|
||||||
"rector\/phpstan-rules": "^0.6",
|
|
||||||
"rector\/rector-debugging": "dev-main",
|
|
||||||
"rector\/rector-generator": "^0.6.13",
|
|
||||||
"rector\/rector-src": "dev-main",
|
|
||||||
"symplify\/easy-ci": "11.2.0.72",
|
|
||||||
"symplify\/easy-coding-standard": "^11.1",
|
|
||||||
"symplify\/phpstan-extensions": "^11.1",
|
|
||||||
"symplify\/phpstan-rules": "^11.1",
|
|
||||||
"symplify\/rule-doc-generator": "^11.1",
|
|
||||||
"symplify\/vendor-patches": "^11.1"
|
|
||||||
},
|
|
||||||
"time": "2023-02-03T18:17:36+00:00",
|
|
||||||
"default-branch": true,
|
|
||||||
"type": "rector-extension",
|
|
||||||
"extra": {
|
|
||||||
"enable-patching": true,
|
|
||||||
"branch-alias": {
|
|
||||||
"dev-main": "0.11-dev"
|
|
||||||
},
|
|
||||||
"rector": {
|
|
||||||
"includes": [
|
|
||||||
"config\/config.php"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"installation-source": "dist",
|
|
||||||
"autoload": {
|
|
||||||
"psr-4": {
|
|
||||||
"Rector\\PhpParser\\": "src"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"notification-url": "https:\/\/packagist.org\/downloads\/",
|
|
||||||
"license": [
|
|
||||||
"MIT"
|
|
||||||
],
|
|
||||||
"description": "Rector upgrades rules for PHP-Parser",
|
|
||||||
"support": {
|
|
||||||
"issues": "https:\/\/github.com\/rectorphp\/rector-php-parser\/issues",
|
|
||||||
"source": "https:\/\/github.com\/rectorphp\/rector-php-parser\/tree\/main"
|
|
||||||
},
|
|
||||||
"install-path": "..\/rector\/rector-php-parser"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "rector\/rector-phpunit",
|
"name": "rector\/rector-phpunit",
|
||||||
"version": "dev-main",
|
"version": "dev-main",
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -9,7 +9,7 @@ namespace Rector\RectorInstaller;
|
||||||
*/
|
*/
|
||||||
final class GeneratedConfig
|
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 ea9cf46'), '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 46346e2'), 'rector/rector-php-parser' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-php-parser', 'relative_install_path' => '../../rector-php-parser', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 9639ef9'), '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 ee461b1'), '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 89e994f'));
|
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 ea9cf46'), '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 46346e2'), '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 ee461b1'), '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 89e994f'));
|
||||||
private function __construct()
|
private function __construct()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
The MIT License
|
|
||||||
---------------
|
|
||||||
|
|
||||||
Copyright (c) 2017-present Tomáš Votruba (https://tomasvotruba.cz)
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person
|
|
||||||
obtaining a copy of this software and associated documentation
|
|
||||||
files (the "Software"), to deal in the Software without
|
|
||||||
restriction, including without limitation the rights to use,
|
|
||||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the
|
|
||||||
Software is furnished to do so, subject to the following
|
|
||||||
conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be
|
|
||||||
included in all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
||||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
||||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
||||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
||||||
OTHER DEALINGS IN THE SOFTWARE.
|
|
|
@ -1,39 +0,0 @@
|
||||||
# Rector Rules for PHPParser
|
|
||||||
|
|
||||||
See available [PHPParser rules](/docs/rector_rules_overview.md)
|
|
||||||
|
|
||||||
## Install
|
|
||||||
|
|
||||||
This package is already part of [rector/rector](http://github.com/rectorphp/rector) package, so it works out of the box.
|
|
||||||
|
|
||||||
All you need to do is install the main package, and you're good to go:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
composer require rector/rector --dev
|
|
||||||
```
|
|
||||||
|
|
||||||
## Use Sets
|
|
||||||
|
|
||||||
To add a set to your config, use `Rector\PhpParser\Set\PhpParserSetList` class and pick one of constants:
|
|
||||||
|
|
||||||
```php
|
|
||||||
use Rector\PhpParser\Set\PhpParserSetList;
|
|
||||||
use Rector\Config\RectorConfig;
|
|
||||||
|
|
||||||
return static function (RectorConfig $rectorConfig): void {
|
|
||||||
$rectorConfig->sets([
|
|
||||||
PhpParserSetList::PHP_PARSER_50
|
|
||||||
]);
|
|
||||||
};
|
|
||||||
```
|
|
||||||
|
|
||||||
<br>
|
|
||||||
|
|
||||||
## Learn Rector Faster
|
|
||||||
|
|
||||||
Rector is a tool that [we develop](https://getrector.org/) and share for free, so anyone can save hundreds of hours on refactoring. But not everyone has time to understand Rector and AST complexity. You have 2 ways to speed this process up:
|
|
||||||
|
|
||||||
* read a book - <a href="https://leanpub.com/rector-the-power-of-automated-refactoring">The Power of Automated Refactoring</a>
|
|
||||||
* hire our experienced team to <a href="https://getrector.org/contact">improve your code base</a>
|
|
||||||
|
|
||||||
Both ways support us to and improve Rector in sustainable way by learning from practical projects.
|
|
|
@ -1,68 +0,0 @@
|
||||||
{
|
|
||||||
"name": "rector\/rector-php-parser",
|
|
||||||
"type": "rector-extension",
|
|
||||||
"license": "MIT",
|
|
||||||
"description": "Rector upgrades rules for PHP-Parser",
|
|
||||||
"require": {
|
|
||||||
"php": ">=8.1"
|
|
||||||
},
|
|
||||||
"require-dev": {
|
|
||||||
"phpstan\/extension-installer": "^1.1",
|
|
||||||
"phpunit\/phpunit": "^10.0",
|
|
||||||
"rector\/phpstan-rules": "^0.6",
|
|
||||||
"phpstan\/phpstan": "^1.8.2",
|
|
||||||
"symplify\/phpstan-rules": "^11.1",
|
|
||||||
"symplify\/phpstan-extensions": "^11.1",
|
|
||||||
"symplify\/easy-coding-standard": "^11.1",
|
|
||||||
"symplify\/rule-doc-generator": "^11.1",
|
|
||||||
"rector\/rector-src": "dev-main",
|
|
||||||
"phpstan\/phpstan-strict-rules": "^1.3",
|
|
||||||
"phpstan\/phpstan-webmozart-assert": "^1.2",
|
|
||||||
"symplify\/vendor-patches": "^11.1",
|
|
||||||
"rector\/rector-debugging": "dev-main",
|
|
||||||
"rector\/rector-generator": "^0.6.13",
|
|
||||||
"symplify\/easy-ci": "11.2.0.72"
|
|
||||||
},
|
|
||||||
"autoload": {
|
|
||||||
"psr-4": {
|
|
||||||
"Rector\\PhpParser\\": "src"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"autoload-dev": {
|
|
||||||
"psr-4": {
|
|
||||||
"Rector\\PhpParser\\Tests\\": "tests"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"phpstan": "vendor\/bin\/phpstan analyse --ansi --error-format symplify",
|
|
||||||
"check-cs": "vendor\/bin\/ecs check --ansi",
|
|
||||||
"fix-cs": "vendor\/bin\/ecs check --fix --ansi",
|
|
||||||
"docs": [
|
|
||||||
"vendor\/bin\/rule-doc-generator generate src --output-file docs\/rector_rules_overview.md --ansi",
|
|
||||||
"vendor\/bin\/ecs check-markdown docs\/rector_rules_overview.md --ansi --fix"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"extra": {
|
|
||||||
"enable-patching": true,
|
|
||||||
"branch-alias": {
|
|
||||||
"dev-main": "0.11-dev"
|
|
||||||
},
|
|
||||||
"rector": {
|
|
||||||
"includes": [
|
|
||||||
"config\/config.php"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"conflict": {
|
|
||||||
"rector\/rector": "<0.12"
|
|
||||||
},
|
|
||||||
"minimum-stability": "dev",
|
|
||||||
"prefer-stable": true,
|
|
||||||
"config": {
|
|
||||||
"allow-plugins": {
|
|
||||||
"cweagans\/composer-patches": true,
|
|
||||||
"rector\/extension-installer": true,
|
|
||||||
"phpstan\/extension-installer": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,11 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
declare (strict_types=1);
|
|
||||||
namespace RectorPrefix202302;
|
|
||||||
|
|
||||||
use Rector\Config\RectorConfig;
|
|
||||||
return static function (RectorConfig $rectorConfig) : void {
|
|
||||||
$services = $rectorConfig->services();
|
|
||||||
$services->defaults()->public()->autowire()->autoconfigure();
|
|
||||||
$services->load('Rector\\PhpParser\\', __DIR__ . '/../src')->exclude([__DIR__ . '/../src/Set', __DIR__ . '/../src/Rector', __DIR__ . '/../src/ValueObject']);
|
|
||||||
};
|
|
|
@ -1,22 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
declare (strict_types=1);
|
|
||||||
namespace RectorPrefix202302;
|
|
||||||
|
|
||||||
use Rector\Config\RectorConfig;
|
|
||||||
use Rector\Renaming\Rector\ClassConstFetch\RenameClassConstFetchRector;
|
|
||||||
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
|
|
||||||
use Rector\Renaming\Rector\Name\RenameClassRector;
|
|
||||||
use Rector\Renaming\ValueObject\MethodCallRename;
|
|
||||||
use Rector\Renaming\ValueObject\RenameClassAndConstFetch;
|
|
||||||
/**
|
|
||||||
* @see https://github.com/nikic/PHP-Parser/blob/master/UPGRADE-5.0.md
|
|
||||||
*/
|
|
||||||
return static function (RectorConfig $rectorConfig) : void {
|
|
||||||
// https://github.com/nikic/PHP-Parser/blob/master/UPGRADE-5.0.md#renamed-nodes
|
|
||||||
$rectorConfig->ruleWithConfiguration(RenameClassRector::class, ['PhpParser\\Node\\Scalar\\LNumber' => 'PhpParser\\Node\\Scalar\\Int_', 'PhpParser\\Node\\Scalar\\DNumber' => 'PhpParser\\Node\\Scalar\\Float_', 'PhpParser\\Node\\Scalar\\Encapsed' => 'PhpParser\\Node\\Scalar\\InterpolatedString', 'PhpParser\\Node\\Scalar\\EncapsedStringPart' => 'PhpParser\\Node\\InterpolatedStringPart', 'PhpParser\\Node\\Expr\\ArrayItem' => 'PhpParser\\Node\\ArrayItem', 'PhpParser\\Node\\Expr\\ClosureUse' => 'PhpParser\\Node\\ClosureUse', 'PhpParser\\Node\\Stmt\\DeclareDeclare' => 'PhpParser\\Node\\DeclareItem', 'PhpParser\\Node\\Stmt\\PropertyProperty' => 'PhpParser\\Node\\PropertyItem', 'PhpParser\\Node\\Stmt\\StaticVar' => 'PhpParser\\Node\\StaticVar', 'PhpParser\\Node\\Stmt\\UseUse' => 'PhpParser\\Node\\UseItem']);
|
|
||||||
// https://github.com/nikic/PHP-Parser/blob/master/UPGRADE-5.0.md#modifiers
|
|
||||||
$rectorConfig->ruleWithConfiguration(RenameClassConstFetchRector::class, [new RenameClassAndConstFetch('PhpParser\\Node\\Stmt\\Class_', 'MODIFIER_PUBLIC', 'PhpParser\\Modifiers', 'PUBLIC'), new RenameClassAndConstFetch('PhpParser\\Node\\Stmt\\Class_', 'MODIFIER_PUBLIC', 'PhpParser\\Modifiers', 'PUBLIC'), new RenameClassAndConstFetch('PhpParser\\Node\\Stmt\\Class_', 'MODIFIER_PROTECTED', 'PhpParser\\Modifiers', 'PROTECTED'), new RenameClassAndConstFetch('PhpParser\\Node\\Stmt\\Class_', 'MODIFIER_PRIVATE', 'PhpParser\\Modifiers', 'PRIVATE'), new RenameClassAndConstFetch('PhpParser\\Node\\Stmt\\Class_', 'MODIFIER_STATIC', 'PhpParser\\Modifiers', 'STATIC'), new RenameClassAndConstFetch('PhpParser\\Node\\Stmt\\Class_', 'MODIFIER_ABSTRACT', 'PhpParser\\Modifiers', 'ABSTRACT'), new RenameClassAndConstFetch('PhpParser\\Node\\Stmt\\Class_', 'MODIFIER_FINAL', 'PhpParser\\Modifiers', 'FINAL'), new RenameClassAndConstFetch('PhpParser\\Node\\Stmt\\Class_', 'MODIFIER_READONLY', 'PhpParser\\Modifiers', 'READONLY'), new RenameClassAndConstFetch('PhpParser\\Node\\Stmt\\Class_', 'VISIBILITY_MODIFIER_MASK', 'PhpParser\\Modifiers', 'VISIBILITY_MASK')]);
|
|
||||||
// https://github.com/nikic/PHP-Parser/blob/master/UPGRADE-5.0.md#other-removed-functionality
|
|
||||||
$rectorConfig->ruleWithConfiguration(RenameMethodRector::class, [new MethodCallRename('PhpParser\\Node\\Expr\\MethodCall', 'setTypeHint', 'setType')]);
|
|
||||||
};
|
|
|
@ -1,18 +0,0 @@
|
||||||
# 1 Rules Overview
|
|
||||||
|
|
||||||
## ParserFactoryRector
|
|
||||||
|
|
||||||
Upgrade ParserFactory `create()` method
|
|
||||||
|
|
||||||
- class: [`Rector\PhpParser\Rector\MethodCall\ParserFactoryRector`](../src/Rector/MethodCall/ParserFactoryRector.php)
|
|
||||||
|
|
||||||
```diff
|
|
||||||
use PhpParser\ParserFactory;
|
|
||||||
|
|
||||||
$factory = new ParserFactory;
|
|
||||||
|
|
||||||
-$parser = $factory->create(ParserFactory::PREFER_PHP7);
|
|
||||||
+$parser = $factory->createForNewestSupportedVersion();
|
|
||||||
```
|
|
||||||
|
|
||||||
<br>
|
|
|
@ -1,11 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
declare (strict_types=1);
|
|
||||||
namespace RectorPrefix202302;
|
|
||||||
|
|
||||||
use Rector\Core\Contract\Rector\RectorInterface;
|
|
||||||
use RectorPrefix202302\Symplify\EasyCI\Config\EasyCIConfig;
|
|
||||||
return static function (EasyCIConfig $easyCIConfig) : void {
|
|
||||||
$easyCIConfig->paths([__DIR__ . '/config', __DIR__ . '/src']);
|
|
||||||
$easyCIConfig->typesToSkip([RectorInterface::class, \Rector\Set\Contract\SetListInterface::class]);
|
|
||||||
};
|
|
|
@ -1,17 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
declare (strict_types=1);
|
|
||||||
namespace RectorPrefix202302;
|
|
||||||
|
|
||||||
use Rector\Config\RectorConfig;
|
|
||||||
use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector;
|
|
||||||
use Rector\Set\ValueObject\LevelSetList;
|
|
||||||
use Rector\Set\ValueObject\SetList;
|
|
||||||
return static function (RectorConfig $rectorConfig) : void {
|
|
||||||
$rectorConfig->sets([LevelSetList::UP_TO_PHP_81, SetList::CODE_QUALITY, SetList::DEAD_CODE, SetList::NAMING, \Rector\PHPUnit\Set\PHPUnitSetList::PHPUNIT_100]);
|
|
||||||
$rectorConfig->importNames();
|
|
||||||
$rectorConfig->paths([__DIR__ . '/src', __DIR__ . '/tests']);
|
|
||||||
$rectorConfig->skip([StringClassNameToClassConstantRector::class => [__DIR__ . '/config']]);
|
|
||||||
$rectorConfig->ruleWithConfiguration(StringClassNameToClassConstantRector::class, ['PhpParser\\PhpVersion', 'PhpParser\\ParserFactory']);
|
|
||||||
$rectorConfig->parallel();
|
|
||||||
};
|
|
|
@ -1,76 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
declare (strict_types=1);
|
|
||||||
namespace Rector\PhpParser\Rector\MethodCall;
|
|
||||||
|
|
||||||
use PhpParser\Node;
|
|
||||||
use PhpParser\Node\Arg;
|
|
||||||
use PhpParser\Node\Expr\MethodCall;
|
|
||||||
use PhpParser\Node\Expr\StaticCall;
|
|
||||||
use PhpParser\Node\Identifier;
|
|
||||||
use PhpParser\Node\Name\FullyQualified;
|
|
||||||
use PhpParser\Node\Scalar\String_;
|
|
||||||
use PHPStan\Type\ObjectType;
|
|
||||||
use Rector\Core\Rector\AbstractRector;
|
|
||||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
|
||||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
|
||||||
/**
|
|
||||||
* @changelog https://github.com/nikic/PHP-Parser/blob/master/UPGRADE-5.0.md#changes-to-the-parser-factory
|
|
||||||
*
|
|
||||||
* @see \Rector\PhpParser\Tests\Rector\MethodCall\ParserFactoryRector\ParserFactoryRectorTest
|
|
||||||
*/
|
|
||||||
final class ParserFactoryRector extends AbstractRector
|
|
||||||
{
|
|
||||||
public function getRuleDefinition() : RuleDefinition
|
|
||||||
{
|
|
||||||
return new RuleDefinition('Upgrade ParserFactory create() method', [new CodeSample(<<<'CODE_SAMPLE'
|
|
||||||
use PhpParser\ParserFactory;
|
|
||||||
|
|
||||||
$factory = new ParserFactory;
|
|
||||||
|
|
||||||
$parser = $factory->create(ParserFactory::PREFER_PHP7);
|
|
||||||
CODE_SAMPLE
|
|
||||||
, <<<'CODE_SAMPLE'
|
|
||||||
use PhpParser\ParserFactory;
|
|
||||||
|
|
||||||
$factory = new ParserFactory;
|
|
||||||
|
|
||||||
$parser = $factory->createForNewestSupportedVersion();
|
|
||||||
CODE_SAMPLE
|
|
||||||
)]);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @return array<class-string<Node>>
|
|
||||||
*/
|
|
||||||
public function getNodeTypes() : array
|
|
||||||
{
|
|
||||||
return [MethodCall::class];
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @param MethodCall $node
|
|
||||||
*/
|
|
||||||
public function refactor(Node $node) : ?Node
|
|
||||||
{
|
|
||||||
if (!$this->isObjectType($node->var, new ObjectType('PhpParser\\ParserFactory'))) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (!$this->isName($node->name, 'create')) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
$args = $node->getArgs();
|
|
||||||
$value = $this->valueResolver->getValue($args[0]->value);
|
|
||||||
if ($value === 1) {
|
|
||||||
$node->name = new Identifier('createForNewestSupportedVersion');
|
|
||||||
$node->args = [];
|
|
||||||
return $node;
|
|
||||||
}
|
|
||||||
if ($value === 4) {
|
|
||||||
$node->name = new Identifier('createForVersion');
|
|
||||||
$fullyQualified = new FullyQualified('PhpParser\\PhpVersion');
|
|
||||||
$fromStringStaticCall = new StaticCall($fullyQualified, 'fromString', [new Arg(new String_('5.6'))]);
|
|
||||||
$node->args = [new Arg($fromStringStaticCall)];
|
|
||||||
return $node;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,17 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
declare (strict_types=1);
|
|
||||||
namespace Rector\PhpParser\Set;
|
|
||||||
|
|
||||||
use Rector\Set\Contract\SetListInterface;
|
|
||||||
/**
|
|
||||||
* @api
|
|
||||||
*/
|
|
||||||
final class PhpParserSetList implements SetListInterface
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @api
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
public const PHP_PARSER_50 = __DIR__ . '/../../config/sets/php-parser-50.php';
|
|
||||||
}
|
|
Loading…
Reference in New Issue