Req #63264 [NEW]: Type hinting in list()
| From: | michaelrfairhurst at gmail dot com | Date: | Thu, 11 Oct 2012 19:58:10 +0000 |
| Subject: | Req #63264 [NEW]: Type hinting in list() | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-174032@lists.php.net to get a copy of this message | ||
From: michaelrfairhurst at gmail dot com
Operating system: CentOs 6
PHP version: 5.3.17
Package: Arrays related
Bug Type: Feature/Change Request
Bug description:Type hinting in list()
Description:
------------
Since list is a language construct, it would be great if it had type
hinting.
list(ContractPrice $price, Adjustment $adj) = $deps;
truth be told I got this whim from PHPUnit, where I like having type
hinting on
my @dependent tests -- example is based on that.
Test script:
---------------
/**
* @depends testReturns_ContractPrice
*/
function testReturnsArray(ContractPrice $price) {
$adjustment = new Adjustment;
$this->assertEquals('stuff', $price->stuff($adjustment));
return array($price, $adjustment);
}
/**
*@depends testReturns_Array
*/
function testTypeHintingLists(array $deps) {
list(ContractPrice $price, Adjustment $adjustment) = $deps;
}
--
Edit bug report at https://bugs.php.net/bug.php?id=63264&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=63264&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=63264&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=63264&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=63264&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=63264&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=63264&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=63264&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=63264&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=63264&r=support
Expected behavior: https://bugs.php.net/fix.php?id=63264&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=63264&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=63264&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=63264&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63264&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=63264&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=63264&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=63264&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=63264&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=63264&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=63264&r=mysqlcfg