Re: Allow dropping typehints during inheritance
| From: | Andrea Faulds | Date: | Sat, 14 Feb 2015 02:22:23 +0000 |
| Subject: | Re: Allow dropping typehints during inheritance | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-82659@lists.php.net to get a copy of this message | ||
Hi,
I’m coming back to this thread after some discussions about related matters off-list. I’m firmly
convinced this is a good idea, now:
* It would be very useful to extend the callable type hint to support typed parameters and return
types. If we were to do so, its validation rules should follow inheritance’s. It would be really
unfortunate if you couldn’t pass an untyped callback to a callable with typed parameters.
* With the Scalar Type Hints RFCs, and other future RFCs, more type hints may be added to the
language. It’d be a shame if existing interfaces couldn’t have type hints added to them.
* Contravariance is widely accepted as being sound for parameter types.
* We already have covariance for return type existence. So why not contravariance for parameter type
existence?
I hope we can have this added.
--
Andrea Faulds
http://ajf.me/