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

Squiz/SelfMemberReference: bug fix - false negative with namespace keyword as operator #587

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Aug 5, 2024

Description

The namespace keyword can both be used for namespace declarations as well as as an operator - "magic keyword" - to resolve to the current namespace.
See: https://www.php.net/manual/en/language.namespaces.nsconstants.php#example-298

This last case is not correctly taken into account when determining the current namespace, which leads to false negatives.

Fixed now.

Includes test.

Suggested changelog entry

Fixed: Squiz.Classes.SelfMemberReference: false negatives when namespace keyword used as operator was encountered between the namespace declaration and the OO declaration.

Related issues/external references

Fixes #553

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

…yword as operator

> The `namespace` keyword can both be used for namespace declarations as well as as an operator - "magic keyword" - to resolve to the current namespace.
> See: https://www.php.net/manual/en/language.namespaces.nsconstants.php#example-298

> This last case is not correctly taken into account when determining the current namespace, which leads to false negatives.

Fixed now.

Includes test.

Fixes 553
@jrfnl jrfnl added this to the 3.10.x Next milestone Aug 5, 2024
@jrfnl jrfnl merged commit c76678a into master Aug 9, 2024
50 checks passed
@jrfnl jrfnl deleted the feature/553-squiz-selfmemberreference-fix-false-negative-namespace-keyword-as-operator branch August 9, 2024 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Squiz.Classes.SelfMemberReference: false negative if file contains namespace operator
1 participant