Hi Pierre,

Having type-inference wouldn't transparently fix some of these issues ?
>
> Let's consider a method such as foo($array) which returns a bool or a
> string, for example. And suddenly, the types get specified as foo(?array
> $array): bool|string.
>

PHP doesn't have such an advanced type inference capability: just consider
dynamic calls, or regular function invocations
where the return type information is not available.

On the other hand, we could add return types implicitly, as it was proposed
earlier, but I didn't really like this solution.
For a little more details, have a look at my initial message:
https://externals.io/message/112625#112625 Besides, I think
it's better to document the return types explicitly as a declaration, since
they usually help during implementation.

Máté

Reply via email to