-
Notifications
You must be signed in to change notification settings - Fork 25
/
magento-autoloader.php
33 lines (28 loc) · 1.06 KB
/
magento-autoloader.php
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
<?php
/*
* This file is part of the phpstan-magento package.
*
* (c) bitExpert AG
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
// This autoloader implementation supersedes the former \bitExpert\PHPStan\Magento\Autoload\Autoload implementation
use bitExpert\PHPStan\Magento\Autoload\Autoloader;
use PHPStan\DependencyInjection\Container;
if (!isset($container) || !$container instanceof Container) {
throw new \RuntimeException('No container found, or container not of expected type');
}
foreach ($container->getServicesByTag('phpstan.magento.autoloader') as $autoloader) {
/** @var Autoloader|object $autoloader */
if (!$autoloader instanceof Autoloader) {
throw new \RuntimeException(
sprintf(
'Service "%s" tagged with "phpstan.magento.autoloader" must implement %s!',
get_class($autoloader),
'bitExpert\PHPStan\Magento\Autoload\Autoloader'
)
);
}
$autoloader->register();
}