Re: Type hints with null default values

From: Date: Wed, 20 Oct 2004 00:57:30 +0000
Subject: Re: Type hints with null default values
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-13410@lists.php.net to get a copy of this message
Robert Silva wrote:
Function Equals([ZObject] $objA, [ZObject] $objB) {}
To me, it would be more readable and more closely match the traditional documentation format people are used to if the [] encase the whole parameter as in: function Equals([ZObject $objA[, ZObject $objB]]) Adding this in would be pretty simple, it would mean changes to zend_language_parser.y along these lines: from: parameter_list: non_empty_parameter_list | /* empty */ ; to (minus the engine stuff): parameter_list: non_empty_parameter_list | non_empty_parameter_list optional_parameter_list | /* empty */ ; optional_parameter_list: '[' T_STRING T_VARIABLE ']' | '[' T_STRING T_VARIABLE optional_parameter_list_comma ']' ; optional_parameter_list_comma: '[' ',' T_STRING T_VARIABLE ']' | '[' ',' T_STRING T_VARIABLE optional_parameter_list_comma ']' ; Greg

« previous php.internals (#13410) next »