-
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
Anonymous classes with interfaces missing space before opening bracket cause parse error with PSR-12 ruleset #3790
Comments
@jwittorf Thank you for reporting this. I've been able to reproduce the issues and am working on a fix. |
Okay, done. PR #3791 should fix this. Testing appreciated. |
Thanks for your quick response and fix @jrfnl! I've tested it in my setup, looks good :) But the checks for PHP 8.2 still fail? |
Thanks for testing, Re: the PHP 8.2 test run, that is unrelated to this issue. See #3731 |
This comment was marked as off-topic.
This comment was marked as off-topic.
@fredden As I pointed out before, they are related. Also: different discussion, not in this issue. |
@jrfnl it looks like #3791 only addresses one of the four bullet points raised in this issue. Did you determine that the other three are false-alerts / side effects?
From what I can tell:
|
Sorry @jrfnl, I've now seen the note on the pull request which specifically addresses my query. |
FYI: the fix for this issue is included in today's PHP_CodeSniffer 3.8.0 release. As per #3932, development on PHP_CodeSniffer will continue in the PHPCSStandards/PHP_CodeSniffer repository. If you want to stay informed, you may want to start "watching" that repo (or watching releases from that repo). |
Describe the bug
In some cases anonymous classes with
extends
andimplements
cause aParseError
after "fixing" the file.It happens if there is no space between the last interface-name and the
{
, see following code samples.The following happens, see code samples at the end:
new
keyword gets additional()
braces{
for the class gets removedCode sample
Custom ruleset
To reproduce
Steps to reproduce the behavior:
test.php
with the code sample above...phpcs test.php ...
Expected behavior
I would expect the correct formatting like the code below with following "steps":
{
into an own line, no indention()
after thenew
keywordVersions:
The text was updated successfully, but these errors were encountered: