phpstan/phpstan-nette
Composer 安装命令:
composer require phpstan/phpstan-nette
包简介
Nette Framework class reflection extension for PHPStan
README 文档
README
This extension provides following features:
Nette\ComponentModel\Container::getComponent()knows type of the component because it reads the return type oncreateComponent*(this works best in presenters and controls)- Array access on components (
$component['name']) resolves types viacreateComponent*methods Nette\DI\Container::getByTypeandcreateInstancereturn type based on first parameter (Foo::class).Nette\Forms\Container::getValuesreturn type based on$asArrayparameter.Nette\Forms\Container::getUntrustedValuesreturn type based on mapping class parameter.Nette\Forms\Controls\BaseControlfluent methods returnstaticinstead ofBaseControl.Nette\ComponentModel\Component::lookupreturn type based on$throwparameter.Nette\Application\UI\Component::getPresenterreturn type based on$throwparameter.Nette\Application\UI\Presenter::getSessionreturnsSessionorSessionSectionbased on arguments.- Dynamic methods of Nette\Utils\Html
- Magic Nette\Object and Nette\SmartObject properties
- Event listeners through the
on*properties - Presenter
@injectproperties are treated as initialized. - Defines early terminating method calls for Presenter methods to prevent
Undefined variableerrors - Understand the exact array shape coming from
Nette\Utils\Strings::match()andNette\Utils\Strings::matchAll()based on pattern Nette\Utils\Strings::replace()callback closure parameter type inferred from regex pattern
It also contains these framework-specific rules (can be enabled separately):
- Do not extend Nette\Object, use Nette\SmartObject trait instead
- Rethrow exceptions that are always meant to be rethrown (like
AbortException) - Validate regex patterns passed to
Nette\Utils\Stringsmethods
Installation
To use this extension, require it in Composer:
composer require --dev phpstan/phpstan-nette
If you also install phpstan/extension-installer then you're all set!
Manual installation
If you don't want to use phpstan/extension-installer, include extension.neon in your project's PHPStan config:
includes:
- vendor/phpstan/phpstan-nette/extension.neon
To perform framework-specific checks, include also this file:
- vendor/phpstan/phpstan-nette/rules.neon
phpstan/phpstan-nette 适用场景与选型建议
phpstan/phpstan-nette 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 10.57M 次下载、GitHub Stars 达 118, 最近一次更新时间为 2016 年 01 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 phpstan/phpstan-nette 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 phpstan/phpstan-nette 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 10.57M
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 119
- 点击次数: 20
- 依赖项目数: 621
- 推荐数: 3
其他信息
- 授权协议: MIT
- 更新时间: 2016-01-04