Re: [RFC]

From: Date: Wed, 12 Feb 2020 22:01:05 +0000
Subject: Re: [RFC]
References: 1 2 3 4 5 6 7 8 9  Groups: php.internals 
Request: Send a blank email to internals+get-108522@lists.php.net to get a copy of this message
On 12/02/2020 21:47, Manuel Canga wrote:
You is importing function and you are  using different. It is the same case like: namespace MyProject; use Vendor/Controller; class Controller extends Controller { }
In that example, you're defining two things of the same type with the same name, which would be an error; that's not what was happening in my example. In a call like Acme\Global\I18N::translate, or a callable like ['Acme\Global\I18N', 'translate'], the "translate" part never refers to a function in the current namespace, or indeed any namespace, only to a method of that particular class. But if you write ['Acme\Global\I18N', translate::function], there's no way for the engine to know that you wanted a method name rather than a function name, so it will try to resolve it in the current namespace and import list. That will either give an error, because there is no function called translate; or it will give you a fully-qualified name, which isn't what you wanted, you just wanted the string 'translate'. Regards, -- Rowan Tommins (né Collins) [IMSoP]

« previous php.internals (#108522) next »