Re: Strict type declarations not enforced for Reflection API invocation
| From: | Sebastian Bergmann | Date: | Wed, 11 Oct 2017 05:53:40 +0000 |
| Subject: | Re: Strict type declarations not enforced for Reflection API invocation | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-100860@lists.php.net to get a copy of this message | ||
Am 10.10.2017 um 18:53 schrieb Nikita Popov:
> The problem are not internal function calls, the problem are callbacks. In
> fact, the proposed fix does not actually fix the problem you encountered in
> PHPUnit, as it is going to use the strictness mode at the reflection
> call-site, not the strictness mode used by the file defining the data
> provider.
I was aware of that (I only saw the pull request but did not look at it),
thanks for clarifying.
> I believe that the proper way to fix this is to handle dynamic function
> invocations differently from direct invocations. Direct invocations should
> use the strictness level of the call-site, while dynamic invocations should
> use the strictness level of the declaration-site. This means that the
> internal array_map and a userland reimplementation will behave consistent.
> It also means that PHPUnit will be able to respect the strictness level of
> file defining the data provider, etc. I've seen a number of complaints
> about our handling of callbacks wrt strict_types, so I think it's
> worthwhile to at least consider making such a change.
I think this makes sense. Is this something that can be achieved for PHP
7.2 or does it have to wait for PHP 7.3?