1234567891011121314151617181920212223242526 |
- <?php
- declare(strict_types=1);
- /**
- * This file is part of Hyperf.
- *
- * @link https://www.hyperf.io
- * @document https://doc.hyperf.io
- * @contact [email protected]
- * @license https://github.com/hyperf-cloud/hyperf/blob/master/LICENSE
- */
- use Hyperf\Di\Container;
- use Hyperf\Di\Definition\DefinitionSourceFactory;
- use Hyperf\Utils\ApplicationContext;
- use Psr\Container\ContainerInterface;
- /**
- * Initial a dependency injection container that implemented PSR-11 and return the container.
- */
- $container = new Container((new DefinitionSourceFactory(true))());
- if (! $container instanceof ContainerInterface) {
- throw new RuntimeException('The dependency injection container is invalid.');
- }
- return ApplicationContext::setContainer($container);
|