Java Code Examples for com.jetbrains.php.lang.documentation.phpdoc.psi.tags.PhpDocTag#getTagValue()
The following examples show how to use
com.jetbrains.php.lang.documentation.phpdoc.psi.tags.PhpDocTag#getTagValue() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PhpElementsUtil.java From idea-php-annotation-plugin with MIT License | 6 votes |
@Nullable public static String getClassDeprecatedMessage(@NotNull PhpClass phpClass) { if (phpClass.isDeprecated()) { PhpDocComment docComment = phpClass.getDocComment(); if (docComment != null) { for (PhpDocTag deprecatedTag : docComment.getTagElementsByName("@deprecated")) { String tagValue = deprecatedTag.getTagValue(); if (StringUtils.isNotBlank(tagValue)) { return StringUtils.abbreviate("Deprecated: " + tagValue, 100); } } } } return null; }
Example 2
Source File: GenericsUtil.java From idea-php-generics-plugin with MIT License | 5 votes |
public static boolean isGenericsClass(@NotNull PhpClass phpClass) { PhpDocComment phpDocComment = phpClass.getDocComment(); if(phpDocComment != null) { // "@template T" // "@psalm-template Foo" for (PhpDocTag phpDocTag : getTagElementsByNameForAllFrameworks(phpDocComment, "template")) { String tagValue = phpDocTag.getTagValue(); if (StringUtils.isNotBlank(tagValue) && tagValue.matches("\\w+")) { return true; } } } return false; }
Example 3
Source File: TemplateAnnotationIndex.java From idea-php-generics-plugin with MIT License | 5 votes |
private void visitPhpClass(@NotNull PhpClass phpClass) { String fqn = phpClass.getFQN(); if(!fqn.startsWith("\\")) { fqn = "\\" + fqn; } PhpDocComment phpDocComment = phpClass.getDocComment(); if (phpDocComment != null) { Map<String, String> useImportMap = null; for (PhpDocTag phpDocTag : GenericsUtil.getTagElementsByNameForAllFrameworks(phpDocComment, "extends")) { String tagValue = phpDocTag.getTagValue(); Matcher matcher = CLASS_EXTENDS_MATCHER.matcher(tagValue); if (!matcher.find()) { continue; } String extendsClass = matcher.group(1); String type = matcher.group(2); // init the imports scope; to be only loaded once if (useImportMap == null) { useImportMap = AnnotationUtil.getUseImportMap(phpDocComment); } // resolve the class name based on the scope of namespace and use statement // eg: "@template BarAlias\MyContainer<Bar\Foobar>" we need global namespaces starting with "\" extendsClass = GenericsUtil.getFqnClassNameFromScope(fqn, extendsClass, useImportMap); type = GenericsUtil.getFqnClassNameFromScope(fqn, type, useImportMap); map.put(fqn, new TemplateAnnotationUsage( fqn, TemplateAnnotationUsage.Type.EXTENDS, 0, extendsClass + "::" + type )); } } }
Example 4
Source File: TemplateAnnotationIndex.java From idea-php-generics-plugin with MIT License | 5 votes |
/** * Extract the "T" * * "T" * "T as object" */ @Nullable private static String extractTemplateName(@NotNull PhpDocTag phpDocTag) { String templateTagValue = phpDocTag.getTagValue(); if (StringUtils.isBlank(templateTagValue)) { return null; } return extractTemplateName(templateTagValue); }