src/Tool/MultipleCatch.php
public function run(string $file, Node $node): array
    {
        $hints = [];
        $catch_block_list = [];

        foreach ($node->children as $catch) {
            $klasses = $catch->children['class'];
            $stmts = $catch->children['stmts'];
            foreach ($catch_block_list as $catch_block) {
                $catch_klasses = $catch_block->children['class'];
                $catch_stmts = $catch_block->children['stmts'];
                if ($this->isEqualsWithoutLineno($catch_stmts, $stmts)) {
                    $hints[] = new Hint(
                        self::HINT_TYPE,
                        $this->messages(array_merge($catch_klasses->children, $klasses->children)),
                        $file,
                        $catch_stmts->lineno,
                        self::HINT_LINK
                    );
                }
            }
            $catch_block_list[] = $catch;
        }

        return $hints;
    }
public function run(string $file, Node $node): array
    {
        $hints = [];
        $catch_block_list = [];

        foreach ($node->children as $catch) {
            $klasses = $catch->children['class'];
            $stmts = $catch->children['stmts'];
            foreach ($catch_block_list as $catch_block) {
                $catch_klasses = $catch_block->children['class'];
                $catch_stmts = $catch_block->children['stmts'];
                if ($this->isEqualsWithoutLineno($catch_stmts, $stmts)) {
                    $hints[] = new Hint(
                        self::HINT_TYPE,
                        $this->messages(array_merge($catch_klasses->children, $klasses->children)),
                        $file,
                        $catch_stmts->lineno,
                        self::HINT_LINK
                    );
                }
            }
            $catch_block_list[] = $catch;
        }

        return $hints;
    }
public function run ( string $ file , Node $ node ) : array { $ hints = [ ] ; $ catch_block_list = [ ] ; foreach ( $ node -> children as $ catch ) { $ klasses = $ catch -> children [ 'class' ] ; $ stmts = $ catch -> children [ 'stmts' ] ; foreach ( $ catch_block_list as $ catch_block ) { $ catch_klasses = $ catch_block -> children [ 'class' ] ; $ catch_stmts = $ catch_block -> children [ 'stmts' ] ; if ( $ this -> isEqualsWithoutLineno ( $ catch_stmts , $ stmts ) ) { $ hints [ ] = new Hint ( self :: HINT_TYPE , $ this -> messages ( array_merge ( $ catch_klasses -> children , $ klasses -> children ) ) , $ file , $ catch_stmts -> lineno , self :: HINT_LINK ) ; } } $ catch_block_list [ ] = $ catch ; } return $ hints ; }
Detect catch blocks of the same implementation.

@param string $file File name to be analyzed.
@param Node   $node AST node to be analyzed.
@return Hint[] List of hints obtained from results.
Detect catch blocks of the same implementation .