Dear CodeIgniter Development Team,
With the recent transition to PHP 8, I would like to propose an enhancement to the entity casting functionality, specifically focusing on the $defaultCastHandlers array within the Entity class.
The current $defaultCastHandler array manages various data types, providing default convert handlers for types like arrays, booleans, CSV, datetime, floats, integers, JSON, objects, strings, timestamps, and URIs.
My proposal is to extend this capability to include enums, allowing developers to specify enum types and have them automatically cast to the appropriate enum instances.
This enhancement would bring several benefits:
- Improved type safety by enforcing enum values.
- Cleaner and more maintainable code by using enums instead of string constants or other scalar types.
- Better integration with PHP 8 features, aligning with modern PHP development practices.
Thank you for considering this enhancement. I believe it will significantly improve the developer experience and align CodeIgniter with modern PHP capabilities.
Best regards