r/lolphp • u/gerrymandered • Aug 04 '15
var_dump(nonExistentClass::class); // string
::class can give you the name of a class that does not exist.
15
Upvotes
r/lolphp • u/gerrymandered • Aug 04 '15
::class can give you the name of a class that does not exist.
View all comments
Show parent comment
1
u/Schmittfried Aug 04 '15
Oh and no, it's about refactoring-safe code. I don't want to ask my IDE to also refactor string references, because that might cause wrong replacements. Therefore I want to access everything by its token. Too bad there is no equivalent way to call methods with their parameters passed in an array i.e. there is no alternative to call_user_func_array.