File tree Expand file tree Collapse file tree 2 files changed +29
-1
lines changed
tests/PHPStan/Rules/TooWideTypehints Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -94,6 +94,14 @@ public function testBug13384cPhp82(): void
9494 'Function Bug13384c\doFooPhpdoc2() never returns true so the return type can be changed to false. ' ,
9595 100 ,
9696 ],
97+ [
98+ 'Function Bug13384c\returnsTrueUnionReturn() never returns int so it can be removed from the return type. ' ,
99+ 130 ,
100+ ],
101+ [
102+ 'Function Bug13384c\returnsTruePhpdocUnionReturn() never returns int so it can be removed from the return type. ' ,
103+ 137 ,
104+ ],
97105 ]);
98106 }
99107
@@ -116,7 +124,16 @@ public function testBug13384cPrePhp82(): void
116124
117125 public function testBug13384cOff (): void
118126 {
119- $ this ->analyse ([__DIR__ . '/data/bug-13384c.php ' ], []);
127+ $ this ->analyse ([__DIR__ . '/data/bug-13384c.php ' ], [
128+ [
129+ 'Function Bug13384c\returnsTrueUnionReturn() never returns int so it can be removed from the return type. ' ,
130+ 130 ,
131+ ],
132+ [
133+ 'Function Bug13384c\returnsTruePhpdocUnionReturn() never returns int so it can be removed from the return type. ' ,
134+ 137 ,
135+ ],
136+ ]);
120137 }
121138
122139 public function testNestedTooWideType (): void
Original file line number Diff line number Diff line change @@ -126,3 +126,14 @@ function returnsTrueNoPhpdoc(): bool {
126126function returnsFalseNoPhpdoc (): bool {
127127 return false ;
128128}
129+
130+ function returnsTrueUnionReturn (): int |bool {
131+ return true ;
132+ }
133+
134+ /**
135+ * @return int|bool
136+ */
137+ function returnsTruePhpdocUnionReturn () {
138+ return true ;
139+ }
You can’t perform that action at this time.
0 commit comments