php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #48246 Allow the new statement to be a value.
Submitted: 2009-05-12 14:53 UTC Modified: 2010-11-23 10:33 UTC
From: mathieu dot suen at easyflirt dot com Assigned:
Status: Duplicate Package: *General Issues
PHP Version: 5.2.9 OS: not relevant
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: mathieu dot suen at easyflirt dot com
New email:
PHP Version: OS:

 

 [2009-05-12 14:53 UTC] mathieu dot suen at easyflirt dot com
Description:
------------
The new statement can only be use insid a assignement statement.
ex: $a = new A();

It would be better to also allow it in other statement like the invokation:

(new A())->foo()

In other word "new A()" should be a valuable statement.



Reproduce code:
---------------
(new A())->foo()

Expected result:
----------------
The method foo() is invoked on the newlly created object

Actual result:
--------------
Compilation error

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-11-23 10:33 UTC] aharvey@php.net
-Status: Open +Status: Duplicate -Package: Feature/Change Request +Package: *General Issues
 [2010-11-23 10:33 UTC] aharvey@php.net
Duplicate of request #34502.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 06:01:30 2024 UTC