On 24/06/2018 21:31, Rudi Theunissen wrote:
So with that in mind, maybe it's okay to take "NULL falls back to default behaviour" idea out, and do a normalisation on whatever the user returns. If it's NULL, then that'll be 0, and the value will be equal. The only thing I don't like about that is that the user didn't specify "equal" with a 0, they returned the absence of a direction, and we should therefore either throw an exception internally, or fall back to the current comparison behaviour (comparing properties).
Since this is a method, and not just a callback passed somewhere, could we simply mandate that the signature has an "int" return type?
That way, if the class is written with strict_types=1, it will throw a TypeError for null, and the user will have a big hint that that's going to happen when they write ": int".
Regards, -- Rowan Collins [IMSoP] -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php