@rightcapital/phpdoc-parser
Version:
TypeScript version of PHPDoc parser with support for intersection types and generics
28 lines (27 loc) • 1.28 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.MethodTagValueNode = void 0;
const php_doc_tag_value_node_1 = require("./php-doc-tag-value-node");
class MethodTagValueNode extends php_doc_tag_value_node_1.PhpDocTagValueNode {
constructor(isStatic, returnType, methodName, parameters, description, templateTypes) {
super();
this.isStatic = isStatic;
this.returnType = returnType;
this.methodName = methodName;
this.parameters = parameters;
this.description = description;
this.templateTypes = templateTypes;
}
toString() {
const staticKeyword = this.isStatic ? 'static ' : '';
const returnTypeStr = this.returnType !== null ? `${this.returnType.toString()} ` : '';
const parametersStr = this.parameters.join(', ');
const descriptionStr = this.description !== '' ? ` ${this.description}` : '';
const templateTypesStr = this.templateTypes.length > 0 ? `<${this.templateTypes.join(', ')}>` : '';
return `${staticKeyword}${returnTypeStr}${this.methodName}${templateTypesStr}(${parametersStr})${descriptionStr}`;
}
getNodeType() {
return 'MethodTagValueNode';
}
}
exports.MethodTagValueNode = MethodTagValueNode;