Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision |
rfc:readonly_classes [2022/04/26 06:58] – kocsismate | rfc:readonly_classes [2022/08/21 08:47] (current) – kocsismate |
---|
* Date: 2021-08-04 | * Date: 2021-08-04 |
* Author: Máté Kocsis <kocsismate@php.net> | * Author: Máté Kocsis <kocsismate@php.net> |
* Status: Under Discussion | * Status: Accepted |
* Target Version: PHP 8.2 | * Target Version: PHP 8.2 |
* Implementation: https://github.com/php/php-src/pull/7305 | * Implementation: https://github.com/php/php-src/pull/7305 |
</PHP> | </PHP> |
| |
[[rfc:deprecate_dynamic_properties|PHP RFC: Deprecate dynamic properties]] added support for the ''#[AllowDynamicProperties]'' attribute which can serve as an opt-out mechanism for creating dynamic properties. In order not to violate the read-only constraint, marking readonly classes with the above attribute is a compile-time error: | [[rfc:deprecate_dynamic_properties|PHP RFC: Deprecate dynamic properties]] added support for the ''#[AllowDynamicProperties]'' attribute which makes it possible to create dynamic properties without triggering errors. In order not to violate the read-only constraint, marking readonly classes with the above attribute is a compile-time error: |
| |
<PHP> | <PHP> |
| |
None. | None. |
| |
| ===== Errata ===== |
| |
| * [[https://github.com/php/php-src/issues/9285|https://github.com/php/php-src/issues/9285]]: It used to be possible to add non-readonly properties to readonly classes via traits. As on PHP 8.2 RC 1, traits cannot be used by readonly classes if they define any non-readonly property, otherwise a compilation error is emitted. |
| |
===== Vote ===== | ===== Vote ===== |
| |
Add readonly classes as proposed? | Voted started on 2022-04-27, ending on 2022-05-11 |
| |
| <doodle title="Add readonly classes as proposed?" auth="kocsismate" voteType="single" closed="true"> |
| * Yes |
| * No |
| </doodle> |
| |