public/phpmyadmin/vendor/squizlabs/php_codesniffer/src/Files/File.php
/**
     * Returns the position of the last non-whitespace token in a statement.
     *
     * @param int       $start  The position to start searching from in the token stack.
     * @param int|array $ignore Token types that should not be considered stop points.
     *
     * @return int
     */
Returns the position of the last non-whitespace token in a statement.
@param int       $start  The position to start searching from in the token stack.
@param int|array $ignore Token types that should not be considered stop points.

@return int
Returns the position of the last non - whitespace token in a statement . @param int $start The position to start searching from in the token stack . @param int|array $ignore Token types that should not be considered stop points . @return int
public function findEndOfStatement($start, $ignore=null)
    {
        $endTokens = [
            T_COLON                => true,
            T_COMMA                => true,
            T_DOUBLE_ARROW         => true,
            T_SEMICOLON            => true,
            T_CLOSE_PARENTHESIS    => true,
            T_CLOSE_SQUARE_BRACKET => true,
            T_CLOSE_CURLY_BRACKET  => true,
            T_CLOSE_SHORT_ARRAY    => true,
            T_OPEN_TAG             => true,
            T_CLOSE_TAG            => true,
        ];
        if ($ignore !== null) {
            $ignore = (array) $ignore;
            foreach ($ignore as $code) {
                if (isset($endTokens[$code]) === true) {
                    unset($endTokens[$code]);
                }
            }
        }
        $lastNotEmpty = $start;
        for ($i = $start; $i < $this->numTokens; $i++) {
            if ($i !== $start && isset($endTokens[$this->tokens[$i]['code']]) === true) {
                if ($this->tokens[$i]['code'] === T_CLOSE_PARENTHESIS
                    || $this->tokens[$i]['code'] === T_CLOSE_SQUARE_BRACKET
                    || $this->tokens[$i]['code'] === T_CLOSE_CURLY_BRACKET
                    || $this->tokens[$i]['code'] === T_CLOSE_SHORT_ARRAY
                    || $this->tokens[$i]['code'] === T_OPEN_TAG
                    || $this->tokens[$i]['code'] === T_CLOSE_TAG
                ) {
                    return $lastNotEmpty;
                }
                return $i;
            }
            if (isset($this->tokens[$i]['scope_closer']) === true
                && ($i === $this->tokens[$i]['scope_opener']
                || $i === $this->tokens[$i]['scope_condition'])
            ) {
                if ($i === $start && isset(Util\Tokens::$scopeOpeners[$this->tokens[$i]['code']]) === true) {
                    return $this->tokens[$i]['scope_closer'];
                }
                $i = $this->tokens[$i]['scope_closer'];
            } else if (isset($this->tokens[$i]['bracket_closer']) === true
                && $i === $this->tokens[$i]['bracket_opener']
            ) {
                $i = $this->tokens[$i]['bracket_closer'];
            } else if (isset($this->tokens[$i]['parenthesis_closer']) === true
                && $i === $this->tokens[$i]['parenthesis_opener']
            ) {
                $i = $this->tokens[$i]['parenthesis_closer'];
            }
            if (isset(Util\Tokens::$emptyTokens[$this->tokens[$i]['code']]) === false) {
                $lastNotEmpty = $i;
            }
        }
        return ($this->numTokens - 1);
    }
public function findEndOfStatement ( $ start , $ ignore = null ) { $ endTokens = [ T_COLON => true , T_COMMA => true , T_DOUBLE_ARROW => true , T_SEMICOLON => true , T_CLOSE_PARENTHESIS => true , T_CLOSE_SQUARE_BRACKET => true , T_CLOSE_CURLY_BRACKET => true , T_CLOSE_SHORT_ARRAY => true , T_OPEN_TAG => true , T_CLOSE_TAG => true , ] ; if ( $ ignore !== null ) { $ ignore = ( array ) $ ignore ; foreach ( $ ignore as $ code ) { if ( isset ( $ endTokens [ $ code ] ) === true ) { unset ( $ endTokens [ $ code ] ) ; } } } $ lastNotEmpty = $ start ; for ( $ i = $ start ; $ i < $ this -> numTokens ; $ i ++ ) { if ( $ i !== $ start && isset ( $ endTokens [ $ this -> tokens [ $ i ] [ 'code' ] ] ) === true ) { if ( $ this -> tokens [ $ i ] [ 'code' ] === T_CLOSE_PARENTHESIS || $ this -> tokens [ $ i ] [ 'code' ] === T_CLOSE_SQUARE_BRACKET || $ this -> tokens [ $ i ] [ 'code' ] === T_CLOSE_CURLY_BRACKET || $ this -> tokens [ $ i ] [ 'code' ] === T_CLOSE_SHORT_ARRAY || $ this -> tokens [ $ i ] [ 'code' ] === T_OPEN_TAG || $ this -> tokens [ $ i ] [ 'code' ] === T_CLOSE_TAG ) { return $ lastNotEmpty ; } return $ i ; } if ( isset ( $ this -> tokens [ $ i ] [ 'scope_closer' ] ) === true && ( $ i === $ this -> tokens [ $ i ] [ 'scope_opener' ] || $ i === $ this -> tokens [ $ i ] [ 'scope_condition' ] ) ) { if ( $ i === $ start && isset ( Util \ Tokens :: $ scopeOpeners [ $ this -> tokens [ $ i ] [ 'code' ] ] ) === true ) { return $ this -> tokens [ $ i ] [ 'scope_closer' ] ; } $ i = $ this -> tokens [ $ i ] [ 'scope_closer' ] ; } else if ( isset ( $ this -> tokens [ $ i ] [ 'bracket_closer' ] ) === true && $ i === $ this -> tokens [ $ i ] [ 'bracket_opener' ] ) { $ i = $ this -> tokens [ $ i ] [ 'bracket_closer' ] ; } else if ( isset ( $ this -> tokens [ $ i ] [ 'parenthesis_closer' ] ) === true && $ i === $ this -> tokens [ $ i ] [ 'parenthesis_opener' ] ) { $ i = $ this -> tokens [ $ i ] [ 'parenthesis_closer' ] ; } if ( isset ( Util \ Tokens :: $ emptyTokens [ $ this -> tokens [ $ i ] [ 'code' ] ] ) === false ) { $ lastNotEmpty = $ i ; } } return ( $ this -> numTokens - 1 ) ; }
Returns the position of the last non-whitespace token in a statement.
Returns the position of the last non - whitespace token in a statement .
// Found the end of the statement. // Skip nested statements. //end for