1--TEST-- 2ZE2 dereferencing of objects from methods 3--FILE-- 4<?php 5 6class Name { 7 function __construct(public $name) {} 8 9 function display() { 10 echo $this->name . "\n"; 11 } 12} 13 14class Person { 15 private $name; 16 17 function __construct($_name, $_address) { 18 $this->name = new Name($_name); 19 } 20 21 function getName() { 22 return $this->name; 23 } 24} 25 26$person = new Person("John", "New York"); 27$person->getName()->display(); 28 29?> 30--EXPECT-- 31John 32