phplinter\Lint\BaseLint::common_tokens PHP Метод

common_tokens() публичный Метод

----------------------------------------------------------------------+ Tokens common to all scopes.
public common_tokens ( $pos )
    public function common_tokens($pos)
    {
        $token = $this->node->tokens[$pos];
        if ($this->final_return === 1 && $token[0] !== T_CLOSE_SCOPE && \phplinter\Tokenizer::meaningfull($token[0])) {
            $this->final_return = 2;
            $this->report('WAR_UNREACHABLE_CODE', null, $token[2]);
        }
        $t = $token[0];
        if ($this->config->match_rule('DEP_DEPRECATED_TOKEN', $t)) {
            $this->report('DEP_DEPRECATED_TOKEN', \phplinter\Tokenizer::token_name($t));
        }
        switch ($t) {
            case T_INLINE_HTML:
                $this->report('REF_HTML_MIXIN', null, $token[2]);
                break;
            case T_REQUIRE:
            case T_REQUIRE_ONCE:
            case T_INCLUDE:
            case T_INCLUDE_ONCE:
                $this->sec_includes($pos);
                break;
            case T_IS_EQUAL:
            case T_IS_NOT_EQUAL:
                $this->report('INF_COMPARE', null, $token[2]);
                break;
            case T_BACKTICK:
                $this->sec_backtick($pos);
                break;
            case T_STRING:
                $this->parse_string($pos);
                break;
            case T_RETURN:
            case T_EXIT:
                $prev = $this->node->tokens[$this->prev($pos)];
                if (!in_array($prev[0], array(T_LOGICAL_OR, T_BOOLEAN_OR)) && $this->scope === 0 && $this->final_return === false) {
                    $this->final_return = true;
                }
                break;
            case T_OPEN_SCOPE:
                $this->branches++;
                if ($token[1] === 'switch') {
                    if ($this->switch !== false) {
                        $this->report('REF_NESTED_SWITCH', null, $token[2]);
                    }
                    $this->switch = $this->scope;
                }
                $this->scope++;
                if ($this->config->match_rule('REF_DEEP_NESTING', $this->scope)) {
                    $this->report('REF_DEEP_NESTING', $this->scope, $token[2]);
                }
                break;
            case T_CLOSE_SCOPE:
                $this->scope--;
                if ($this->switch === $this->scope) {
                    $this->switch = false;
                }
                break;
            case T_SEMICOLON:
                if ($this->final_return === true) {
                    $this->final_return = 1;
                }
                break;
        }
    }