On Mon, Sep 5, 2016 at 10:30 PM, Davey Shafik <da...@php.net> wrote:

> On Mon, Sep 5, 2016 at 1:13 PM, Nicolas Grekas <nicolas.gre...@gmail.com>
> wrote:
>
> > > Why do you concatenate these files in the first place?
> > >
> > >
> >
> > It's not specifically me but Symfony's ClassCollectionLoader::load()
> > method, which generates a single file with common classes inlined for
> > faster bootstrapping (the perf gain is objectively measurable).
> >
> > You give this method a list of classes that are always required, and it
> > computes all the required parents/interfaces/traits they use, by using
> > reflection of course. It turns namespace to the bracketed syntax, orderd
> > things as required (parents first), and dumps everything in one php file.
> >
> > The issue came to our tracker that this process was broken once one
> wanted
> > to inline a strict class there, either directly or indirectly through the
> > parent chain.
> >
>
> Again, there is not such thing as a strict class. You should be stripping
> ALL declare(strict_types=0/1) from the class files, and even if enabled it
> at the top of final generated file it wouldn't make any difference _unless_
> you're calling the classes IN the generated file. Anything you include it
> into will decide for itself whether it is strict or not.
>

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

Reply via email to