Skip to content
Advertisement

PHPDoc – typehint a variable to see static methods

I have this code:

JavaScript

Is there any way how to typehint in PHPDoc, that variable “$sSomeClass” is a class name, so IDE can see a reference to that class?

Advertisement

Answer

Well…

JavaScript

But I assume $sSomeClass is not a straight assignment like shown? In that case… possibly? IDE wouldn’t be able to determine it, might be able to scope the hints inside curly braces. Will depend on IDE.

JavaScript

I’ll add blocks like that C style comment when coding if struggling to remember methods and then simply remove it afterward.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement