I'm using @lends + @constructs + @augments for MooTools Class definitions (custom namespace variation), however I'm getting some inspection issues in PhpStorm in extending classes if I don't include an initialize in the extending class with a @constructs above it. Is it not possible in jsDoc to omit initialize in extending classes OR is PhpStorm inspection just not working correctly?
new Class('Validator.Generic',
/**
* @lends Validator.Generic
*/
{
/**
* @constructs
*/
initialize:function(){}
}
new Class('Validator.Regex',
/**
* @augments Validator.Generic
* @lends Validator.Regex
*/
{
//PhpStorm inspection reports unrecognized symbol Regex unless
//I add a method with @constructs here, even though the class
//it augments has a constructor
});
I've tried variations as well. It only works if I add an initialize to the extending class (e.g. Validator.Regex) along with a @constructs tag to the docblock. This of course is not ideal.
@lena's answer partially works, but was still arbitrarily failing inspection in seemingly identical situations. I changed my approach and thought about the literal meanings of the tag names. Conclusion: '@class' is to define a type (pseudo statically), '@augments' and '@lends' in the context of a prototype based languages should then imply Instance extensions. This is intuitive in hind sight. All inspections now pass with the following syntax.
/**
* @class Validator.Regex
* @augments {Validator.Generic}
*/
new Class('Validator.Regex',
/**
* @lends {Validator.Regex}
*/
{}
);