Skip to content

Commit 8741be8

Browse files
committed
Better README
1 parent 53601fe commit 8741be8

File tree

1 file changed

+33
-3
lines changed

1 file changed

+33
-3
lines changed

README.md

+33-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
# PHPStan PSL extension
22

3+
[![Build](https://github.com/php-standard-library/phpstan-extension/workflows/Build/badge.svg)](https://github.com/php-standard-library/phpstan-extension/actions)
4+
[![Latest Stable Version](https://poser.pugx.org/php-standard-library/phpstan-extension/v/stable)](https://packagist.org/packages/php-standard-library/phpstan-extension)
5+
[![License](https://poser.pugx.org/php-standard-library/phpstan-extension/license)](https://packagist.org/packages/php-standard-library/phpstan-extension)
6+
7+
* [PHPStan](https://phpstan.org/)
8+
* [PSL](https://github.com/azjezz/psl)
9+
310
## Description
411

5-
The main scope of this extension is to help phpstan to detect the types after using `Psl\Type\shape`.
6-
Its intended to produce the same output as the [psalm plugin](https://github.com/php-standard-library/psalm-plugin).
12+
The main goal of this extension is to help PHPStan to detect the types after using `Psl\Type\shape`.
13+
714
Given the following example:
815

916
```php
@@ -22,6 +29,29 @@ $specification = Type\shape([
2229
$input = $specification->coerce($_GET['user']);
2330
```
2431

25-
PhpStan assumes that `$input` is of type `array<"age"|"location"|"name", array<"city"|"country"|"state", string>|int|string>`.
32+
PHPStan assumes that `$input` is of type `array<"age"|"location"|"name", array<"city"|"country"|"state", string>|int|string>`.
2633

2734
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}}`.
35+
36+
Besides coerce, this extension also supports `matches()` and `assert()` methods.
37+
38+
## Installation
39+
40+
To use this extension, require it in [Composer](https://getcomposer.org/):
41+
42+
```
43+
composer require --dev php-standard-library/phpstan-extension
44+
```
45+
46+
If you also install [phpstan/extension-installer](https://github.com/phpstan/extension-installer) then you're all set!
47+
48+
<details>
49+
<summary>Manual installation</summary>
50+
51+
If you don't want to use `phpstan/extension-installer`, include extension.neon in your project's PHPStan config:
52+
53+
```
54+
includes:
55+
- vendor/php-standard-library/phpstan-extension/extension.neon
56+
```
57+
</details>

0 commit comments

Comments
 (0)