driveto/phpstan-twig
最新稳定版本:0.0.1
Composer 安装命令:
composer require driveto/phpstan-twig
包简介
Twig extensions for PHPStan
README 文档
README
Inspired by blog series by @TomasVortuba - https://tomasvotruba.com/blog/stamp-1-how-to-compile-twig-to-php/
Known issues
- Performance
- Currently, templates are processed only sequentially
- Same templates with same variables included in multiple templates are checked multiple times
- High memory usage when depth of included templates is higher
- Method name guessing is not supported. I believe that template engine should not guess which method programmer wanted to use. Therefore, if you want to use method, use it with full name and parentheses
{{ class.fullMethodName() }}
Installation
To use this extension, require it in Composer:
composer require --dev driveto/phpstan-twig
Include extension.neon in your project's PHPStan config:
includes:
- vendor/driveto/phpstan-twig/extension.neon
Add path to Twig service in phpstan.neon:
parameters:
twig:
twigEnvironmentLoader: tests/TwigEnvironmentLoader.php
Example of Twig loader:
use App\Kernel; use Symfony\Component\Dotenv\Dotenv; require __DIR__ . '/../vendor/autoload.php'; (new Dotenv())->bootEnv(__DIR__ . '/../.env'); $kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']); $kernel->boot(); return $kernel->getContainer()->get('twig');
统计信息
- 总下载量: 56
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-08-15