Edit report at https://bugs.php.net/bug.php?id=69934&edit=1
ID: 69934
Updated by: [email protected]
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.