File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -101,18 +101,20 @@ function example(MyClass $class) {
101
101
```
102
102
103
103
### ForbidUselessNullableReturnRule
104
- - Denies marking function return type as nullable when null is never returned
104
+ - Denies marking method return type as nullable when null is never returned
105
105
- Recommended to be used together with ` UselessPrivatePropertyDefaultValueRule ` and ` UselessPrivatePropertyNullabilityRule `
106
106
``` neon
107
107
rules:
108
108
- ShipMonk\PHPStan\Rule\ForbidUselessNullableReturnRule
109
109
```
110
110
``` php
111
- function example(int $foo): ?int { // null never returned
112
- if ($foo < 0) {
113
- return 0;
111
+ class Example {
112
+ public function example(int $foo): ?int { // null never returned
113
+ if ($foo < 0) {
114
+ return 0;
115
+ }
116
+ return $foo;
114
117
}
115
- return $foo;
116
118
}
117
119
```
118
120
You can’t perform that action at this time.
0 commit comments