PHPSA\Analyzer\Pass\Statement\UnexpectedUseOfThis::inspectTryCatch PHP Method

inspectTryCatch() private method

private inspectTryCatch ( TryCatch $tryCatchStmt, Context $context ) : boolean
$tryCatchStmt PhpParser\Node\Stmt\TryCatch
$context PHPSA\Context
return boolean
    private function inspectTryCatch(Stmt\TryCatch $tryCatchStmt, Context $context)
    {
        $result = false;
        /** @var Stmt\Catch_ $catch */
        foreach ($tryCatchStmt->catches as $catch) {
            if ($catch->var === 'this') {
                $result = true;
                $context->notice('unexpected_use.this', 'Catch block can not have a catch variable named "this".', $catch);
            }
        }
        return $result;
    }