A problem I’ve been putting off is slowly creeping up my board and I’d like your opinion on it.
ClassMethodsHydrator for populating models from database query results. The setters have type hints. Prior to 3.0 all worked well - although the database returns things as strings, they were coerced to the correct type by PHP.
With the introduction of
strict_types all this is broken, so we’ve had to pin to 2.4.2 until we sort it out, either by removing the type hints and explicitly casting on assignment or by doing something even more fancy. Whatever, it’s going to be a lot of work.
Personally I’m not at all sure that a library designed to call user code should use strict_types. I can’t see it flagged in the changelog (might have missed it) and wonder if the impact was fully thought through. If not, would you consider removing it from
ClassMethodsHydrator? I’m happy to do a PR!
Otherwise, does anyone have suggestions for working around this?
DB2 datatypes and laminas/laminas-hydrator - Decimal, Numeric and BigInt are treated as strings looks like a similar issue.