getPhpType() public static method

public static getPhpType ( integer $type ) : string
$type integer
return string
 /**
  * @param \google\protobuf\FieldDescriptorProto $field
  *
  * @return string
  */
 protected function getDoctype(FieldDescriptorProto $field)
 {
     $fieldType = $field->getType()->value();
     $phpType = Field::getPhpType($fieldType);
     $refTypes = [Type::TYPE_ENUM_VALUE => true, Type::TYPE_MESSAGE_VALUE => true];
     if (isset($refTypes[$fieldType])) {
         $typeName = $field->getTypeName();
         $refEntity = $this->getEntity($typeName);
         return $refEntity->getNamespacedName();
     }
     return $phpType ?: 'mixed';
 }
Esempio n. 2
0
 /**
  * @dataProvider phpTypeProvider
  */
 public function testGetPhpType($type, $expected)
 {
     $this->assertEquals($expected, Field::getPhpType($type));
 }