/** * get the list of possible types that could match an object * * @param object $item * the item to examine * @return string[] * a list of matching objects */ private static function fromObject($item) { $retval = array_merge(GetObjectTypes::from($item), self::getObjectSpecialTypes($item), ['object' => 'object']); return $retval; }
/** * get the list of extra types that are valid for this specific object * * @param object $item * the object to examine * @return string[] * a (possibly empty) list of types for this object */ function get_object_types($item) { return GetObjectTypes::from($item); }
/** * @covers ::from * @covers ::getObjectConditionalTypes */ public function testDetectsStringyObjects() { // ---------------------------------------------------------------- // setup your test $data = new GetObjectTypesTest_StringTarget(); $expectedResult = [GetObjectTypesTest_StringTarget::class => GetObjectTypesTest_StringTarget::class]; // HHVM currently adds this class to the class hierarchy if (defined('HHVM_VERSION')) { $expectedResult['Stringish'] = 'Stringish'; } $expectedResult['string'] = 'string'; // ---------------------------------------------------------------- // perform the change $actualResult = GetObjectTypes::from($data); // ---------------------------------------------------------------- // test the results $this->assertEquals($expectedResult, $actualResult); }