1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-04 02:27:59 +01:00
psalm/tests/fixtures/SuicidalAutoloader/autoloader.php
Bruce Weirdan 56047dd094
Use composer/package-versions-deprecated instead of ocramius/package-versions (#3846)
It allows wider range of PHP versions in addition to supporting both
Composer v1 and v2

Fixes vimeo/psalm#3844
2020-07-20 04:53:16 -04:00

26 lines
722 B
PHP

<?php
use React\Promise\PromiseInterface as ReactPromise;
use ResourceBundle;
use Transliterator;
use Composer\InstalledVersions;
spl_autoload_register(function (string $className) {
$knownBadClasses = [
ReactPromise::class, // amphp/amp
ResourceBundle::class, // symfony/polyfill-php73
Transliterator::class, // symfony/string
InstalledVersions::class, // composer v2
// it's unclear why Psalm tries to autoload parent
'parent',
];
if (in_array($className, $knownBadClasses)) {
return;
}
$ex = new RuntimeException('Attempted to load ' . $className);
echo $ex->__toString() . "\n\n" . $ex->getTraceAsString() . "\n\n";
exit(70);
});