News for hackers. Stuff that matters.
Re:Upcoming changes in PHP 7.1 by naranha on Monday May 23, 2016 @07:30AM (#11753141)
I disagree. I think that this type of "late type binding" is actually an advantage of dynamically typed languages. That way it does not matter if you pass a map/array/dictionary or an instance of a class as long as the properties are the same.
Re:Upcoming changes in PHP 7.1 by chrisseaton on Monday May 23, 2016 @07:41AM (#11753190)
I think one problem is when your object quacks like a duck, but the quack doesn't mean what you think it means.

Having methods that just have the right names is a pretty weak assurance, isn't it?

Re:Upcoming changes in PHP 7.1 by spdionis on Monday May 23, 2016 @09:06AM (#11753573)
"Fail Fast" is a pretty popular best-practice and failing immediately on a mismatched type hint is in line with that.
Re:Upcoming changes in PHP 7.1 by zodiac on Monday May 23, 2016 @07:48AM (#11753219)
The type hinting is optional, so if you want "late type binding" you can just omit the type hints.
Re:Upcoming changes in PHP 7.1 by vertex-four on Monday May 23, 2016 @10:48AM (#11754175)
Then... don't specify that you want a specific type?