-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrector-p
executable file
·40 lines (33 loc) · 1.05 KB
/
rector-p
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
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env php
<?php
if (version_compare('8.1.0', PHP_VERSION, '>')) {
fwrite(STDERR, 'rector-p works only with php version >=8.1 your version is: ' . PHP_VERSION . PHP_EOL);
exit(1);
}
call_user_func(function () {
$possibleAutoloadFiles = [
// if defined use this:
$GLOBALS['_composer_autoload_path'] ?? '',
// php ./vendor/bin/rector-p
__DIR__ . '/../autoload.php',
// php ./bin/rector-p
__DIR__ . '/../vendor/autoload.php',
// php ./rector-p
__DIR__ . '/vendor/autoload.php',
// php ./vendor/andersundsehr/rector-p/rector-p may be symlinked from ./vendor/bin/rector-p
__DIR__ . '/../../autoload.php',
];
$firstVendorAutoloadFile = null;
foreach ($possibleAutoloadFiles as $file) {
if (file_exists($file)) {
$firstVendorAutoloadFile = $file;
break;
}
}
if (!$firstVendorAutoloadFile) {
fwrite(STDERR, 'rector-p could not find any autoload file' . PHP_EOL);
exit(1);
}
require $firstVendorAutoloadFile;
\Andersundsehr\RectorP\RectorPApplication::createApplication()->run();
});