On 12.01.21 17:51, Marco Pivetta wrote:
Code written to deal with `array` in a generic way will no longer work
when
invoked through code paths that produce object keys: this is a general
problem with widening types overall, and is a clear BC break.

If you look at levels of BC break, this is on the very low end in my
opinion. No existing code will break when upgrading to this new PHP
version. Only new code written specifically for that PHP version would
be impacted, and frameworks/libraries could, if necessary, add
additional checks without becoming incompatible with older PHP versions.
It helps that currently array keys can be integers or strings, so if the
key type is important, some checking is already necessary.

Of course tools like Psalm would see a lot of potential issues, but
those would only be potential (with new code using this new feature) and
having static analyzers reduces the impact of such a BC break even more,
as it becomes much easier to spot issues. Might be interesting to change
array key type definitions for a few projects/libraries and see if there
are that many potential issues, and what they look like.

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to