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

FunctionDeclarations::getParameters(): allow for readonly properties without visibility #456

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Apr 15, 2023

Follow up on PR #363 which was included in PHPCSUtils 1.0.0-alpha4.

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 Variables::getMemberProperties() method, but were not handled correctly in the FunctionDeclarations::getParameters() method.

Fixed now.

Includes updated documentation and a unit test.

A similar PR has been pulled upstream squizlabs/PHP_CodeSniffer#3801

…without visibility

Follow up on PR 363 which was included in PHPCSUtils 1.0.0-alpha4.

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 `Variables::getMemberProperties()` method, but were not handled correctly in the `FunctionDeclarations::getParameters()` method.

Fixed now.

Includes updated documentation and a unit test.

A similar PR has been pulled upstream squizlabs/PHP_CodeSniffer 3801
@jrfnl jrfnl added this to the 1.0.x Next milestone Apr 15, 2023
@jrfnl jrfnl merged commit eed7c1b into develop Apr 15, 2023
@jrfnl jrfnl deleted the utils/functiondeclarations-getparameters-improve-readonly-handling branch April 15, 2023 08:43
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.

1 participant