@@ -9,36 +9,31 @@ public function returnThis(mixed $value): self {
99 return $ this ;
1010 }
1111
12- public static function staticReturnSelf (mixed $ value ): self {
12+ public static function returnSelf (mixed $ value ): self {
1313 return new self ();
1414 }
1515}
1616
17- class Bar {
18- public static function doSomething (mixed $ value ): void {
19- }
20- }
21-
22- function testMethodCall (): void {
17+ function testMethodCallChainedWithMethodCall (): void {
2318 $ callback = fn (): never => throw new \Exception ();
2419 $ x = (new Foo ())->returnThis ($ callback ())->returnThis ('x ' );
2520 $ y = 'this will never run ' ;
2621}
2722
28- function testStaticCall (): void {
23+ function testMethodCallChainedWithStaticCall (): void {
2924 $ callback = fn (): never => throw new \Exception ();
30- Bar:: doSomething ( $ callback ());
31- $ b = 'this will never run ' ;
25+ $ x = ( new Foo ())-> returnThis ( $ callback ()):: returnSelf ( ' x ' );
26+ $ y = 'this will never run ' ;
3227}
3328
3429function testStaticCallChainedWithMethodCall (): void {
3530 $ callback = fn (): never => throw new \Exception ();
36- $ a = Foo::staticReturnSelf ($ callback ())->returnThis ('x ' );
31+ $ a = Foo::returnSelf ($ callback ())->returnThis ('x ' );
3732 $ b = 'this will never run either ' ;
3833}
3934
4035function testStaticCallChainedWithStaticCall (): void {
4136 $ callback = fn (): never => throw new \Exception ();
42- $ a = Foo::staticReturnSelf ($ callback ())::staticReturnSelf ('x ' );
37+ $ a = Foo::returnSelf ($ callback ())::returnSelf ('x ' );
4338 $ b = 'this will never run either ' ;
4439}
0 commit comments