fcpl/phpstan-container-extension
最新稳定版本:v1.0.0
Composer 安装命令:
composer require fcpl/phpstan-container-extension
包简介
PHPStan extension to resolve return type for PSR-11 container (Psr\Container\ContainerInterface) and Pimple Container (ArrayAccess)
README 文档
README
This is an extension for PHPStan extension to resolve return type for PSR-11 container (Psr\Container\ContainerInterface) and Pimple Container (ArrayAccess)
This pacckage based on phil-nelson/phpstan-container-extension
Installation
Install with:
composer require --dev fcpl/phpstan-container-extension
Add the extension.neon file to your PHPStan config:
includes:
- vendor/fcpl/phpstan-container-extension/extension.neon
Or use phpstan/extension-installer
Sample
use Monolog\Handler\HandlerInterface; use Monolog\Handler\StreamHandler; use Monolog\Logger; use Pimple\Container; use Pimple\Psr11\ServiceLocator; use Psr\Log\LoggerInterface; ... $container = new Container(); $container->offsetSet(HandlerInterface::class, new StreamHandler($this->getLogFile())); $container->offsetSet( LoggerInterface::class, function (Container $container): Logger { /** @var HandlerInterface $streamHandler */ $streamHandler = $container->offsetGet(HandlerInterface::class); return new Logger(self::class, [$streamHandler]); } ); return new ServiceLocator($container, [LoggerInterface::class, ConverterFileInterface::class]); ...
License
All contents of this package are licensed under the MIT license.
统计信息
- 总下载量: 20.21k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-08-31