[PR #10059] Fix setting readonly properties in different scopes #12064

Open
opened 2026-01-22 16:12:48 +01:00 by admin · 0 comments
Owner

Original Pull Request: https://github.com/doctrine/orm/pull/10059

State: closed
Merged: No


Looks like #10049 can be fixed like this, it simply uses the described method from the RFC by changing the scope to the declaring class.

It will only be executed if the isReadOnly-method is present, this will also check if PHP is 8.1 or higher, I am not sure if there is any performance impact on this.

As I described in the tests/Doctrine/Tests/ORM/Functional/Ticket/GH10049Mocks.php file, it is required to have them outside, otherwise, the file will be fully parsed by PHP 7.4 and will throw an error because the keyword readonly is new and not backwards compatible.

Fixes: #10049

**Original Pull Request:** https://github.com/doctrine/orm/pull/10059 **State:** closed **Merged:** No --- Looks like #10049 can be fixed like this, it simply uses the described method from the RFC by changing the scope to the declaring class. It will only be executed if the `isReadOnly`-method is present, this will also check if PHP is 8.1 or higher, I am not sure if there is any performance impact on this. As I described in the `tests/Doctrine/Tests/ORM/Functional/Ticket/GH10049Mocks.php` file, it is required to have them outside, otherwise, the file will be fully parsed by PHP 7.4 and will throw an error because the keyword `readonly` is new and not backwards compatible. Fixes: #10049
admin added the pull-request label 2026-01-22 16:12:48 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#12064