Support readonly class syntax

Description

In PHP 8.2 class declaration can be prefixed with the readonly keyword. Thus, all properties of the class will be readonly. So you don't need to add the read only keyword to any property in this class.

readonly class Post { public function __construct( public string $title, public Author $author, public string $body, public DateTime $publishedAt, ) {} }

Our parser will fail on this syntax because we do not allow the readonly keyword before the class keyword.

There will be no effect on any rule.

Activity

Done
Pinned fields
Click on the next to a field label to start pinning.

Details

Assignee

Reporter

Components

Sprint

Fix versions

Priority

Sentry

Created September 7, 2022 at 8:56 AM
Updated October 16, 2024 at 2:37 PM
Resolved September 14, 2022 at 9:06 AM