php-standard-library/phpstan-extension
Composer 安装命令:
composer require php-standard-library/phpstan-extension
包简介
PHPStan PSL extension
README 文档
README
Description
The main goal of this extension is to help PHPStan to detect the types after using Psl\Type\shape.
Given the following example:
use Psl\Type; $specification = Type\shape([ 'name' => Type\string(), 'age' => Type\int(), 'location' => Type\optional(Type\shape([ 'city' => Type\string(), 'state' => Type\string(), 'country' => Type\string(), ])) ]); $input = $specification->coerce($_GET['user']);
PHPStan assumes that $input is of type array<"age"|"location"|"name", array<"city"|"country"|"state", string>|int|string>.
If we enable the extension, you will get a more specific and correct type of array{name: string, age: int, location?: array{city: string, state: string, country: string}}.
Besides coerce, this extension also supports matches() and assert() methods.
Installation
To use this extension, require it in Composer:
composer require --dev php-standard-library/phpstan-extension
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/php-standard-library/phpstan-extension/extension.neon
php-standard-library/phpstan-extension 适用场景与选型建议
php-standard-library/phpstan-extension 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.27M 次下载、GitHub Stars 达 22, 最近一次更新时间为 2022 年 06 月 10 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 php-standard-library/phpstan-extension 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 php-standard-library/phpstan-extension 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 1.27M
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 22
- 点击次数: 22
- 依赖项目数: 17
- 推荐数: 2
其他信息
- 授权协议: MIT
- 更新时间: 2022-06-10