protected function validateAttributeType(TokenStream $stream, $type, array $allowed): void
    {
        $valid = false;

        foreach ($allowed as $aType) {
            if ($stream->test(\constant(Token::class.'::'.$aType.'_TYPE'))) {
                $valid = true;

                break;
            }
        }

        if (!$valid) {
            $message = 'The attribute %s "%s" must be an %s';

            throw new SyntaxError(sprintf($message, $type, $stream->getCurrent()->getValue(), implode(', ', $allowed)), $stream->getCurrent()->getLine(), $stream->getSourceContext());
        }
    }