File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed
tests/PHPStan/Rules/Pure/data Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -89,7 +89,11 @@ public function check(
89
89
->build ();
90
90
}
91
91
} elseif ($ isPure ->no ()) {
92
- if (count ($ impurePoints ) === 0 ) {
92
+ if (
93
+ count ($ throwPoints ) === 0
94
+ && count ($ impurePoints ) === 0
95
+ && count ($ functionReflection ->getAsserts ()->getAll ()) === 0
96
+ ) {
93
97
$ errors [] = RuleErrorBuilder::message (sprintf (
94
98
'%s is marked as impure but does not have any side effects. ' ,
95
99
$ functionDescription ,
Original file line number Diff line number Diff line change @@ -360,3 +360,18 @@ private function doBaz(): void
360
360
}
361
361
362
362
}
363
+
364
+ class AssertingImpureVoidMethod
365
+ {
366
+
367
+ /**
368
+ * @param mixed $value
369
+ * @phpstan-assert array $value
370
+ * @phpstan-impure
371
+ */
372
+ public function assertSth ($ value ): void
373
+ {
374
+
375
+ }
376
+
377
+ }
You can’t perform that action at this time.
0 commit comments