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

Add support for readonly constructor properties #129

Merged
merged 1 commit into from
Mar 19, 2024

Conversation

andrewnicols
Copy link
Contributor

@andrewnicols andrewnicols commented Feb 17, 2024

public function __construct(
    public readonly int $foo,
    protected readonly int $bar,
) {}

The readonly keywords were being detected as types.

@andrewnicols
Copy link
Contributor Author

Okay, this should now be sorted.

PHP 8.0 and earlier lack the T_READONLY const so I had to refactor for that, and then realised that correct commenting for promoted properties also broke the sniff.

Copy link
Member

@stronk7 stronk7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume that CodeSniffer handles these? Just thinking in advance for anything we may have there related.

@stronk7 stronk7 merged commit 478b16f into moodlehq:main Mar 19, 2024
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants