jj101k / php-lint

Lints PHP files (via Node)
BSD 2-Clause "Simplified" License
2 stars 0 forks source link

Add basic support for generic type expressions #44

Open jj101k opened 6 years ago

jj101k commented 6 years ago

This would allow patterns like function($x) {return $x;} to be recognised as <T> (T) -> T rather than (mixed) -> mixed.

A possible approach to this may be to track the origin of a "mixed" expression and, where its origin is the current called entity, infer the return type from the appropriate arg; however it'll be better to actually express it as a generic type so that the call types can produce a synthesised function type and continue that way. Generics for return types are unlikely given the lack of strong typing, but those are considerably less useful in general.

jj101k commented 6 years ago