-
-
Notifications
You must be signed in to change notification settings - Fork 742
Closed
rectorphp/rector-src
#6958Closed
Copy link
Labels
Description
Bug Report
| Subject | Details |
|---|---|
| Rector version | e.g. v2.0.17 |
Rector adds a white space after new keyword before a line break.
This is an issue when declaring anonymous classes implementing an interface with generic typing.
The generic type declaration must be between the new and the class keywords.
The added white space is removed by PHP CS Fixer.
This is a recent behaviour, that appeared after May the 1st 2025.
See https://getrector.com/demo/2516b692-0b45-4ce4-8c2a-a835533cc8c5
Minimal PHP Code Causing Issue
<?php
$stringable = new
/**
* @implements \Stringeable
*/
class implements \Stringeable {
#[\Override]
public function __toString(): string
{
return '';
}
};Expected Behaviour
Rector shouldn't change the code.
Reactions are currently unavailable