Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:80567 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 27365 invoked from network); 15 Jan 2015 16:39:35 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Jan 2015 16:39:35 -0000 Authentication-Results: pb1.pair.com header.from=php@beccati.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=php@beccati.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain beccati.com designates 176.9.114.167 as permitted sender) X-PHP-List-Original-Sender: php@beccati.com X-Host-Fingerprint: 176.9.114.167 spritz.beccati.com Received: from [176.9.114.167] ([176.9.114.167:35543] helo=mail.beccati.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 54/B4-14306-54DE7B45 for ; Thu, 15 Jan 2015 11:39:34 -0500 Received: (qmail 4683 invoked from network); 15 Jan 2015 16:39:29 -0000 Received: from home.beccati.com (HELO ?192.168.1.202?) (88.149.176.119) by mail.beccati.com with SMTP; 15 Jan 2015 16:39:29 -0000 Message-ID: <54B7ED3A.6090805@beccati.com> Date: Thu, 15 Jan 2015 17:39:22 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Levi Morrison , internals References: In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC] Remove PHP 4 Constructors From: php@beccati.com (Matteo Beccati) Hi everyone, > I am proposing an RFC[1] to remove PHP 4 constructors in PHP 7. If > accepted, methods with the same name as their defining class will no > longer be recognized as constructors. As noted in the RFC, there are > already many situations where we do not recognize these methods as > constructors, such as in namespaces and traits and when `function > __construct` is also present. > > Andrea Faulds has kindly written a utility that identifies when a PHP > 4 constructor is defined[2]. It does not automatically change the code > for liability reasons. The utility PHPMD[3] can also detect this but > has a false positive when `__construct` is also defined. I still think this (and other) BC breaks should be avoided if we want to maximize PHP7 adoption, but I've started working on this: https://github.com/FriendsOfPHP/PHP-CS-Fixer/pull/970 which is a patch to php-cs-fixer that would be helpful to ease my (and other's) pain in case the RFC passes. I've tried using Andrea's own work and nikita's php-parser and good results quickly, but ended up switching due to the lack of whitespace support. Cheers -- Matteo Beccati Development & Consulting - http://www.beccati.com/