On Tue, Jul 24, 2018 at 1:15 AM Stanislav Malyshev <[email protected]> wrote: > > Hi! > > > Please note that for traits and closures it's not possible to determine > > this at compile time. > > Why not for closures? I thought closures are bound at definition site, > and thus should know everything at compile time? > > -- > Stas Malyshev > [email protected] > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php
Closures can be rebound to another scope; see [Closure::bindTo][1]'s second parameter. I have a [pull request][2] that adds a compile-time warning for usages of "parent" without a parent. It need a review; there is a case where the warning is emitted twice and I don't know what to do. [1]: https://secure.php.net/manual/en/closure.bindto.php [2]: https://github.com/php/php-src/pull/3404 -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
