Re: Re: [RFC] Type hints (parameter and return value)
| From: | Arvids Godjuks | Date: | Thu, 17 Apr 2008 12:00:44 +0000 |
| Subject: | Re: Re: [RFC] Type hints (parameter and return value) | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-37058@lists.php.net to get a copy of this message | ||
Christian Schneider
> I don't like the difference between
> function (int) test($value) { ... }
> and
> function test(integer $value) { ... }
First is function return value should be int, second is function arg should
be int.
So full syntax will be like this
function (integer) test(integer $value) { ... }
That means function takes an integer as argument and returns integer value.
If any is violated - Catchable error will be thrown.
That's my understanding of this patch. Some more examples
function (resource) query(string $table, array $where = array(), array
$limit = array()) { ... }
function (array) getData(string $table, array $limit = array(0, 20), array
$where = array()) { /* cals query and generates an array from result */ }
etc.