rfc:treat_enum_instances_as_values
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
rfc:treat_enum_instances_as_values [2023/04/28 21:52] – suitespacernd | rfc:treat_enum_instances_as_values [2023/04/29 11:04] (current) – typo correction suggested by internals suitespacernd | ||
---|---|---|---|
Line 11: | Line 11: | ||
This RFC proposes to allow the use of enum instances as array keys in PHP. More specifically, | This RFC proposes to allow the use of enum instances as array keys in PHP. More specifically, | ||
- | This change aims to enhance the usability and consistency of enums in PHP by treating enum instances as symbols of their respective values - especially in the context of array keys. This will allow large amounts of existing code in various C-style languages to be compatible with PHP usage without affecting current projects. Further, this enables | + | This change aims to enhance the usability and consistency of enums in PHP by treating enum instances as symbols of their respective values - especially in the context of array keys. This will allow large amounts of existing code in various C-style languages to be compatible with PHP usage without affecting current projects. |
+ | |||
+ | Further, this proposal provides | ||
Line 119: | Line 121: | ||
//... | //... | ||
- | public function offsetGet($mixed $which){ | + | public function offsetGet(mixed $which){ |
//... | //... | ||
} | } | ||
Line 143: | Line 145: | ||
===== Implementation ===== | ===== Implementation ===== | ||
- | Author' | + | Author' |
rfc/treat_enum_instances_as_values.1682718733.txt.gz · Last modified: 2023/04/28 21:52 by suitespacernd