Use the autoloader from where Rector was installed, not started (#5772)

* Use the autoloader from where Rector was installed, not started

* Remove autoloader already covered in AutoloadIncluder::includeDependencyOrRepositoryVendorAutoloadIfExists()

* Fix path to project autoloader

When Rector is installed as a project dependency through composer,
this script it will be in {vendor}/rector/rectory/bin/rector.php,
so ../../.. is where autoload.php lives.
This commit is contained in:
Matthias Pigulla 2021-03-04 15:02:07 +01:00 committed by GitHub
parent ab8a1e517d
commit a2e36d5a04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,7 +27,6 @@ $autoloadIncluder = new AutoloadIncluder();
$autoloadIncluder->includeDependencyOrRepositoryVendorAutoloadIfExists();
$autoloadIncluder->loadIfExistsAndNotLoadedYet(__DIR__ . '/../vendor/scoper-autoload.php');
$autoloadIncluder->loadIfExistsAndNotLoadedYet(getcwd() . '/vendor/autoload.php');
$autoloadIncluder->autoloadProjectAutoloaderFile();
$autoloadIncluder->autoloadFromCommandLine();
@ -79,7 +78,7 @@ final class AutoloadIncluder
*/
public function autoloadProjectAutoloaderFile(): void
{
$this->loadIfExistsAndNotLoadedYet(__DIR__ . '/../../autoload.php');
$this->loadIfExistsAndNotLoadedYet(__DIR__ . '/../../../autoload.php');
}
public function autoloadFromCommandLine(): void