Skip to content

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
Development

Successfully merging this pull request may close these issues.

1 participant