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

Generic/UselessOverridingMethod: improve handling of PHP open/close tags between statements #554

Closed jrfnl closed 1 month ago

jrfnl commented 2 months ago

Description

This change prevents an edge-case false negative where a parent::method() function call statement ended by a PHP close tag without any "function content" of note after it, would not be reported as a useless overriding method.

Includes unit tests.

Suggested changelog entry

Generic.CodeAnalysis.UselessOverridingMethod: prevent edge case false negative when the call to the parent method 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.