Skip to content

Commit 73f4e05

Browse files
committed
Improve pdepend-summary-formatter
1 parent cd14e3c commit 73f4e05

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

bin/pdepend-summary-formatter

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,26 @@ declare(strict_types=1);
1212

1313
use AndreyTech\Pdepend\Summary\Formatter\Application;
1414

15-
include_once __DIR__ . '/../autoload.php';
15+
(static function() {
16+
foreach ([ '/../', '/../vendor/' ] as $path) {
17+
$autoloadFile = __DIR__ . $path . 'autoload.php';
18+
if (is_file($autoloadFile)) {
19+
if (is_readable($autoloadFile)) {
20+
require_once $autoloadFile;
21+
return;
22+
}
23+
trigger_error('Can not read Composer file "autoload.php"', E_USER_ERROR);
24+
}
25+
}
26+
trigger_error('Can not find Composer file "autoload.php"', E_USER_ERROR);
27+
})();
1628

17-
$application = new Application();
18-
$exitCode = $application->run();
19-
exit($exitCode);
29+
(new class
30+
{
31+
public function __invoke(): void
32+
{
33+
$application = new Application();
34+
$exitCode = $application->run();
35+
exit($exitCode);
36+
}
37+
})();

0 commit comments

Comments
 (0)