Re: [RFC] Remove PHP 4 Constructors

From: Date: Thu, 22 Jan 2015 18:01:59 +0000
Subject: Re: [RFC] Remove PHP 4 Constructors
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
"Arvids Godjuks"  wrote in message news:CAL0xaBFDOP0402T06DJLjbmv6CgsS+xcnY69=SZrZts5br5Z8Q@mail.gmail.com...
2015-01-22 15:22 GMT+02:00 Arvids Godjuks <[email protected]>:
2015-01-21 19:21 GMT+02:00 Tony Marston <[email protected]>:
"Kristopher" wrote in message news:CAF9U7z_BLDusnq7c0mVToxyJpqOpa+ [email protected]...
On Wed, Jan 21, 2015 at 9:50 AM, Tony Marston <[email protected]> wrote:
You are totally missing the point. It is the principle of having to spend unknown quantities of time in refactoring my code for nothing more than a frivolous and unnecessary break in BC. It does not fix a bug or a security issue, therefore it is frivolous and unnecessary
Yet you seem to have no problem wasting loads of time arguing about it on the internet.
Because I would rather fight for valid principles than give in. To quote Emiliano Zapata "It is better to die on your feet than live on your knees".
By this time, you could have opened your project/projects in any Regex search and replace capable editor/IDE, wrote a pattern that matches class name with a method name same as class name and replaces it with __construct. Takes about 5-10 minutes for the first project to get it right, ensures forward compatibility since 5.0.0 and saves your employer all those hours that you just spend arguing. Or just write a PHP script that does the same - even easier and faster...
Omg, a folowup. I just found a gem in the docs: "As of PHP 5.3.3, methods with the same name as the last element of a namespaced class name will no longer be treated as constructor. This change doesn't affect non-namespaced classes." Can be read here: http://lv.php.net/manual/en/language.oop5.decon.php So, I think this seals the deal :)
You are missing one important detail. That section only applies if I use namespaces, and - guess what - I DON'T. -- Tony Marston

Thread (115 messages)

« previous php.internals (#80981) next »