Updated Rector to commit e5ed2372b9

e5ed2372b9 possible solution for global execution (#1692)
This commit is contained in:
Tomas Votruba 2022-01-18 16:24:12 +00:00
parent 4515eabbc8
commit 42a0272cc5
11 changed files with 55 additions and 50 deletions

View File

@ -30,6 +30,7 @@ if (\file_exists(__DIR__ . '/../preload.php') && \is_dir(__DIR__ . '/../vendor')
require_once __DIR__ . '/../src/constants.php';
$autoloadIncluder->loadIfExistsAndNotLoadedYet(__DIR__ . '/../vendor/scoper-autoload.php');
$autoloadIncluder->autoloadProjectAutoloaderFile();
$autoloadIncluder->autoloadRectorInstalledAsGlobalDependency();
$autoloadIncluder->autoloadFromCommandLine();
$rectorConfigsResolver = new \Rector\Core\Bootstrap\RectorConfigsResolver();
try {
@ -77,6 +78,19 @@ final class AutoloadIncluder
{
$this->loadIfExistsAndNotLoadedYet(__DIR__ . '/../../../autoload.php');
}
/**
* In case Rector is installed as global dependency
*/
public function autoloadRectorInstalledAsGlobalDependency() : void
{
if (\dirname(__DIR__) === \dirname(\getcwd(), 2)) {
return;
}
if (\is_dir('vendor/rector/rector')) {
return;
}
$this->loadIfExistsAndNotLoadedYet('vendor/autoload.php');
}
public function autoloadFromCommandLine() : void
{
$cliArgs = $_SERVER['argv'];

View File

@ -83,7 +83,6 @@ In this case you may want to try one of the following solutions:
### Register to `Option::AUTOLOAD_PATHS`:
```php
$parameters->set(Option::AUTOLOAD_PATHS, [
// the path to the exact class file
@ -95,15 +94,7 @@ In this case you may want to try one of the following solutions:
]);
```
### Call command with `-a` option
This may happen when you're using rector globally (not recommended as autoload may overlapped)
```bash
rector process -a vendor/autoload.php
```
### Other solution is by register the path of the class to composer.json's `"files"` config, eg:
### Register the path of the class to composer.json's `"files"` config, eg:
```javascript
"autoload-dev": {

View File

@ -16,11 +16,11 @@ final class VersionResolver
/**
* @var string
*/
public const PACKAGE_VERSION = '71719b5e05ddb03c627a56c379b20a5829ddbe4f';
public const PACKAGE_VERSION = 'e5ed2372b9551e9b10a7fad5fc9dbd85a54d5d88';
/**
* @var string
*/
public const RELEASE_DATE = '2022-01-18 16:37:45';
public const RELEASE_DATE = '2022-01-18 16:17:01';
public static function resolvePackageVersion() : string
{
$process = new \RectorPrefix20220118\Symfony\Component\Process\Process(['git', 'log', '--pretty="%H"', '-n1', 'HEAD'], __DIR__);

2
vendor/autoload.php vendored
View File

@ -4,4 +4,4 @@
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit15971da685a21759ea75cb1a52bfdcf0::getLoader();
return ComposerAutoloaderInit664cfcc3a4e56d5cc91e7213e18eb208::getLoader();

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit15971da685a21759ea75cb1a52bfdcf0
class ComposerAutoloaderInit664cfcc3a4e56d5cc91e7213e18eb208
{
private static $loader;
@ -22,15 +22,15 @@ class ComposerAutoloaderInit15971da685a21759ea75cb1a52bfdcf0
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit15971da685a21759ea75cb1a52bfdcf0', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit664cfcc3a4e56d5cc91e7213e18eb208', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
spl_autoload_unregister(array('ComposerAutoloaderInit15971da685a21759ea75cb1a52bfdcf0', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit664cfcc3a4e56d5cc91e7213e18eb208', '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\ComposerStaticInit15971da685a21759ea75cb1a52bfdcf0::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit664cfcc3a4e56d5cc91e7213e18eb208::getInitializer($loader));
} else {
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
@ -42,12 +42,12 @@ class ComposerAutoloaderInit15971da685a21759ea75cb1a52bfdcf0
$loader->register(true);
if ($useStaticLoader) {
$includeFiles = Composer\Autoload\ComposerStaticInit15971da685a21759ea75cb1a52bfdcf0::$files;
$includeFiles = Composer\Autoload\ComposerStaticInit664cfcc3a4e56d5cc91e7213e18eb208::$files;
} else {
$includeFiles = require __DIR__ . '/autoload_files.php';
}
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequire15971da685a21759ea75cb1a52bfdcf0($fileIdentifier, $file);
composerRequire664cfcc3a4e56d5cc91e7213e18eb208($fileIdentifier, $file);
}
return $loader;
@ -59,7 +59,7 @@ class ComposerAutoloaderInit15971da685a21759ea75cb1a52bfdcf0
* @param string $file
* @return void
*/
function composerRequire15971da685a21759ea75cb1a52bfdcf0($fileIdentifier, $file)
function composerRequire664cfcc3a4e56d5cc91e7213e18eb208($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 ComposerStaticInit15971da685a21759ea75cb1a52bfdcf0
class ComposerStaticInit664cfcc3a4e56d5cc91e7213e18eb208
{
public static $files = array (
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
@ -3872,9 +3872,9 @@ class ComposerStaticInit15971da685a21759ea75cb1a52bfdcf0
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit15971da685a21759ea75cb1a52bfdcf0::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit15971da685a21759ea75cb1a52bfdcf0::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit15971da685a21759ea75cb1a52bfdcf0::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit664cfcc3a4e56d5cc91e7213e18eb208::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit664cfcc3a4e56d5cc91e7213e18eb208::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit664cfcc3a4e56d5cc91e7213e18eb208::$classMap;
}, null, ClassLoader::class);
}

View File

@ -1012,17 +1012,17 @@
},
{
"name": "phpstan\/phpstan",
"version": "1.4.1",
"version_normalized": "1.4.1.0",
"version": "1.4.2",
"version_normalized": "1.4.2.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/phpstan\/phpstan.git",
"reference": "5bd02c86beb4c024dd4662b6443f5d5332a0ae12"
"reference": "1dd8f3e40bf7aa30031a75c65cece99220a161b8"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/phpstan\/phpstan\/zipball\/5bd02c86beb4c024dd4662b6443f5d5332a0ae12",
"reference": "5bd02c86beb4c024dd4662b6443f5d5332a0ae12",
"url": "https:\/\/api.github.com\/repos\/phpstan\/phpstan\/zipball\/1dd8f3e40bf7aa30031a75c65cece99220a161b8",
"reference": "1dd8f3e40bf7aa30031a75c65cece99220a161b8",
"shasum": ""
},
"require": {
@ -1031,7 +1031,7 @@
"conflict": {
"phpstan\/phpstan-shim": "*"
},
"time": "2022-01-17T16:35:17+00:00",
"time": "2022-01-18T16:09:11+00:00",
"bin": [
"phpstan",
"phpstan.phar"
@ -1055,7 +1055,7 @@
"description": "PHPStan - PHP Static Analysis Tool",
"support": {
"issues": "https:\/\/github.com\/phpstan\/phpstan\/issues",
"source": "https:\/\/github.com\/phpstan\/phpstan\/tree\/1.4.1"
"source": "https:\/\/github.com\/phpstan\/phpstan\/tree\/1.4.2"
},
"funding": [
{

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -1,16 +1,16 @@
-----BEGIN PGP SIGNATURE-----
iQIzBAABCgAdFiEE0yaA1ZV9xxFr4pwUzxoQjQ565yAFAmHlmsQACgkQzxoQjQ56
5yBa8w//ae7XwHT53Cs8Clfya7v6qM4VwjHdxR4gd5LnictO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0N2a+Pn3CW56ad2DX7ekqV5pgC1f+8
ct1GeOPqCvw2zt1tOTNOKV/MYn0R/Ljfc5c2g4zf6jBDElUQESBKcxo/wuLaW2b8
LVstZd+0Id8QqEUrNMm6BNyoaRz+wCQYYQYeoDjO41kvNboQwJ2ikDZnsKN36TbU
wU67CtJc6mtWyQJb9ERITQxhaRbJoaSzDXn8/bR2PGhd+WRNCNxeUcdhlpO9+CCE
2N1GlcEGDb92pM88TfI+x2nXWy1uqiZTAc4CkAfuUQSbsg9zdLgrqQIPKPykg06+
JHz56msOJ5Do0/K1CY+NQbvKFCj8lTIgcB/X4Srd+L4Tqq763nE=
=binr
-----END PGP SIGNATURE-----

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('RectorPrefix20220118\AutoloadIncluder');
}
if (!class_exists('ComposerAutoloaderInit15971da685a21759ea75cb1a52bfdcf0', false) && !interface_exists('ComposerAutoloaderInit15971da685a21759ea75cb1a52bfdcf0', false) && !trait_exists('ComposerAutoloaderInit15971da685a21759ea75cb1a52bfdcf0', false)) {
spl_autoload_call('RectorPrefix20220118\ComposerAutoloaderInit15971da685a21759ea75cb1a52bfdcf0');
if (!class_exists('ComposerAutoloaderInit664cfcc3a4e56d5cc91e7213e18eb208', false) && !interface_exists('ComposerAutoloaderInit664cfcc3a4e56d5cc91e7213e18eb208', false) && !trait_exists('ComposerAutoloaderInit664cfcc3a4e56d5cc91e7213e18eb208', false)) {
spl_autoload_call('RectorPrefix20220118\ComposerAutoloaderInit664cfcc3a4e56d5cc91e7213e18eb208');
}
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('RectorPrefix20220118\Helmich\TypoScriptParser\Parser\AST\Statement');
@ -71,9 +71,9 @@ if (!function_exists('print_node')) {
return \RectorPrefix20220118\print_node(...func_get_args());
}
}
if (!function_exists('composerRequire15971da685a21759ea75cb1a52bfdcf0')) {
function composerRequire15971da685a21759ea75cb1a52bfdcf0() {
return \RectorPrefix20220118\composerRequire15971da685a21759ea75cb1a52bfdcf0(...func_get_args());
if (!function_exists('composerRequire664cfcc3a4e56d5cc91e7213e18eb208')) {
function composerRequire664cfcc3a4e56d5cc91e7213e18eb208() {
return \RectorPrefix20220118\composerRequire664cfcc3a4e56d5cc91e7213e18eb208(...func_get_args());
}
}
if (!function_exists('scanPath')) {