On 9/5/2016 10:38 PM, Nikita Popov wrote:
> Stripping strict_types declaration will change the behavior of the code
> declared *within those files* (not the code calling that code). The
> behavior should not change in the merge process.
> 
> As I see it, the issue here is really not how to figure out whether a file
> uses strict_types, the issue is how you mix strict_types=1 and
> strict_types=0 code in a single file.
> 
> Back when this feature was introduced, we decided not to allow this kind of
> mixing, as it seemed prone to causing a mess and use-cases seemed doubtful.
> Given the issue Symfony is experiencing, we should reevaluate this
> decision. Imho it's not good if there are some things you simply *cannot*
> express in a single file.
> 
> Nikita
> 

Well, I still think that the declare approach is kind of weird and
creates two PHP worlds and that it would be easier if scalar type hints
are always enforced. However, I do not see why it is an issue for
Symfony here.

One can use the tokenizer to check if a file has a strict declare in it
and instead of creating a single output file create two. One that has no
strict declare and one that has a strict declare.

It might have a slight performance impact compared to a single file but
it solves the issue at hand.

The issue you describe (inability to express something in a single file)
is part of the design of declare ...

-- 
Richard "Fleshgrinder" Fussenegger

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to