[PR #9340] Use the readonly annotation #11541

Closed
opened 2026-01-22 16:11:05 +01:00 by admin · 0 comments
Owner

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

State: closed
Merged: Yes


Several public properties are documented as READ-ONLY: <some explanation>. However, in the meantime, PHP has implemented real readonly properties and Psalm supports the docblock annotation @readonly to emulate its sematics.

https://psalm.dev/docs/annotating_code/supported_annotations/#psalm-readonly-and-readonly

I propose to switch to that annotation to allow Psalm to detect unintended access to those properties.

Note: I have skipped the ClassMetadataInfo class because most of the properties flagged as READ-ONLY there are actually not used accoding to PHP 8.1's semantics.

**Original Pull Request:** https://github.com/doctrine/orm/pull/9340 **State:** closed **Merged:** Yes --- Several public properties are documented as `READ-ONLY: <some explanation>`. However, in the meantime, PHP has implemented real `readonly` properties and Psalm supports the docblock annotation `@readonly` to emulate its sematics. https://psalm.dev/docs/annotating_code/supported_annotations/#psalm-readonly-and-readonly I propose to switch to that annotation to allow Psalm to detect unintended access to those properties. Note: I have skipped the `ClassMetadataInfo` class because most of the properties flagged as `READ-ONLY` there are actually not used accoding to PHP 8.1's semantics.
admin added the pull-request label 2026-01-22 16:11:05 +01:00
admin closed this issue 2026-01-22 16:11:06 +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#11541