Edit report at https://bugs.php.net/bug.php?id=62859&edit=1

 ID:                 62859
 Updated by:         ahar...@php.net
 Reported by:        michaelduff2 at yahoo dot com
 Summary:            Give __construct() the respect it deserves
-Status:             Open
+Status:             Wont fix
 Type:               Feature/Change Request
 Package:            *General Issues
 PHP Version:        Irrelevant
 Block user comment: N
 Private report:     N

 New Comment:

Given that you can already implement factories perfectly well via static 
methods, I can't think of any use for this that doesn't end in making code less 
clear.

If you want a discussion, write an RFC and post it to Internals, but I can't 
see this getting up.


Previous Comments:
------------------------------------------------------------------------
[2012-08-18 19:48:01] michaelduff2 at yahoo dot com

Description:
------------
Here's a PHP6 -- or PHP7 ;) request for you; many will scream NOOOOoooooooo, 
but hear me out:

Make it possible to return an object from __construct().

Yeah, I said it. Sounds crazy, but this would make factories more abstract, and 
enables all sorts of magic without user code being any wiser (unless they 
Reflect upon it, I suppose.)

For type safety, the object returned should probably be an instanceof __CLASS__.

If no return() exists, then normal 'new' semantics would apply.

Discuss.



------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=62859&edit=1

Reply via email to