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

inspectForeach() private method

private inspectForeach ( PhpParser\Node\Stmt\Foreach_ $foreachStmt, Context $context ) : boolean
$foreachStmt PhpParser\Node\Stmt\Foreach_
$context PHPSA\Context
return boolean
    private function inspectForeach(Stmt\Foreach_ $foreachStmt, Context $context)
    {
        if ($foreachStmt->valueVar->name === 'this') {
            $context->notice('unexpected_use.this', 'Foreach loop can not use a value variable named "this".', $foreachStmt->valueVar);
            return true;
        }
        return false;
    }