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
NoUnusedImportsFixer - Fix undetected unused imports when type mismatch #5720
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This incorrectly removes on of the imports for a union catch:
// ...
} catch (InvalidFormatException | ParseErrorException) {
@GrahamCampbell I don't reproduce that, could you provide the full snippet please? |
Oh, I think the issue only occurs when combined with #5685. |
@GrahamCampbell Actually I didn't notice your snippet uses a non-capturing catch 😐. I do reproduce the issue now, trying to fix it. |
efd58dc
to
2612092
Compare
Fixed in #5685, which this PR now depends on. Thanks @GrahamCampbell! |
2612092
to
12994c5
Compare
I think this also has an issue with PHP 8 attributes. <?php
use Symfony\Component\Routing\Annotation\Route;
class Controller
{
#[Route('/foo', name: 'foo')]
public function foo(Request $request): Response
{
}
} |
209767f
to
f1fde51
Compare
@GrahamCampbell Fixed too, thanks 👍 |
a148d2f
to
2770ab7
Compare
Where there other changes there, or just a rebase? |
2770ab7
to
b9b22ff
Compare
Fixed another issue for
First case is 100% |
I think the current code is fine. If we know for sure that the tested token does not match a |
The |
Merge conflicts. 😭 |
22c35a0
to
526a8b9
Compare
f84f158
to
1fc2bda
Compare
Thank you @julienfalque. |
thanks @SpacePossum |
@julienfalque I think this changed has caused an issue with not detecting PHP 8 attributes usage when there is more than one in a block, for example with the below code the
|
@andyrooster can you create a bug ticket for this following the template, so this can be properly tracked? |
Fixes #3020.