Req #69934 [Opn->Csd]: Allow initialize classes as statement or array

From: Date: Fri, 26 Jun 2015 08:16:16 +0000
Subject: Req #69934 [Opn->Csd]: Allow initialize classes as statement or array
References: 1  Groups: php.standards 
Request: Send a blank email to standards-+get-810@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=69934&edit=1 ID: 69934 Updated by: kalle@php.net Reported by: david dot proweb at gmail dot com Summary: Allow initialize classes as statement or array -Status: Open +Status: Closed Type: Feature/Change Request Package: PHP Language Specification PHP Version: 7.0.0alpha2 -Assigned To: +Assigned To: kalle Block user comment: N Private report: N New Comment: Hi I think you might be interested in the following RFCs: https://wiki.php.net/rfc/automatic_property_initialization https://wiki.php.net/rfc/constructor-promotion Although these RFCs target property initialization in the constructor, not when called. I highly suggest you either write an RFC or subscribe to internals and start a thread for some debate. I'm gonna close this ticket, because such features are done via RFCs only nowadays. Also note, this is too late for 7.0, so you will have to target 7.1 :) Previous Comments: ------------------------------------------------------------------------ [2015-06-25 20:36:54] david dot proweb at gmail dot com Description: ------------ I think that it is possible in Java and C#, something like it: return new PartialConsumed($constructorArgs) [ $propertyOfPartialConsumedA => $valueA, $propertyOfPartialConsumedB => $valueB, ]; It will replace: $temp = new PartialConsumed($constructorArgs); $temp->propertyOfPartialConsumedA = $valueA; $temp->propertyOfPartialConsumedB = $valueB; return $temp; ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=69934&edit=1

« previous php.standards (#810) next »