|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #69934 Allow initialize classes as statement or array
Submitted: 2015-06-25 20:36 UTC Modified: 2015-06-26 08:16 UTC
From: david dot proweb at gmail dot com Assigned: kalle (profile)
Status: Closed Package: PHP Language Specification
PHP Version: 7.0.0alpha2 OS:
Private report: No CVE-ID: None
 [2015-06-25 20:36 UTC] david dot proweb at gmail dot com
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;


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-06-26 08:16 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: kalle
 [2015-06-26 08:16 UTC]

I think you might be interested in the following RFCs:

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 :)
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jul 15 08:01:28 2024 UTC