Get the latest tech news
PHP compile time generics: yay or nay?
The PHP Foundation — Supporting, Advancing, and Developing the PHP Language
Arnaud and Larry Garfield did further investigation afterward into introducing a "module" system that would help PHP's compiler see more code at once, and thus be able to do type inference more readily, but sadly that also ran into many challenging edge cases. Initially, it was intended as an alternative to the never parameters RFC, offering a better solution to the case of an interface that doesn't need to specify a particular type, but implementing classes do. As noted above, though, typing against a generic that is part of a union, like public function setRepository(Repository<UserEntity>|null $repo) {}, is probably possible in a follow-up RFC.
Or read this on Hacker News