contracts • IDE: navigation, autocomplete, ref actoring, etc. • Static analysis: find more bugs. • JIT and AOT: more optimization space. • Meta: more inf o f or API/schema/code gen.
navigation, autocomplete, ref actoring, etc. • Static analysis: find more bugs. • JIT and AOT: more optimization space. • Meta: more inf o f or API/schema/code gen. (As long as reflection is enough f or you.)
need them or at least “generic arrays”. • Get noticeable community support. • Work on the v2 proposal f or generics. • Convince PHP devs that this f eature is needed. • Find people who will implement generics.
we need to inf er it from expressions. It’s not always possible to get a precise result, since we almost always loose at least some types inf o along the way. Type can also depend on the run-time inf ormation that we don’t have.
we need to inf er it from expressions. It’s not always possible to get a precise result, since we almost always loose at least some types inf o along the way. Type can also depend on the run-time inf ormation that we don’t have. Trying to guess types
= $xs[$i]; // $x:int // In reality, if $i key is not in $xs, // $x will be null, so the exact type // if more like ?int, but most // programs perform optimistic inference, // where we omit some details...
PhpStorm when we’re talking about types. You don’t want to resolve less types, but it’s not always desirable to resolve more. This is especially true with global types inf erence.
expression type might depend on very distant parts of a program. Seemingly irrelevant code changes can cause a lot of changes in types inf erence results.
from each other (diff erent parts of a pro ject). • Pro jects can be too large to keep them in memory (several GB). • We don’t want to make extra “passes” over the source code (too slow). • We also don’t want to re-calculate all types when one file is changed.
ject, record symbols inf o and lazy types. • Second pass: do the analysis itself. When type inf o is needed, it’s “solved” on demand. Only files that are currently being analyzed are loaded into the memory.