-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
match() nested within if() statement breaks setting of "conditions" key #3750
Comments
Thanks for reporting this @momala454 ! I've been able to confirm the bug. Smallest reproduction example: if (!match (1) {
default => 1,
}) {
} The |
I haven't had a chance to properly debug this yet (and may be a while before I can). Relevant part of the verbose output:
... and then the backtrace doesn't appear to happen ? I can see that for closures the debug output from the Note: as I said, haven't done proper debugging yet, so I may well be wrong. |
#3763 may be a duplicate of this (unconfirmed), but definitely looks related. Probably a good idea to look at both code samples when addressing either these. |
hello, any updates ? |
Describe the bug
The rule
SlevomatCodingStandard.ControlStructures.EarlyExit
will cause the following error at line 1 (but there is nothing on line 1), and there shouldn't be any error, the code is valid and doesn't contains any if without a curly braceCode sample
Custom ruleset
Strangely, adding anything (even a comment) on the last line inside
foreach
avoid the error. Like this :To reproduce
Steps to reproduce the behavior:
test.php
with the code sample above...phpcs test.php ...
Expected behavior
A clear and concise description of what you expected to happen.
Versions (please complete the following information):
Additional context
Add any other context about the problem here.
Initially reported there slevomat/coding-standard#1506 . They say :
Originally posted by @kukulich in slevomat/coding-standard#1506 (comment)
The text was updated successfully, but these errors were encountered: