I’m posting this to get some initial feedback on this idea before I officially submit an RFC.
Even with PHP’s growing object-oriented and functional programming features, the callback remains widely-used and useful. However, forcing authors to create callbacks via strings and arrays presents difficulties:
- Most IDEs do not recognize callbacks as such, and so cannot offer autocompletion, rename refactoring, and other benefits of code comprehension.
- Authors can misspell identifiers inside strings.
- Within namespaced code, authors can forget to prepend the namespace, since function calls within the namespace do not require it.
usestatements change the identifier for a class, authors can specify the local classname instead of the fully resolved name.