> `__toArray` as a magic function call when `(array)` cast happen is a bad > idea: it is a BC break,
Adding a new magic method is not a backwards compatibility break. The PHP documentation on magic methods states: "Caution PHP reserves all function names starting with __ as magical. It is recommended that you do not use function names with __ in PHP unless you want some documented magic functionality.” Any user implementing their own methods prefixed with a double underscore is taking the chance that their code could break in the future. > and it removes one of the very few interactions (with objects) that didn't > cause any side-effects (https://externals.io/message/98539#98545 > <https://externals.io/message/98539#98545>, > https://externals.io/message/98539#98567 > <https://externals.io/message/98539#98567>) PHP 7.4 introduced the "get_mangled_object_vars()” as a result of these concerns.