Talk in English - US at php[tek] 2024
View Slides: https://wkdb.yt/enums
Short URL: https://joind.in/talk/a3270
(QR-Code (opens in new window))
In January 2020, I delivered a conference talk titled "Enums: The Missing Data Type", which ended on a sour note: PHP probably would not have a native type for handling enumerations any time soon. To my surprise and delight, PHP 8.1 would release with a new "Enum" type less than two years later. Now we can really explore enumerations: both the theory behind them and the current PHP implementation. We’ll cover how representing things like statuses with enums improves immutability, readability, and type safety; the different types of enums available to us; and address the most common questions:
- Why can't PHP enums be extended like other classes?
- Why can't backed PHP enums be cast to a string or int?
- Why can't backed PHP enums be used as an array key?
Comments
Comments are closed.
I think the technical difficulties shook Andy, but the talk was full of great background and clever uses of enums. As usual, Andy knows his stuff!
Great talk, and easy to follow along. Really enjoy this speaker.
Well delivered and planned. Could have gotten more into application of Enums as a means to illustrate claims about benefits of Enums.