Skip to content

FinalizeClassesWithoutChildrenRector removed newline before final when class has Attributes #8080

@cngJo

Description

@cngJo

Bug Report

Subject Details
Rector version Rector 0.17.6

The FinalizeClassesWithoutChildrenRector rector removes newlines when the class has and attribute in the line above.

Minimal PHP Code Causing Issue

#[Attribute]
class Dummy
{
}

will get corrected to

#[Attribute]final class Dummy
{
}

When I add the line break before final again and rerun rector, I get no changes, so it doesn't seem to have anything to do with e.g. the length of the lines.

Expected Behaviour

I'd expect rector to not remove the line break before the final keyword.

Or "spoken" in PHP ;-)

#[Attribute]
final class Dummy
{

}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions