squizlabs / PHP_CodeSniffer

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

File::getMethodParameters(): allow for readonly promoted properties without visibility #3801

Closed jrfnl closed 1 year ago

jrfnl commented 1 year ago

Follow up on PR #3516 which was included in PHPCS 3.7.0.

Turns out that constructor property promotion also allows for declaring properties with the readonly keyword, but without explicit visibility set. See: https://3v4l.org/nli62

Readonly properties without explicit visibility are already handled correctly in the File::getMemberProperties() method, but were not handled correctly in the File::getMethodParameters() method.

Fixed now.

Includes updated documentation and a unit test.

jrfnl commented 10 months ago

FYI: this fix is included in today's PHP_CodeSniffer 3.8.0 release.

As per #3932, development on PHP_CodeSniffer will continue in the PHPCSStandards/PHP_CodeSniffer repository. If you want to stay informed, you may want to start "watching" that repo (or watching releases from that repo).