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

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

Conversation

jrfnl
Copy link
Contributor

@jrfnl jrfnl commented Apr 15, 2023

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.

…sibility

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.
gsherwood added a commit that referenced this pull request May 18, 2023
@gsherwood gsherwood merged commit 4fde74f into squizlabs:master May 18, 2023
26 of 27 checks passed
@jrfnl jrfnl deleted the feature/file-getmethodparameters-improve-constructor-prop-prom-readonly branch May 18, 2023 08:57
@jrfnl jrfnl added this to the 3.8.0 milestone May 18, 2023
@jrfnl
Copy link
Contributor Author

jrfnl commented Dec 8, 2023

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).

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.

None yet

2 participants