RE: [PHP-DEV] Type hints with null default values
| From: | Cristiano Duarte | Date: | Wed, 27 Oct 2004 00:21:03 +0000 |
| Subject: | RE: [PHP-DEV] Type hints with null default values | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-13549@lists.php.net to get a copy of this message | ||
So reading all posts on this subject, the proposal would be:
1) Allow null typehints
public function Compare([BaseClass] $objA, $cmpFunc);
Ex: Compare(null, 'func1');
2) Don't allow null typehints
public function Compare(BaseClass $objA, $cmpFunc);
Ex: Compare(new BaseClass(), 'func1');
3) Optional argument (with typehint)
public function Compare($cmpFunc, BaseClass $objA=null);
Ex: Compare('func1');
Am I right ? Is it possible to implement all three syntaxes ?
IMH it would satisfy everybody's needs.
Regards,
Cristiano Duarte