src/Highlighter.php
private function getTokens(string $source): array
    {
        $tokens = [];
        $line = 0;

        foreach (token_get_all($source) as $token) {
            if (isset($token[2])) {
                $line = $token[2];
            }

            if (!is_array($token)) {
                $token = [$token, $token, $line];
            }

            $tokens[] = $token;
        }

        return $tokens;
    }
private function getTokens(string $source): array
    {
        $tokens = [];
        $line = 0;

        foreach (token_get_all($source) as $token) {
            if (isset($token[2])) {
                $line = $token[2];
            }

            if (!is_array($token)) {
                $token = [$token, $token, $line];
            }

            $tokens[] = $token;
        }

        return $tokens;
    }
private function getTokens ( string $ source ) : array { $ tokens = [ ] ; $ line = 0 ; foreach ( token_get_all ( $ source ) as $ token ) { if ( isset ( $ token [ 2 ] ) ) { $ line = $ token [ 2 ] ; } if ( ! is_array ( $ token ) ) { $ token = [ $ token , $ token , $ line ] ; } $ tokens [ ] = $ token ; } return $ tokens ; }
Get all tokens from PHP source normalized to always include line number.

@param string $source
@return array
Get all tokens from PHP source normalized to always include line number .