Пример #1
0
 /**
  * @inheritdoc
  */
 public function parseScalar(TokenStream $tokenStream)
 {
     if (($typeToken = $tokenStream->nextIf(Token::T_TYPE)) !== null) {
         $value = $this->getTypeCaster($typeToken->getValue())->typeCast($tokenStream->next());
     } else {
         $value = $this->getScalarValue($tokenStream->next());
     }
     return $value;
 }
Пример #2
0
 /**
  * @inheritdoc
  */
 public function parse(TokenStream $tokenStream)
 {
     if ($tokenStream->test(Token::T_GLOB)) {
         return new Glob($tokenStream->next()->getValue());
     }
     if ($tokenStream->nextIf(Token::T_TYPE, 'glob')) {
         $tokenStream->expect(Token::T_COLON);
     }
     return new Glob(Glob::encode($tokenStream->expect(static::$allowedTypes)->getValue()));
 }