PHPCSStandards / PHP_CodeSniffer

PHP_CodeSniffer tokenizes PHP files and detects violations of a defined set of coding standards.
BSD 3-Clause "New" or "Revised" License
880 stars 54 forks source link

Squiz/SelfMemberReference: handle namespace declaration ending on PHP close tag #555

Closed jrfnl closed 1 month ago

jrfnl commented 2 months ago

Description

This change prevents an edge-case false negative for a namespaced self reference, when the namespace declaration would be ended by a PHP close tag instead of the expected T_SEMICOLON or T_OPEN_CURLY_BRACE.

Includes unit test.

Suggested changelog entry

Squiz.Classes.SelfMemberReference: prevent edge case false negative when the namespace declaration would end on a PHP close tag.

Related issues/external references

Related to #552

Types of changes

jrfnl commented 1 month ago

Rebased without changes to get this ready for merge tomorrow.