-
Notifications
You must be signed in to change notification settings - Fork 93
Expand file tree
/
Copy pathbootstrap.php
More file actions
28 lines (22 loc) · 823 Bytes
/
bootstrap.php
File metadata and controls
28 lines (22 loc) · 823 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
declare(strict_types=1);
// inspired by https://github.com/phpstan/phpstan/blob/master/bootstrap.php
use Composer\Autoload\ClassLoader;
spl_autoload_register(static function (string $class): void {
static $composerAutoloader;
// already loaded in bin/ecs.php
if (defined('__ECS_RUNNING__')) {
return;
}
// load prefixed or native class, e.g. for running tests
if (strpos($class, 'ECSPrefix') === 0 || strpos($class, 'Symplify\\') === 0) {
if ($composerAutoloader === null) {
// prefixed version autoload
$composerAutoloader = require __DIR__ . '/vendor/autoload.php';
}
// avoid autoloading collision
if ($composerAutoloader instanceof ClassLoader) {
$composerAutoloader->loadClass($class);
}
}
});