rfc:treat_enum_instances_as_values

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
rfc:treat_enum_instances_as_values [2023/04/28 21:52] suitespacerndrfc:treat_enum_instances_as_values [2023/04/29 06:52] – Intro grammar suitespacernd
Line 11: Line 11:
 This RFC proposes to allow the use of enum instances as array keys in PHP. More specifically, where errors are produces in any context where an enum instance is used without ->value or ->name, the engine should instead assume ->value. This RFC proposes to allow the use of enum instances as array keys in PHP. More specifically, where errors are produces in any context where an enum instance is used without ->value or ->name, the engine should instead assume ->value.
  
-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 potential future RFC to enable array key type constraints in line with present == vs === semantics and ArrayAccess, without drastic engine overhauls.+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 potential future RFC a path to enable array key type constraints in line with present == vs === semantics and ArrayAccess, without drastic engine overhauls.
  
  
rfc/treat_enum_instances_as_values.txt · Last modified: 2023/04/29 11:04 by suitespacernd