Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,6 @@ public static ElementPattern<PsiElement> getTransDomainPattern() {
* {{ path('_profiler_info', {'foobar': 'foobar', '<caret>'}) }}
*/
public static ElementPattern<PsiElement> getPathAfterLeafPattern() {
//noinspection unchecked
return PlatformPatterns
.psiElement(TwigTokenTypes.STRING_TEXT)
.afterLeafSkipping(
Expand Down Expand Up @@ -917,7 +916,7 @@ public static ElementPattern<PsiElement> getTypeCompletionPattern() {
}

public static ElementPattern<PsiComment> getTwigTypeDocBlockPattern() {
Collection<ElementPattern> patterns = new ArrayList<>();
Collection<PsiElementPattern.Capture<PsiElement>> patterns = new ArrayList<>();

for (String s : TwigTypeResolveUtil.DOC_TYPE_PATTERN_SINGLE) {
patterns.add(PlatformPatterns.psiElement(TwigTokenTypes.COMMENT_TEXT).withText(PlatformPatterns.string().matches(s)).withLanguage(TwigLanguage.INSTANCE));
Expand All @@ -940,7 +939,6 @@ public static ElementPattern<PsiElement> getTwigDocSeePattern() {
}

public static ElementPattern<PsiElement> getAutocompletableRoutePattern() {
//noinspection unchecked
return PlatformPatterns
.psiElement(TwigTokenTypes.STRING_TEXT)
.afterLeafSkipping(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ private Collection<PhpClass> getVarClassGoto(@NotNull PsiElement psiElement) {
if (matcher.find()) {
String className = matcher.group("class");
if(StringUtils.isNotBlank(className)) {
return PhpElementsUtil.getClassesInterface(psiElement.getProject(), className);
return PhpElementsUtil.getClassesInterface(psiElement.getProject(), StringUtils.stripEnd(className, "[]"));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ public class TwigTypeResolveUtil {
* {# @var variable \AppBundle\Entity\Foo[] #}
* {# @var variable \AppBundle\Entity\Foo #}
*/
private static final String DOC_TYPE_PATTERN_CLASS_SECOND = "@var[\\s]+(?<var>[\\w]+)[\\s]+(?<class>[\\w\\\\\\[\\]]+)[\\s]*";
private static final String DOC_TYPE_PATTERN_CLASS_SECOND = "@var\\s+(?<var>\\w+)\\s+(?<class>[\\w\\\\\\[\\]]+)\\s*";

/**
* {# @var \AppBundle\Entity\Foo[] variable #}
* {# @var \AppBundle\Entity\Foo variable #}
*/
private static final String DOC_TYPE_PATTERN_CLASS_FIRST = "@var[\\s]+(?<class>[\\w\\\\\\[\\]]+)[\\s]+(?<var>[\\w]+)[\\s]*";
private static final String DOC_TYPE_PATTERN_CLASS_FIRST = "@var\\s+(?<class>[\\w\\\\\\[\\]]+)\\s+(?<var>\\w+)\\s*";

public static final Pattern[] INLINE_DOC_REGEX = {
Pattern.compile(DOC_TYPE_PATTERN_CLASS_SECOND, Pattern.MULTILINE),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,14 @@ public void testSimpleTestNavigationToExtension() {
public void testGetVarClassGoto() {
assertNavigationMatch(TwigFileType.INSTANCE, "{# @var bar \\Date<caret>Time #}", PlatformPatterns.psiElement(PhpClass.class));
assertNavigationMatch(TwigFileType.INSTANCE, "{# @var \\Date<caret>Time bar #}", PlatformPatterns.psiElement(PhpClass.class));

assertNavigationMatch(TwigFileType.INSTANCE, "{# @var \\Date<caret>Time[] bar #}", PlatformPatterns.psiElement(PhpClass.class));
assertNavigationMatch(TwigFileType.INSTANCE, "{# @var bar \\Date<caret>Time[] #}", PlatformPatterns.psiElement(PhpClass.class));
}

public void testGetVarClassGotoDeprecated() {
assertNavigationMatch(TwigFileType.INSTANCE, "{# bar \\Date<caret>Time #}", PlatformPatterns.psiElement(PhpClass.class));
assertNavigationMatch(TwigFileType.INSTANCE, "{# bar \\Date<caret>Time[] #}", PlatformPatterns.psiElement(PhpClass.class));
}

public void testSeeTagGoto() {
Expand Down