Re: [PHP-DEV] [RFC]

This is only part of a thread. view whole thread
  108502
February 12, 2020 03:56 mike@newclarity.net (Mike Schinkel)
> On Feb 11, 2020, at 6:13 AM, Manuel Canga <manuelcanga@gmail.com> wrote: > > Hi internals, > I Would like to present a possible new "::func resolution" for your > consideration. > > In first place, PHP now support "::class" in this way: > > use My\I18N; > > $mapped_array = array_map([I18N::class, 'translate'], $array); > It avoid add Full I18N namespace in callback. > > However with functions is different: > > use function \My\I18N\i18n_translate; > > $mapped_array = array_map('\My\I18N\i18n_translate', $array); > > What is the useful here of importing the function?. > My proposal is ":func" in order to avoid full namespace in callback of > functions. E.g: > > use function \My\I18N\i18n_translate; > > $mapped_array = array_map(i18n_translate::func, $array); > > "::func" should validate if a function with `` is imported. > In this case, "::func" is replaced with FQN of this function, > otherwise with only ""
I proposed ::function on the list a month ago: - https://externals.io/message/108045#108084 I had started by suggesting ::interface and ::trait: - https://externals.io/message/108045#108069 Marcio Almada suggested that we should use a general ::nameof instead: - https://externals.io/message/108045#108085 -Mike