private function parseToken(array $parsedTokens, TokenParserInterface $parser, Token $token): array
    {
        $parsedToken = $parser->parse($token);

        if ($parsedToken instanceof FunctionCallValue) {
            // Check if the pattern was something like @value_<func()> in which case the function call should be part of the reference
            // name
            $lastParsedToken = end($parsedTokens);

            if ($lastParsedToken instanceof FixtureReferenceValue) {
                $parsedTokens[key($parsedTokens)] = new FixtureReferenceValue(
                    new ListValue([
                        $lastParsedToken->getValue(),
                        $parsedToken,
                    ])
                );

                return $parsedTokens;
            }
        }

        $parsedToken = ($parsedToken instanceof NestedValue)
            ? $parsedToken->getValue()
            : [$parsedToken]
        ;

        foreach ($parsedToken as $value) {
            $parsedTokens[] = $value;
        }

        return $parsedTokens;
    }
private function parseToken(array $parsedTokens, TokenParserInterface $parser, Token $token): array
    {
        $parsedToken = $parser->parse($token);

        if ($parsedToken instanceof FunctionCallValue) {
            // Check if the pattern was something like @value_<func()> in which case the function call should be part of the reference
            // name
            $lastParsedToken = end($parsedTokens);

            if ($lastParsedToken instanceof FixtureReferenceValue) {
                $parsedTokens[key($parsedTokens)] = new FixtureReferenceValue(
                    new ListValue([
                        $lastParsedToken->getValue(),
                        $parsedToken,
                    ])
                );

                return $parsedTokens;
            }
        }

        $parsedToken = ($parsedToken instanceof NestedValue)
            ? $parsedToken->getValue()
            : [$parsedToken]
        ;

        foreach ($parsedToken as $value) {
            $parsedTokens[] = $value;
        }

        return $parsedTokens;
    }
private function parseToken ( array $ parsedTokens , TokenParserInterface $ parser , Token $ token ) : array { $ parsedToken = $ parser -> parse ( $ token ) ; if ( $ parsedToken instanceof FunctionCallValue ) { // Check if the pattern was something like @value_<func()> in which case the function call should be part of the reference // name $ lastParsedToken = end ( $ parsedTokens ) ; if ( $ lastParsedToken instanceof FixtureReferenceValue ) { $ parsedTokens [ key ( $ parsedTokens ) ] = new FixtureReferenceValue ( new ListValue ( [ $ lastParsedToken -> getValue ( ) , $ parsedToken , ] ) ) ; return $ parsedTokens ; } } $ parsedToken = ( $ parsedToken instanceof NestedValue ) ? $ parsedToken -> getValue ( ) : [ $ parsedToken ] ; foreach ( $ parsedToken as $ value ) { $ parsedTokens [ ] = $ value ; } return $ parsedTokens ; }
Parses the given token. If the value returned is a ListValue, its values will be merged to the list of parsed
tokens instead of adding the value itself. Another check is done to ensure that successive string tokens are
merged.

@return ValueInterface[]|string[] Parsed tokens
Parses the given token . If the value returned is a ListValue its values will be merged to the list of parsed tokens instead of adding the value itself . Another check is done to ensure that successive string tokens are merged .