private function parse($tokens, ?TypeContext $context = null): array
    {
        $count = count($tokens);
        $tagCount = 0;
        $tags = [];

        for ($i = 1; $i < $count; $i += 2) {
            $tags[] = $this->tagFactory->create($tokens[$i], $context);
            $tokens[$i] = '%' . ++$tagCount . '$s';
        }

        //In order to allow "literal" inline tags, the otherwise invalid
        //sequence "{@}" is changed to "@", and "{}" is changed to "}".
        //"%" is escaped to "%%" because of vsprintf.
        //See unit tests for examples.
        for ($i = 0; $i < $count; $i += 2) {
            $tokens[$i] = str_replace(['{@}', '{}', '%'], ['@', '}', '%%'], $tokens[$i]);
        }

        return [implode('', $tokens), $tags];
    }
private function parse($tokens, ?TypeContext $context = null): array
    {
        $count = count($tokens);
        $tagCount = 0;
        $tags = [];

        for ($i = 1; $i < $count; $i += 2) {
            $tags[] = $this->tagFactory->create($tokens[$i], $context);
            $tokens[$i] = '%' . ++$tagCount . '$s';
        }

        //In order to allow "literal" inline tags, the otherwise invalid
        //sequence "{@}" is changed to "@", and "{}" is changed to "}".
        //"%" is escaped to "%%" because of vsprintf.
        //See unit tests for examples.
        for ($i = 0; $i < $count; $i += 2) {
            $tokens[$i] = str_replace(['{@}', '{}', '%'], ['@', '}', '%%'], $tokens[$i]);
        }

        return [implode('', $tokens), $tags];
    }
private function parse ( $ tokens , ? TypeContext $ context = null ) : array { $ count = count ( $ tokens ) ; $ tagCount = 0 ; $ tags = [ ] ; for ( $ i = 1 ; $ i < $ count ; $ i += 2 ) { $ tags [ ] = $ this -> tagFactory -> create ( $ tokens [ $ i ] , $ context ) ; $ tokens [ $ i ] = '%' . ++ $ tagCount . '$s' ; } //In order to allow "literal" inline tags, the otherwise invalid //sequence "{@}" is changed to "@", and "{}" is changed to "}". //"%" is escaped to "%%" because of vsprintf. //See unit tests for examples. for ( $ i = 0 ; $ i < $ count ; $ i += 2 ) { $ tokens [ $ i ] = str_replace ( [ '{@}' , '{}' , '%' ] , [ '@' , '}' , '%%' ] , $ tokens [ $ i ] ) ; } return [ implode ( '' , $ tokens ) , $ tags ] ; }
Parses the stream of tokens in to a new set of tokens containing Tags.

@param string[] $tokens

@return string[]|Tag[]
Parses the stream of tokens in to a new set of tokens containing Tags .