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]

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to