Re: What do we need strict scalar type hints for?
Hi!
> We are talking about adding support for scalars (string, integer, ...)
> to the list of optional type declarations already supported (array,
> callable, interface name, class name) by PHP. When a developer chooses
> to use a scalar type in the signature of a function or method then it
> should be enforced as strictly as the already supported types. It should
> be up the caller to perform explicit type casting when required.
That is contrary to the nature of PHP as it has been a weakly typed
language for 20 years. I think it would be a big mistake to change one
of the basic concepts of the language, that has worked pretty well
judging from it adoption. Especially given that all internal functions
do not and will not work this way. Unless you propose make internal
functions work this way too, in which case it'd be much better to change
the name of the project, because there won't be much left that connects
it to prior PHP and you can pretty much forget about BC.
--
Stas Malyshev
[email protected]
Thread (78 messages)