File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed
Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -268,6 +268,14 @@ public function testAllMethodsArePure(): void
268268 'Impure call to method AllMethodsArePure\Test::impure() in pure method AllMethodsArePure\SideEffectImpure::pureWithImpure(). ' ,
269269 148 ,
270270 ],
271+ [
272+ 'Impure call to method AllMethodsArePure\FooWithMixed::impureMethod() in pure method AllMethodsArePure\FooWithMixed::testMixed(). ' ,
273+ 163 ,
274+ ],
275+ [
276+ 'Impure call to method AllMethodsArePure\FooWithMixed::impureMethod() in pure method AllMethodsArePure\FooWithMixed::testMixed2(). ' ,
277+ 171 ,
278+ ],
271279 ]);
272280 }
273281
Original file line number Diff line number Diff line change @@ -152,3 +152,29 @@ public function pureWithPure(): int {
152152 Test::pure ();
153153 }
154154}
155+
156+ /**
157+ * @phpstan-all-methods-pure
158+ */
159+ final class FooWithMixed
160+ {
161+ public function testMixed (): mixed
162+ {
163+ return $ this ->impureMethod ();
164+ }
165+
166+ /**
167+ * @return mixed
168+ */
169+ public function testMixed2 ()
170+ {
171+ return $ this ->impureMethod ();
172+ }
173+
174+ /**
175+ * @phpstan-impure
176+ */
177+ public function impureMethod (): mixed {
178+ return time ();
179+ }
180+ }
You can’t perform that action at this time.
0 commit comments