php-standard-library/psalm-plugin
最新稳定版本:2.3.0
Composer 安装命令:
composer require php-standard-library/psalm-plugin
包简介
Psalm plugin for the PHP Standard Library
README 文档
README
Installation
Supported installation method is via composer:
composer require php-standard-library/psalm-plugin --dev
Usage
To enable the plugin, add the Psl\Psalm\Plugin class to your psalm configuration using psalm-plugin binary as follows:
php vendor/bin/psalm-plugin enable php-standard-library/psalm-plugin
Type improvements
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']); /** @psalm-trace $input */
Psalm assumes that $input is of type array<"age"|"location"|"name", array<"city"|"country"|"state", string>|int|string>.
If we enable the php-standard-library/psalm-plugin plugin, you will get a more specific
and correct type of array{name: string, age: int, location?: array{city: string, state: string, country: string}}.
Compatibility
| PSL | Psalm plugin | Psalm |
|---|---|---|
| 2.x | ^2.1 | v5 |
| 2.x | ~2.0.0 | v4 |
| 1.x | 1.x | v4 |
Sponsors
Thanks to our sponsors and supporters:
| JetBrains |
|---|
License
The MIT License (MIT). Please see LICENSE for more information.
统计信息
- 总下载量: 1.91M
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 25
- 点击次数: 1
- 依赖项目数: 37
- 推荐数: 1
其他信息
- 授权协议: MIT
- 更新时间: 2021-03-27