Bug #73853 [Nab]: Aliasing a method still throws errors about static / non-static

From: Date: Wed, 11 Jan 2017 20:53:41 +0000
Subject: Bug #73853 [Nab]: Aliasing a method still throws errors about static / non-static
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-206540@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73853&edit=1 ID: 73853 Updated by: nikic@php.net Reported by: bowersbros at gmail dot com Summary: Aliasing a method still throws errors about static / non-static Status: Not a bug Type: Bug Package: Scripting Engine problem Operating System: Irrelevant PHP Version: Irrelevant Block user comment: N Private report: N New Comment: To expand on Joe's comment, the problem is that aliasing in trait resolution is just that: Aliasing. If you alias something, both the old *and* the new name are present. It's stupid behavior IMHO, but this is how it works. See https://3v4l.org/jcoA9. Previous Comments: ------------------------------------------------------------------------ [2017-01-11 05:03:49] krakjoe@php.net There are mistakes or incorrect assumptions in your code. ------------------------------------------------------------------------ [2017-01-02 21:54:45] bowersbros at gmail dot com Description: ------------ A method that is declared as static, and has a trait override the method that is non-static, but is aliased, a fatal error is still thrown, even though it is aliased. Example: https://3v4l.org/Ig0Al Test script: --------------- <?php trait MyTest { public function name() { return 'other string'; } } abstract class Testing { public static function name() { return 'string'; } } class AnotherExample extends Testing { use MyTest { MyTest::name as newName; } } ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=73853&edit=1

« previous php.bugs (#206540) next »