Re: Re: Strict type declarations not enforced for Reflection API invocation
| From: | lists@rhsoft.net | Date: | Tue, 10 Oct 2017 16:45:10 +0000 |
| Subject: | Re: Re: Strict type declarations not enforced for Reflection API invocation | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-100857@lists.php.net to get a copy of this message | ||
Am 10.10.2017 um 18:41 schrieb Niklas Keller:
2017-10-10 17:10 GMT+02:00 lists@rhsoft.net <mailto:lists@rhsoft.net> <lists@rhsoft.net <mailto:lists@rhsoft.net>>:the two typing modes are perfect and when you converted a 15 years old codebase to strcit-ytpes and type-hints everywehere you know why - first you start with typehints and you can't do that strict or you will burn out and give up but when i define strict types in a PHP file everything but code in includes has to be strict typed inheritedAm 10.10.2017 um 16:57 schrieb Christoph M. Becker:On 10.10.2017 at 15:41, Sebastian Bergmann wrote:I consider this a serious bug that leads to unexpected, confusing problems such as https://github.com/sebastianbergmann/phpunit/issues/2796#issuecomment-335180273 <https://github.com/sebastianbergmann/phpunit/issues/2796#issuecomment-335180273>.I understand Nikita's point of view (see https://github.com/php/php-src/pull/2837#issuecomment-335405067 <https://github.com/php/php-src/pull/2837#issuecomment-335405067>) that changing this behavior (aka. fixing this bug) can be considered a "non-trivial backwards compatibility break". Therefore I would like to bring this issue to the attention of this list with this mail.This is most certainly not an *implementation* bug. The RFC which introduced strict typing[1] states:| By default, all PHP files are in weak type-checking mode.yes but the file in question has strict-types enabled declare(strict_types=1);Yes, butarray_mapalso uses weak types for the callback, like any other internal function call. Butcall_user_funcis also special-cased, maybe we should do the same with the reflection calls. All in all, two typing modes were a bad idea to begin with, mostly because nobody payed attention to callbacks