Re: Type hints with null default values
| From: | Andi Gutmans | Date: | Wed, 27 Oct 2004 16:50:30 +0000 |
| Subject: | Re: Type hints with null default values | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-13566@lists.php.net to get a copy of this message | ||
At 10:53 AM 10/27/2004 +0200, Christian Schneider wrote:
Marcus Boerger wrote:Yeah I tend to agree. Adding [] for a not that popular case seems not to be worth it. It just adds more complexity to the syntax. I suggest to either leave as is or to support default values of NULL (only) and if that is given then you may also pass NULL (give it a double meaning). AndiSo for now the only addition we may probably consider for 5.1 is adding 4: optional typehinted values that default to null and only null.Please don't add another parameter syntax (especially with line-noi... err special characters) like [BaseClass]. This would make PHP more unreadable than it needs to be for a minor feature. To allow foo(BaseClass $objA = null) to also accept foo(null); handles the few cases where you want to pass null nicely IMHO. Advocating to only change the PHP syntax to simplify it,