-
Notifications
You must be signed in to change notification settings - Fork 31
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
The statement if must contain its code within a {} block is reported incorrectly #32
Comments
@tchule I've narrowed down the issue to being anything which calls a function within the condition itself. See this test file I've just added. |
If you remove the |
The offending code is: if (!$this->tokenizer->checkNextValidToken(T_BRACES_OPEN)) {
$msg = $this->_getMessage('NEED_BRACES', $stmt);
$this->_writeError('needBraces', $msg);
} It's too strict. The code only needs to be concerned with the fact that it ends with a That, or we need a way of knowing if a control statement contains a body. This is where an AST would be useful. |
Problem occurs because the closing parenthese after Should count the opening and closing parentheses. |
Humm, ok, we already count the opening/closing. Problem is in "_processParenthesisClose()", this part of the code existed before we used a stack. We use flags to know if we are in a function call or a control statement. But we fail to recognize the anonymous function structure. These flags should be replaced by a proper use of the statement stack, but it impacts a lot of code. |
This 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?
The text was updated successfully, but these errors were encountered: