Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:79294 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 89916 invoked from network); 28 Nov 2014 20:50:43 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Nov 2014 20:50:43 -0000 Authentication-Results: pb1.pair.com smtp.mail=dev@mabe.berlin; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=dev@mabe.berlin; sender-id=unknown Received-SPF: error (pb1.pair.com: domain mabe.berlin from 80.237.132.167 cause and error) X-PHP-List-Original-Sender: dev@mabe.berlin X-Host-Fingerprint: 80.237.132.167 wp160.webpack.hosteurope.de Received: from [80.237.132.167] ([80.237.132.167:50049] helo=wp160.webpack.hosteurope.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5D/84-59154-120E8745 for ; Fri, 28 Nov 2014 15:50:42 -0500 Received: from dslb-178-000-146-220.178.000.pools.vodafone-ip.de ([178.0.146.220] helo=[192.168.178.30]); authenticated by wp160.webpack.hosteurope.de running ExIM with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) id 1XuSUx-0002mZ-0k; Fri, 28 Nov 2014 21:50:39 +0100 Message-ID: <5478E01E.2070001@mabe.berlin> Date: Fri, 28 Nov 2014 21:50:38 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: internals@lists.php.net References: In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-bounce-key: webpack.hosteurope.de;dev@mabe.berlin;1417207842;7594f231; Subject: Re: [PHP-DEV] Static functions Vs Nonstatic functions From: dev@mabe.berlin (Marc Bennewitz) Please read : http://grokbase.com/t/php/php-internals/14acs23cpe/disallow-non-static-method-calls-with-self-static-in-php-7#20141026ct1np9k82bte2m9k9rtmq1c2jr Am 28.11.2014 um 20:29 schrieb Carlos Rodrigues: > PHP has evolved a lot in recent years but we still can't have a static and > a nonstatic function with the same name: > > class A { > function bla() { echo 'normal'; } > static function bla() { echo 'static'; } > } > > A::bla(); > > ## ERROR: Cannot redeclare A::bla() > > And also PHP supports calling static functions as if they were not static: > > class B { > static function bla() { echo 'how come it works'; } > } > > $object = new B; > $object->bla(); > > > It confuses programmers that came from other languages, prevent APIs from > having meaningful names on static methods and have no other benefit than > supporting PHP 4 code. > > I'd appreciate if anyone with sufficient knowledge/influence helped me > suggest this change to the maintainers. > > IMHO, static and nonstatic functions should be "stored" in different > places. And if someone relies on this, one should use magic methods __call > and __callStatic instead. > > > Thanks for your time and patience, > > > Carlos Rodrigues > carlos@jp7.com.br >