-
-
Notifications
You must be signed in to change notification settings - Fork 737
Closed
rectorphp/rector-src
#7042Labels
Description
Bug Report
| Subject | Details |
|---|---|
| Rector version | last dev-main |
| Installed as | composer dependency |
Minimal PHP Code Causing Issue
See https://getrector.com/demo/956d4e47-af5b-4d66-8a31-f95019ea7abf
<?php
declare(strict_types=1);
// some comment about the file
// not about the use statement below it.
/* comment
block */
######
use Exception;
use stdClass;
use SomeOtherClass;
final class DemoFile
{
public ?stdClass $b;
}Responsible rules
->withImportNames(removeUnusedImports: true)
Expected Behavior
The expected output is:
<?php
declare(strict_types=1);
// some comment about the file
// not about the use statement below it.
/* comment
block */
######
use stdClass;
final class DemoFile
{
public ?stdClass $b;
}i.e. code shown in the green box should not be getting removed:
