Example #1
0
 /**
  * @param Stream $stream
  *
  * @return array
  */
 private function parseTypeDefinition(Stream $stream)
 {
     $definition = [];
     while ($stream->peek()->equals(Token::TYPE_SYMBOL, ':')) {
         $field = $this->parseIdentifier($stream);
         $stream->expects(Token::TYPE_SYMBOL, ':');
         $type = $this->parseTypeAlias($stream);
         $stream->expects(Token::TYPE_SYMBOL, ';');
         $definition['mapping'][$field] = $type;
     }
     while ($stream->peek()->equals(Token::TYPE_SYMBOL, '=')) {
         $name = $stream->expects(Token::TYPE_IDENTIFIER)->getValue();
         $stream->expects(Token::TYPE_SYMBOL, '=');
         $value = $this->parseValue($stream);
         $stream->expects(Token::TYPE_SYMBOL, ';');
         $definition['options'][$name] = $value;
     }
     return $definition;
 }