Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.x] Laravel Preset - include continue in blank_line_before_statement #95

Merged
merged 1 commit into from
Jul 28, 2022

Conversation

jrseliga
Copy link
Contributor

@jrseliga jrseliga commented Jul 27, 2022

This PR addresses an implied syntax rule of framework for the continue keyword.

When continue does not follow a control structure, a blank line is used to provide some breathing room.

Illuminate\Auth\Access\Gate

if (! $this->canBeCalledWithUser($user, $before)) {
    continue;
}

Illuminate\Collections\Arr

if (static::exists($array, $key)) {
    unset($array[$key]);

    continue;
}

For reference (see Example 3): PHPCS blank_line_before_statement

@nunomaduro nunomaduro changed the title Laravel Preset: Include continue in blank_line_before_statement [1.x] Laravel Preset - include continue in blank_line_before_statement Jul 27, 2022
@zepfietje
Copy link
Contributor

zepfietje commented Jul 27, 2022

I was about to create a PR for this exact rule. However, couldn't we just use the default by PHP CS Fixer?

'blank_line_before_statement' => true,

The default equals:

[
    'break',
    'continue',
    'declare',
    'return',
    'throw',
    'try',
]

Only adding continue to the current rule would be inconsistent, as it's similar to break. Same could be said for the others, so I think it's best to use the default.

@taylorotwell taylorotwell merged commit bc95526 into laravel:main Jul 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants