Skip to content

[PostRector] Skip inline {@see } used use statement on remove unused imports#8080

Merged
TomasVotruba merged 9 commits into
mainfrom
skip-inline-see
Jun 24, 2026
Merged

[PostRector] Skip inline {@see } used use statement on remove unused imports#8080
TomasVotruba merged 9 commits into
mainfrom
skip-inline-see

Conversation

@samsonasik

Copy link
Copy Markdown
Member

@samsonasik

Copy link
Copy Markdown
Member Author

Fixed 🎉 /cc @mspirkov

@mspirkov

Copy link
Copy Markdown
Contributor

Thanks!

@samsonasik samsonasik requested a review from TomasVotruba June 23, 2026 11:53
@samsonasik

Copy link
Copy Markdown
Member Author

@TomasVotruba ready 👍

@cosmastech

Copy link
Copy Markdown

Does this account for @throws as well?

@samsonasik

samsonasik commented Jun 24, 2026

Copy link
Copy Markdown
Member Author

Only for inline {@see ...}, {@uses ... }, {@used-by ... }

@cosmastech

Copy link
Copy Markdown

Only for inline {@see ...}, {@uses ... }, {@used-by ... }

Should @throws be added as well? That's also broken.

@samsonasik

Copy link
Copy Markdown
Member Author

Could you give example reference?

@samsonasik

samsonasik commented Jun 24, 2026

Copy link
Copy Markdown
Member Author

I can't found anywhere use of inline {@throws ...} with curly {} braces, if you can give me documentation of that usage, I may can add to the patch.

@samsonasik

Copy link
Copy Markdown
Member Author

@TomasVotruba ready 👍

@cosmastech

cosmastech commented Jun 24, 2026

Copy link
Copy Markdown

I can't found anywhere use of inline {@throws ...} with curly {} braces, if you can give me documentation of that usage, I may can add to the patch.

Sorry, I misunderstood that this was specifically for curly braces. Perhaps it's a separate PR that needs created.

I upgraded and ran rector yesterday. I had a class like this:

namespace MyApp\Interfaces;

use MyApp\Exceptions\NotFoundException;

interface MyService
{
    /**
     * @throws NotFoundException
     */
    public function add(int $id): void;
}

Running rector, the use MyApp\Exceptions\NotFoundException; was stripped off.

edit: Just tried reproducing this and couldn't. 🤔 Sorry for the confusion!

@samsonasik

Copy link
Copy Markdown
Member Author

That should already covered by previous PR that skip feature should clear php doc attribute early:

Try latest dev-main, if the issue persist, fill free to provide failing fixture on separate PR.

Thank you.

@cosmastech

Copy link
Copy Markdown

That should already covered by previous PR that skip feature should clear php doc attribute early:

Try latest dev-main, if the issue persist, fill free to provide failing fixture on separate PR.

Thank you.

It turns out someone had written /* @throws SomeException */ 🫠

Sorry for all the confusion!

@samsonasik

Copy link
Copy Markdown
Member Author

@TomasVotruba ready 👍

@TomasVotruba TomasVotruba merged commit a181f3f into main Jun 24, 2026
67 checks passed
@TomasVotruba TomasVotruba deleted the skip-inline-see branch June 24, 2026 12:46
@TomasVotruba

Copy link
Copy Markdown
Member

Thanks 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Rector removes class imports that are specified only in inline tags @see

5 participants