Re: Assign return value of function to property or replace parse error with nice fatal error

From: Date: Mon, 11 Jul 2016 19:56:10 +0000
Subject: Re: Assign return value of function to property or replace parse error with nice fatal error
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-94476@lists.php.net to get a copy of this message
On Mon, Jul 11, 2016 at 9:39 PM, Khawer . <khaweronline@gmail.com> wrote: > It would be better if we can assign return value of function to property. > > If not at least we should generate a nice error message. > > Currently when we try to assign return value of function to property we get > the following error: > Parse error: syntax error, unexpected '(', expecting ',' or ';' > in > index.php on line 4 > > We should replace this error with the following error: > Fatal error: You must assign a static value to property in index.php on > line 4. > OR > Fatal error: Dynamic values cannot be assigned to property in index.php on > line 4. > Since PHP 7 the error message is: Fatal error: Constant expression contains invalid operations Nikita

« previous php.internals (#94476) next »