Skip to content
This repository was archived by the owner on Jan 3, 2024. It is now read-only.

Reduce if nesting depth #1

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Reduce if nesting depth #1

wants to merge 4 commits into from

Conversation

garas
Copy link

@garas garas commented Sep 30, 2018

Your code has

if ($checkIfOk) {
    // long block
} else {
    throw new Exception();
}

When nested it becomes even worse.

Return/throw early and avoid nesting. Reason of failure is now also close to exception.

if (!$checkIfOk) {
    throw new Exception();
}
// long block

Also few more fixes.

Mark checkbox Hide whitespace changes in Files tab of this PR to see actual changes.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants