File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
tests/PHPStan/Analyser/nsrt Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -163,3 +163,28 @@ public function doFoo(callable $foo): void {
163163 assertType ('array ' , $ this ->foo ); // could be non-empty-array
164164 }
165165}
166+
167+ class StringableFoo {
168+ private string $ foo ;
169+
170+ // https://3v4l.org/DQSgA#v8.4.6
171+ public function doFoo (StringableFoo $ foo ): void {
172+ $ this ->foo = $ foo ;
173+ assertType ('*NEVER* ' , $ this ->foo );
174+ }
175+
176+ public function doFoo2 (NotStringable $ foo ): void {
177+ $ this ->foo = $ foo ;
178+ assertType ('*NEVER* ' , $ this ->foo );
179+ }
180+
181+ // https://3v4l.org/2SPPj#v8.4.6
182+ public function doFoo3 (\BcMath \Number $ foo ): void {
183+ $ this ->foo = $ foo ;
184+ assertType ('*NEVER* ' , $ this ->foo );
185+ }
186+
187+ public function __toString (): string {
188+ return 'Foo ' ;
189+ }
190+ }
You can’t perform that action at this time.
0 commit comments