public function testTypeService() { $this->assertTrue(TypeService::isScalarType(TypeMap::TYPE_STRING)); $this->assertFalse(TypeService::isScalarType('gibberish')); $this->assertFalse(TypeService::isScalarType(new TestObjectType())); $stringType = new StringType(); $this->assertFalse(TypeService::isInterface($stringType)); $this->assertEquals(TypeService::resolveNamedType($stringType), $stringType); $this->assertNull(TypeService::resolveNamedType(null)); $this->assertEquals(TypeService::resolveNamedType(123), $stringType); }
private static function isArrayOfInterfaces($data) { if (!is_array($data)) { return false; } foreach ($data as $item) { if (!TypeService::isInterface($item)) { return false; } } return true; }