Re: Return type hinting patch

From: Date: Fri, 25 Apr 2008 17:06:18 +0000
Subject: Re: Return type hinting patch
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-37223@lists.php.net to get a copy of this message
Hi! In general, it'd be very nice to have some definition of the proposed feature beyond the patch. It would probably answer some of my questions that follow :)
parameters and return values. Objects with __toString methods are allowed to pass for scalar and string type hints.
What about objects that can be converted to other types (cast_object handler)?
function myTypedFunction returns int(string $stuff, bool, $things, num $amount) { return 'This will cause an error.' }
What about return "1"? Also I notice it introduces new keyword - returns. Is it necessary? Each new keyword means broken code.
Parameters and return values are strict. Int means int (to the type),
Meaning that int would reject 1.0, true and "1"? bool would reject 1 and 0 and null? Ouch, ouch, ouch. -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com

« previous php.internals (#37223) next »