Continuing the discussion from Using the ::class constant instead of string literals:
@bwaidelich brought this up right after I pushed those changes:
I think it increases readability dramatically… and at no real expense (it’s just syntactic sugar). If there are cases where it’s ambiguous (e.g.
Context) I’d suggest to rename the class (if viable) or at least alias the import (
Context as SecurityContext)
Yes, I’d love to import, but to keep the change “small” and easier to review I did not import in the change introducing the
::CLASS constant. And there is already a bunch of changes by Rens shortening names; this could probably refreshed.
We just need to find a common guideline for when to import. For a single occurrence? Three? Always, because IDEs can do that?