-
-
Notifications
You must be signed in to change notification settings - Fork 17
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
Disabling Else / Elseif #68
Comments
Hi, language constructs like I have no plan to add those, at least for now. |
Would you be open to a pull request regarding the functionality? @spaze |
I'm generally open for PRs and welcome them but in this case I think the PR would be too big for a feature that would be rarely used. Disallowing only I'd say you'd be better off with a custom PHPStan extension, if you're not willing to use the banned code extension. Building a custom extension might be easier than it seems. For example look at the following class Then you need to register the extension, similar (a bit easier) to Let me know if you need help. |
Hey @JBx0, now as the extension has matured a bit, I was wondering whether adding support for |
Checking params inside ( ... ) doesn't work at the moment, so you can disallow all `declare()`s but can't re-allow e.g. `declare(strict-types = 1)`. Close #68
Checking params inside ( ... ) doesn't work at the moment, so you can disallow all `declare()`s but can't re-allow e.g. `declare(strict-types = 1)`. Close #68
Checking params inside ( ... ) doesn't work at the moment, so you can disallow all `declare()`s but can't re-allow e.g. `declare(strict-types = 1)`. If you try to disallow `else if` with the space, an exception will be thrown, because `else if` is parsed as `else` followed by `if`, so disallowing `else if` with the space wouldn't have the desired effect and the result would be unexpected. Close #68
Added basic support to disallow control structures in #257. |
Hey hey,
I would love to enable else/elseif in my codebase.
How would one go and do that, I tried all kinds of wildcard strings whitespace etc etc with your package but it didn't pick up any else & elseifs
I managed to detect elseifs with the banned code extension like this:
Tried it with:
The text was updated successfully, but these errors were encountered: