Re: AW: [PHP-DEV] Importing namespaced functions
| From: | Pascal Chevrel | Date: | Wed, 24 Apr 2013 09:16:46 +0000 |
| Subject: | Re: AW: [PHP-DEV] Importing namespaced functions | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.internals php.internals |
| Request: | Send a blank email to internals+get-67122@lists.php.net to get a copy of this message | ||
Le 24/04/2013 08:15, Martin Keckeis a écrit :
Hello together, if you got a namespace with more than one functions, why not just create a container class and make the methods static? I know it's not exactly the same, but how many times you need this.... So you can write: namespace Abc\Def; class Something{Hi, I already had the need to override an existing function, specifically the _() gettext calls with my own code. In a python project I work on, we partly use gettext technology, we use it for string extraction from templates, but we don't use gettext for string display. In PHP, AFAIK, I can't do that, I can't tell the code that in context A the call uses gettext and in context B, the call uses a different localization backend with the same function call. I know it's probably not a common case, but in PHP I don't have a workaround (that I know of). Note that I don't know if it would be good for the language to have this possibility, I just know that it would be good for me :) Regards, Pascalpublic static function blubb();public static function blubb2();} use Abc\Def\Something; Something::blubb(); Something::blubb2(); Best regards Martin