1--TEST-- 2Indirect method call with chaining 3--FILE-- 4<?php 5 6class foo { 7 public $x = 'testing'; 8 9 public function bar() { 10 return "foo"; 11 } 12 public function baz() { 13 return new self; 14 } 15 static function xyz() { 16 } 17} 18 19var_dump((new foo())->bar()); // string(3) "foo" 20var_dump((new foo())->baz()->x); // string(7) "testing" 21var_dump((new foo())->baz()->baz()->bar()); // string(3) "foo" 22var_dump((new foo())->xyz()); // NULL 23(new foo())->www(); 24 25?> 26--EXPECTF-- 27string(3) "foo" 28string(7) "testing" 29string(3) "foo" 30NULL 31 32Fatal error: Call to undefined method foo::www() in %s on line %d 33