mirror of
https://github.com/rectorphp/rector.git
synced 2025-04-21 16:02:23 +02:00
Updated Rector to commit 6b965fe744f438b0614597bec485ad8ec23831d9
6b965fe744
Revert load vendor/autoload from getcwd and add documentation for using globally (not recommended) (#1685)
This commit is contained in:
parent
ad4d6a6ed5
commit
77fe375a0b
@ -72,13 +72,10 @@ final class AutoloadIncluder
|
||||
/**
|
||||
* In case Rector is installed as vendor dependency,
|
||||
* this autoloads the project vendor/autoload.php, including Rector
|
||||
*
|
||||
* This also accounts for running a globally installed Rector from the global composer vendor dir
|
||||
*/
|
||||
public function autoloadProjectAutoloaderFile() : void
|
||||
{
|
||||
$this->loadIfExistsAndNotLoadedYet(__DIR__ . '/../../../autoload.php');
|
||||
$this->loadIfExistsAndNotLoadedYet(\getcwd() . '/vendor/autoload.php');
|
||||
}
|
||||
public function autoloadFromCommandLine() : void
|
||||
{
|
||||
|
@ -76,10 +76,14 @@ If the false positive still happen, you can skip the rule applied as last resort
|
||||
]);
|
||||
```
|
||||
|
||||
### Dealing with "Class ... was not found while trying to analyse it..."
|
||||
## Dealing with "Class ... was not found while trying to analyse it..."
|
||||
Sometimes you may encounter this error ([see here for an example](https://github.com/rectorphp/rector/issues/6688)) even if the class is there and it seems to work properly with other tools (e.g. PHPStan).
|
||||
|
||||
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
|
||||
@ -91,7 +95,15 @@ In this case you may want to try one of the following solutions:
|
||||
]);
|
||||
```
|
||||
|
||||
Other solution is by register the path of the class to composer.json's `"files"` config, eg:
|
||||
### 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:
|
||||
|
||||
```javascript
|
||||
"autoload-dev": {
|
||||
|
@ -16,11 +16,11 @@ final class VersionResolver
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '4ac5dd64203365def3131ff226f65695a37d1b78';
|
||||
public const PACKAGE_VERSION = '6b965fe744f438b0614597bec485ad8ec23831d9';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2022-01-16 08:46:29';
|
||||
public const RELEASE_DATE = '2022-01-16 02:17:12';
|
||||
public static function resolvePackageVersion() : string
|
||||
{
|
||||
$process = new \RectorPrefix20220116\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';
|
||||
|
||||
return ComposerAutoloaderInit45f44610df1bf6e705e2bea6b889fc42::getLoader();
|
||||
return ComposerAutoloaderInit9238a8297075eda80a65ad4865410340::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
|
||||
|
||||
class ComposerAutoloaderInit45f44610df1bf6e705e2bea6b889fc42
|
||||
class ComposerAutoloaderInit9238a8297075eda80a65ad4865410340
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
@ -22,15 +22,15 @@ class ComposerAutoloaderInit45f44610df1bf6e705e2bea6b889fc42
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit45f44610df1bf6e705e2bea6b889fc42', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit9238a8297075eda80a65ad4865410340', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit45f44610df1bf6e705e2bea6b889fc42', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit9238a8297075eda80a65ad4865410340', '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\ComposerStaticInit45f44610df1bf6e705e2bea6b889fc42::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit9238a8297075eda80a65ad4865410340::getInitializer($loader));
|
||||
} else {
|
||||
$classMap = require __DIR__ . '/autoload_classmap.php';
|
||||
if ($classMap) {
|
||||
@ -42,12 +42,12 @@ class ComposerAutoloaderInit45f44610df1bf6e705e2bea6b889fc42
|
||||
$loader->register(true);
|
||||
|
||||
if ($useStaticLoader) {
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInit45f44610df1bf6e705e2bea6b889fc42::$files;
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInit9238a8297075eda80a65ad4865410340::$files;
|
||||
} else {
|
||||
$includeFiles = require __DIR__ . '/autoload_files.php';
|
||||
}
|
||||
foreach ($includeFiles as $fileIdentifier => $file) {
|
||||
composerRequire45f44610df1bf6e705e2bea6b889fc42($fileIdentifier, $file);
|
||||
composerRequire9238a8297075eda80a65ad4865410340($fileIdentifier, $file);
|
||||
}
|
||||
|
||||
return $loader;
|
||||
@ -59,7 +59,7 @@ class ComposerAutoloaderInit45f44610df1bf6e705e2bea6b889fc42
|
||||
* @param string $file
|
||||
* @return void
|
||||
*/
|
||||
function composerRequire45f44610df1bf6e705e2bea6b889fc42($fileIdentifier, $file)
|
||||
function composerRequire9238a8297075eda80a65ad4865410340($fileIdentifier, $file)
|
||||
{
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
||||
|
8
vendor/composer/autoload_static.php
vendored
8
vendor/composer/autoload_static.php
vendored
@ -4,7 +4,7 @@
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInit45f44610df1bf6e705e2bea6b889fc42
|
||||
class ComposerStaticInit9238a8297075eda80a65ad4865410340
|
||||
{
|
||||
public static $files = array (
|
||||
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
|
||||
@ -3865,9 +3865,9 @@ class ComposerStaticInit45f44610df1bf6e705e2bea6b889fc42
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit45f44610df1bf6e705e2bea6b889fc42::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit45f44610df1bf6e705e2bea6b889fc42::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit45f44610df1bf6e705e2bea6b889fc42::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit9238a8297075eda80a65ad4865410340::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit9238a8297075eda80a65ad4865410340::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit9238a8297075eda80a65ad4865410340::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
10
vendor/scoper-autoload.php
vendored
10
vendor/scoper-autoload.php
vendored
@ -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('RectorPrefix20220116\AutoloadIncluder');
|
||||
}
|
||||
if (!class_exists('ComposerAutoloaderInit45f44610df1bf6e705e2bea6b889fc42', false) && !interface_exists('ComposerAutoloaderInit45f44610df1bf6e705e2bea6b889fc42', false) && !trait_exists('ComposerAutoloaderInit45f44610df1bf6e705e2bea6b889fc42', false)) {
|
||||
spl_autoload_call('RectorPrefix20220116\ComposerAutoloaderInit45f44610df1bf6e705e2bea6b889fc42');
|
||||
if (!class_exists('ComposerAutoloaderInit9238a8297075eda80a65ad4865410340', false) && !interface_exists('ComposerAutoloaderInit9238a8297075eda80a65ad4865410340', false) && !trait_exists('ComposerAutoloaderInit9238a8297075eda80a65ad4865410340', false)) {
|
||||
spl_autoload_call('RectorPrefix20220116\ComposerAutoloaderInit9238a8297075eda80a65ad4865410340');
|
||||
}
|
||||
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('RectorPrefix20220116\Helmich\TypoScriptParser\Parser\AST\Statement');
|
||||
@ -71,9 +71,9 @@ if (!function_exists('print_node')) {
|
||||
return \RectorPrefix20220116\print_node(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('composerRequire45f44610df1bf6e705e2bea6b889fc42')) {
|
||||
function composerRequire45f44610df1bf6e705e2bea6b889fc42() {
|
||||
return \RectorPrefix20220116\composerRequire45f44610df1bf6e705e2bea6b889fc42(...func_get_args());
|
||||
if (!function_exists('composerRequire9238a8297075eda80a65ad4865410340')) {
|
||||
function composerRequire9238a8297075eda80a65ad4865410340() {
|
||||
return \RectorPrefix20220116\composerRequire9238a8297075eda80a65ad4865410340(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('scanPath')) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user