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
937 stars 56 forks source link

Squiz/DisallowMultipleAssignments: fix false positive when handling parameter default values #557

Closed rodrigoprimo closed 3 months ago

rodrigoprimo commented 3 months ago

Description

This PR fixes a bug in the code used to check if a equal sign is used to set a default value for a parameter. This bug caused a false positive when the function declaration was missing the closing parenthesis (which can happen during live coding).

Suggested changelog entry

Squiz.PHP.DisallowMultipleAssignments false positive for parameter default values when the closing parenthesis of the function declaration is missing.

Related issues/external references

Fixes https://github.com/PHPCSStandards/PHP_CodeSniffer/issues/551

Types of changes

PR checklist