Skip to content
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

Fix namespace matching #254

Merged
merged 7 commits into from
Jan 4, 2024
Merged

Conversation

priyadi
Copy link
Contributor

@priyadi priyadi commented Dec 30, 2023

This fixes the bug where, for example, the namespace App\DomainService incorrectly gets matched using App\Domain

Resolves #253

@carlosas
Copy link
Owner

carlosas commented Dec 30, 2023

Hi. Thanks for the PR.
Can you create a test for this?

I'll have a look to the failing PHPCS-Fixer ASAP, it doesnt seem an error from the changes, probably related to an update

@priyadi
Copy link
Contributor Author

priyadi commented Dec 31, 2023

I added a test, but I don't know if this is the proper way to do this. There don't seem to be existing tests specifically targeting selectors. However, I verified that it gives an error with the old code, and a success after the modification, as it should.

@carlosas
Copy link
Owner

it seems to work 👍 that test is enough, I will try to improve the system in the future.

however, there are two failing steps in the CI:

  • php-cs-fixer: it seems that now they catch FQCNs in the comments as well, and I want to test that FQCNs are catched. there seems to be a WIP way to ignore certain rules in some lines feat: [PoC] Support disabling PHP-CS-Fixer for single lines and rules PHP-CS-Fixer/PHP-CS-Fixer#7569
    For now, can you try locking the php-cs-fixer version so the maximum is the previous one? otherwise just apply it on local using the last version and I will revert to using the FQCN again in the future.
  • phpunit on php 7 here: it seems "Namespace" is a reserved token word even inside a use statement on php 7 (they fixed it on php 8), can you rename the fixture namespace to something else? I will drop support for php 7 soon so I can rollback this workaround as well in the future.

@priyadi
Copy link
Contributor Author

priyadi commented Dec 31, 2023

It looks all OK now

@carlosas carlosas merged commit d045f3a into carlosas:master Jan 4, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Selector::inNamespace incorrectly matches classes outside namespace with a similar name
2 participants