Skip to content

Commit

Permalink
[Autoloading] Allow to define bootstrapFiles([__DIR__ . '/some.phar']…
Browse files Browse the repository at this point in the history
…) on BootstrapFilesIncluder (#5518)

* [Autoloading] Allow to defined bootstrapFiles([__DIR__ . /phpunit.phar]) on BootstrapFilesIncluder

* [ci-review] Rector Rectify

---------

Co-authored-by: GitHub Action <actions@github.com>
  • Loading branch information
samsonasik and actions-user committed Jan 29, 2024
1 parent 21aa474 commit ca23ae8
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Autoloading/BootstrapFilesIncluder.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Rector\Autoloading;

use Phar;
use FilesystemIterator;
use Rector\Configuration\Option;
use Rector\Configuration\Parameter\SimpleParameterProvider;
Expand Down Expand Up @@ -34,6 +35,12 @@ public function includeBootstrapFiles(): void
throw new ShouldNotHappenException(sprintf('Bootstrap file "%s" does not exist.', $bootstrapFile));
}

// load phar file
if (str_ends_with($bootstrapFile, '.phar')) {
Phar::loadPhar($bootstrapFile);
continue;
}

require $bootstrapFile;
}

Expand Down

0 comments on commit ca23ae8

Please sign in to comment.