El mié., 12 feb. 2020 22:36, Rowan Tommins <rowan.coll...@gmail.com>
escribió:

> On 11/02/2020 15:13, Manuel Canga wrote:
> > One case which string can be useful but a callable would not be
> acceptable is:
> >
> > array_map([I18N::class, translate::function] );
>
>
> I wouldn't expect that to work anyway, because the whole purpose of the
> keyword would be to resolve "translate" as a function name, not a method
> name, e.g.
>
> use Acme\Global\I18N;
> use function Acme\Global\translate;
>
> var_dump([I18N::class, translate::function]);
>
> # array(0 => 'Acme\Global\I18N', 1 => 'Acme\Global\translate')
> # not a valid callable
>
> var_dump([I18N::class, 'translate']);
>
> # array(0 => 'Acme\Global\I18N', 1 => 'translate');
> # this was what was intended
>
>
> If you didn't want to quote the method, you'd need some other syntax
> that took both class and method name, like:
>
> [I18N, translate]::callable
>
> Or as proposed elsewhere in the thread:
>
> $(I18N::translate)
>
>
> Regards,
>

Hi,

You is importing function and you are  using different. It is the same case
like:

namespace MyProject;

use Vendor/Controller;

class Controller extends Controller {
}





>

Reply via email to