Am 04.08.2025 um 17:23 schrieb Larry Garfield <[email protected]>:
> Hi folks. I recently wrote a blog post on behalf of the PHP Foundation about
> some work Gina has been doing regarding generics. It's a follow-up to last
> year's post on a similar topic. We are especially looking for feedback from
> the Internals crew, and voters in particular, on whether or not to proceed.
>
> https://thephp.foundation/blog/2025/08/05/compile-generics/
To be up-front: I am not the target demographic for this feature, being an OO
and Type minimalist ;-)
One little thing I noted in the side-note about type inference
https://thephp.foundation/blog/2025/08/05/compile-generics/#type-inference
was the part
> function add(int $x, int $y)
> {
> return $x + $y;
> }
>
> It's readily obvious that the return type of that function is int, ...
Now this is nit-picking but that's not true for PHP in general, if I give it
the values PHP_INT_MAX and 1 the result will be float, not int.
It has little to do with the topic of the whole post but I still felt the urge
to point it out. But please do not get into a discussion about automatic type
conversions here because of that, it is just a reminder that type inference has
some edge cases ;-)
Regards,
- Chris