TysonAndre / phan

Phan is a static analyzer for PHP. Phan prefers to avoid false-positives and attempts to prove incorrectness rather than correctness.
Other
0 stars 0 forks source link

Add a way to annotate union types? (semantically, things like `tag:array-key=>int`, `tag:array-key=>string`) #66

Closed TysonAndre closed 6 years ago

TysonAndre commented 7 years ago

It would be nice to have a way to add short-lived tag information within a function, optionally addable via phpdoc (param/return)

add tag:array-key=>int, tag:array-key=>string, but with a more efficient representation (bit flag?) If exactly one of these is seen, then assume the array key is an int, and make that affect foreach, key, array_keys

Other possibilities would be tag:array-shape => [0 => 'T1', 1 => 'int'] (can't be bit flag)

TysonAndre commented 6 years ago

Array keys and array shapes are part of the type system now, not as a separate annotation