Skip to content

The statement if must contain its code within a {} block is reported incorrectly #32

Open
@jbrooksuk

Description

@jbrooksuk

This code:

App::error(function(Exception $exception, $code) {
    Log::error($exception);
    if (Config::get('app.debug') === FALSE && $code <> 404) {
        switch ($code) {
            case 401: $errorTitle = 'Unauthorized'; break;
            case 403: $errorTitle = 'Forbidden'; break;
            // case 404: $errorTitle = 'Not Found'; break;
            case 408: $errorTitle = 'Request Timeout'; break;
            case 500: $errorTitle = 'Internal Server Error'; break;
            case 502: $errorTitle = 'Gateway Timeout'; break;
            case 503: $errorTitle = 'Service Unavailable'; break;
            case 508: $errorTitle = 'Loop detected'; break;
            default: $errorTitle  = 'Unknown Error';
        }

        $hasView = View::exists('errors.' . $code);

        return Response::view('errors.' . ($hasView ? $code : 500), [
            'errorCode'  => $code,
            'exception'  => $exception,
            'errorTitle' => $errorTitle
        ], $code);
    }
});

Is being reported as needing the if condition to be in its own block. The problem is that it already is.

I don't think that I've broken this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions