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). Here is my current regex to do so: > $c = '(?:\s*+(?:(?:#|//)[^\n]*+\n|/\*(?:(?<!\*/).)++)?+)*+'; > $strictTypesRegex = str_replace('.', $c, "'^<\?php\s.declare.\(.strict_ types.=.1.\).;'is"); Nicolas