Skip to content

do while calculation #6

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

Open
bkdotcom opened this issue Oct 27, 2021 · 2 comments
Open

do while calculation #6

bkdotcom opened this issue Oct 27, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@bkdotcom
Copy link

sniff calculates this to be 7
codeclimate.com calculates it to be 5 (I think)
I think it should be 6 ??

public function doWhile()
{
    if (true) {         // 1
        $val = true    // 2
            ? 'foo'
            : 'bar';
    }
    do {                   //  nesting inc
        if (true) {        // 2
            break;
        }
    } while (false);    // 1
}

do {} while(); should have the same complexity as a while() {}

If we agree the value should be 6, I can add and new test to my PR

@Rarst
Copy link
Owner

Rarst commented Oct 27, 2021

Yes, while and do while should behave same according to spec.

More granular with PRs, please. I'd rather deal with small focused ones, since this is not a code I am actively working with day to day. :)

@Rarst Rarst added the bug Something isn't working label Oct 27, 2021
@bkdotcom
Copy link
Author

👍
simply need to remove T_DO from the increments const
T_WHILE has it covered

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants