Re: Missing reflection info about strict types?

From: Date: Mon, 05 Sep 2016 13:52:07 +0000
Subject: Re: Missing reflection info about strict types?
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-95645@lists.php.net to get a copy of this message
On Mon, Sep 5, 2016 at 3:19 PM, Julien Pauli <jpauli@php.net> wrote: > On Mon, Sep 5, 2016 at 2:44 PM, Nicolas Grekas <nicolas.grekas@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 Any souls to +1 the reflection patch ? Julien

« previous php.internals (#95645) next »