File tree 1 file changed +12
-2
lines changed
tests/PHPStan/Analyser/nsrt
1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -304,9 +304,9 @@ class FooVoidInt {
304
304
public function doFoo (): void {
305
305
$ this ->foo = $ this ->returnVoid ();
306
306
assertType ('null ' , $ this ->foo );
307
-
307
+
308
308
$ this ->fooNonNull = $ this ->returnVoid ();
309
- assertType ('null ' , $ this ->foo ); // should be *ERROR*
309
+ assertType ('int| null ' , $ this ->foo ); // should be *ERROR*
310
310
}
311
311
312
312
public function returnVoid (): void {
@@ -578,6 +578,16 @@ public function doFoo(array $list): void
578
578
579
579
}
580
580
581
+ // https://3v4l.org/LJiRB
582
+ class CallableString {
583
+ private string $ foo ;
584
+
585
+ public function doFoo (callable $ foo ): void {
586
+ $ this ->foo = $ foo ;
587
+ assertType ('string ' , $ this ->foo ); // could be non-empty-string
588
+ }
589
+ }
590
+
581
591
// https://3v4l.org/VvUsp
582
592
class CallableArray {
583
593
private array $ foo ;
You can’t perform that action at this time.
0 commit comments