1--TEST-- 2Reflecting object type hint 3--FILE-- 4<?php 5 6interface One { 7 public function a(object $obj); 8} 9 10class Two implements One { 11 public function a(object $obj) {} 12} 13 14function a(object $obj) {} 15 16$typeHintOne = (new ReflectionClass(One::class))->getMethod('a')->getParameters()[0]->getType(); 17var_dump($typeHintOne->isBuiltin(), (string)$typeHintOne); 18 19$typeHintTwo = (new ReflectionClass(Two::class))->getMethod('a')->getParameters()[0]->getType(); 20var_dump($typeHintTwo->isBuiltin(), (string)$typeHintTwo); 21 22$typeHinta = (new ReflectionFunction('a'))->getParameters()[0]->getType(); 23var_dump($typeHinta->isBuiltin(), (string)$typeHinta); 24--EXPECTF-- 25bool(true) 26string(6) "object" 27bool(true) 28string(6) "object" 29bool(true) 30string(6) "object" 31