You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Provides custom type extensions and error suppression rules used when analysing Nette libraries with [PHPStan](https://phpstan.org).
15
13
16
-
<!---->
14
+
<!---->
17
15
18
16
19
-
Installation
20
-
============
17
+
## Installation
21
18
22
19
Install via Composer:
23
20
@@ -34,15 +31,13 @@ includes:
34
31
- vendor/nette/phpstan-rules/extension.neon
35
32
```
36
33
37
-
<!---->
34
+
<!---->
38
35
36
+
## What's Included
39
37
40
-
What's Included
41
-
===============
38
+
<!---->
42
39
43
-
44
-
Narrow Return Types
45
-
-------------------
40
+
### Narrow Return Types
46
41
47
42
Removes `|false` from return types of native PHP functions and methods where `false` is trivial or outdated. For example, `getcwd()` returns `string|false`, but on modern systems `false` is unrealistic. This extension narrows it to `string`.
Suppresses `expr.resultUnused` for the runtime type validation pattern commonly used in Nette:
62
57
@@ -70,11 +65,9 @@ public function setItems(array $items): void
70
65
71
66
PHPStan normally reports the closure call result as unused. This extension recognizes the pattern (empty closure body, all parameters variadic with type hints) and ignores the error.
72
67
73
-
<!---->
74
-
68
+
<!---->
75
69
76
-
Type Assertion Testing Helper
77
-
==============================
70
+
### Type Assertion Testing Helper
78
71
79
72
The package also provides `Nette\PHPStan\Testing\TypeAssert` for testing type inference in Nette packages using [Nette Tester](https://tester.nette.org):
0 commit comments