Hello!

As a user land developer I do think that over thinking this is going to end
up in disaster.
We already have quite good implementation for the array and object hints,
they do their job and do it good. No need to change those at all - leave
them as is - no need to add magic with casts and all that. Function/method
requires an array? Make casts explicitly and pass it an array and not an
integer.

Primitive type hints are a little different - they are easily cast into
each other for the most part. The only edge case is when we loose data. In
this case we need a E_STRICT or something like that (I would vote for
E_TYPEHINT_CAST - because you will be able to disable only typehint
warnings/errors without disabling E_STRICT), so we can collect these errors
and fix our code by adding checks/casts/whatever. But this automatic
casting should work only between string, integer, float, bool and null
types and only between these. No automatic casting of these 5 to arrays or
objects.

PHP does not need a type hinting system forces you to first make a
prototype without any type hints because you get catchable errors - you can
handle them, but you can't actually just continue right where the error
occurred. You just need to get a warning, that you can disable via
error_reporting, and just make your prototype with all the type hints you
need and deal with the cast warnings in the type hints later on.

P.S. And on that "var integer $variable" in methods/functions. People, when
you have internal functions returning null|array, bool|array and so on -
this is pointless.

Reply via email to