Req #70236 [Com]: $->var as syntactic sugar for $this->var

From: Date: Mon, 19 Oct 2015 22:20:43 +0000
Subject: Req #70236 [Com]: $->var as syntactic sugar for $this->var
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-196691@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=70236&edit=1 ID: 70236 Comment by: rahi at atsspec dot co Reported by: z4k4ri4 at gmail dot com Summary: $->var as syntactic sugar for $this->var Status: Open Type: Feature/Change Request Package: Scripting Engine problem Operating System: All PHP Version: 7.0.0beta3 Block user comment: N Private report: N New Comment: No offense but I think this is a silly idea. If you have that many $this->something that it's distracting, then you need to take another look at the code. Maybe have a method that sets the class properties based on an array keyed by the class property names (for example). For 'setter' type methods you can 'return $this' (fluent interface) to make your code less verbose. Previous Comments: ------------------------------------------------------------------------ [2015-08-26 11:33:30] matt at re-gister dot com I would appreciate this ------------------------------------------------------------------------ [2015-08-11 08:18:07] z4k4ri4 at gmail dot com Description: ------------ In a everyday PHP OOP coding, $this->var or $this->method() is so common and verbose, it becomes a distraction for code reading. I request that PHP add short form of $->var or $->method() as an alias for $this->var and $this->method(). ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=70236&edit=1

« previous php.bugs (#196691) next »