On Mon, Sep 5, 2016 at 2:44 PM, Nicolas Grekas <nicolas.gre...@gmail.com> wrote: > Thanks for trying Julien > >> I guess what you miss for what you want to do, is to detect if strict >> types are activated into the current scope, at runtime. > > > From the inside, the author of the code knows if they added the declare or > not. > I'd need to know from the outside, before concatenating it, if some file has > strict types. > This could be exposed on the reflection, since a function/method/class could > have a flag that tells if it has been compiled with strict types enabled or > not. > The current alternative is to parse the source to check if it starts with > the declare directive (but not trivial because of non semantic tokens). >
Then you need reflection. I just added ReflectionClass:isStrictlyTyped() and ReflectionFunction::isStrictlyTyped() to my patch https://github.com/jpauli/php-src/tree/is_strict_types Julien.P -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php