In the topic https://review.typo3.org/#/q/topic:use-class-constant I change (almost) all places where a class name is given with a string literal to use \Actual\Class\Name::class
instead. I’ll follow the currently pushed changes with adjustments to the documentation and the packages that make up Neos (right now only the Flow packages have been adjusted).
I want to point out why this makes sense, so it hopefully becomes best practice:
- auto-completion in your IDE
- detection of errors in your IDE (misspelling, undefined class)
- shorter names through use of
use
are possible - when refactoring, it’s clear a class is referenced
It would be nice if everyone adjusted to this and patches for Flow > 3.0 and Neos > 2.0 (because that constant has been added in PHP 5.5) would use that in the future…