I gave SplEnum a quick read as well.  It seems they are solving a
different use case.  SplEnum appears to be optimized for the case
where you have some inherently-integer constants floating around your
code (due to legacy or interoperation with C or network protocols or
what-have-you), and you want to give them prettier names while
facilitating safe conversion between the integers and the fancy names.

For example, with SplEnum I can do:

new HttpStatus($status)

and it will throw an exception if $status isn't a valid http status
code, otherwise it will give me HttpStatus::FOUR_OH_FOUR or what have
you.

The proposed MW enumeration class is when you don't want to think of
your enumerated types as integers at all.
   --scott

_______________________________________________
Wikitech-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Reply via email to