1--TEST-- 2Testing indirect method call 3--FILE-- 4<?php 5 6class foo { 7 public $x = 1; 8 9 public function getX() { 10 return $this->x; 11 } 12 public function setX($val) { 13 $this->x = $val; 14 return $this; 15 } 16} 17 18$X = (new foo)->setX(10)->getX(); 19var_dump($X); // int(10) 20 21?> 22--EXPECT-- 23int(10) 24