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
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ before_install:
- "export ORG_GRADLE_PROJECT_annotationPluginVersion=${ANNOTATION_PLUGIN_VERSION}"

env:
- PHPSTORM_ENV="skip incomplete" IDEA_VERSION="IU-2020.1" PHP_PLUGIN_VERSION="201.6668.153" TWIG_PLUGIN_VERSION="201.6668.153" TOOLBOX_PLUGIN_VERSION="0.4.6" ANNOTATION_PLUGIN_VERSION="5.3" DQL_PLUGIN_VERSION="201.6668.60"
- PHPSTORM_ENV="skip incomplete" IDEA_VERSION="IU-202.5792.28-EAP-SNAPSHOT" PHP_PLUGIN_VERSION="202.5792.59" TWIG_PLUGIN_VERSION="202.5792.17" TOOLBOX_PLUGIN_VERSION="0.4.6" ANNOTATION_PLUGIN_VERSION="5.3" DQL_PLUGIN_VERSION="202.5792.28"

script:
- "./gradlew check verifyPlugin buildPlugin"
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ideaVersion = IU-2020.1
phpPluginVersion = 201.6668.153
twigPluginVersion = 201.6668.153
dqlPluginVersion = 201.6668.60
ideaVersion = IU-202.5792.28-EAP-SNAPSHOT
phpPluginVersion = 202.5792.59
twigPluginVersion = 202.5792.17
dqlPluginVersion = 202.5792.28
toolboxPluginVersion = 0.4.6
annotationPluginVersion = 5.3
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@
public class ConfigLineMarkerProvider implements LineMarkerProvider {
@Nullable
@Override
public LineMarkerInfo getLineMarkerInfo(@NotNull PsiElement psiElement) {
public LineMarkerInfo<?> getLineMarkerInfo(@NotNull PsiElement psiElement) {
return null;
}

@Override
public void collectSlowLineMarkers(@NotNull List<PsiElement> psiElements, @NotNull Collection<LineMarkerInfo> result) {
public void collectSlowLineMarkers(@NotNull List<? extends PsiElement> psiElements, @NotNull Collection<? super LineMarkerInfo<?>> result) {
if(psiElements.size() == 0 || !Symfony2ProjectComponent.isEnabled(psiElements.get(0))) {
return;
}
Expand All @@ -47,7 +47,7 @@ public void collectSlowLineMarkers(@NotNull List<PsiElement> psiElements, @NotNu
}
}

private void visitRootElements(@NotNull Collection<LineMarkerInfo> result, @NotNull PsiElement psiElement, @NotNull LazyConfigTreeSignatures function) {
private void visitRootElements(@NotNull Collection<? super LineMarkerInfo<?>> result, @NotNull PsiElement psiElement, @NotNull LazyConfigTreeSignatures function) {
PsiElement parent = psiElement.getParent();
if(!(parent instanceof YAMLKeyValue)) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ public class ServiceLineMarkerProvider implements LineMarkerProvider {

@Nullable
@Override
public LineMarkerInfo getLineMarkerInfo(@NotNull PsiElement element) {
public LineMarkerInfo<?> getLineMarkerInfo(@NotNull PsiElement element) {
return null;
}

@Override
public void collectSlowLineMarkers(@NotNull List<PsiElement> psiElements, @NotNull Collection<LineMarkerInfo> results) {
public void collectSlowLineMarkers(@NotNull List<? extends PsiElement> psiElements, @NotNull Collection<? super LineMarkerInfo<?>> results) {

// we need project element; so get it from first item
if(psiElements.size() == 0) {
Expand Down Expand Up @@ -92,7 +92,7 @@ public void collectSlowLineMarkers(@NotNull List<PsiElement> psiElements, @NotNu

}

private void classNameMarker(PsiElement psiElement, Collection<? super RelatedItemLineMarkerInfo> result) {
private void classNameMarker(PsiElement psiElement, Collection<? super RelatedItemLineMarkerInfo<?>> result) {
PsiElement phpClassContext = psiElement.getContext();
if(!(phpClassContext instanceof PhpClass)) {
return;
Expand Down Expand Up @@ -150,7 +150,7 @@ private void classNameMarker(PsiElement psiElement, Collection<? super RelatedIt
result.add(builder.createLineMarkerInfo(psiElement));
}

private void entityClassMarker(PsiElement psiElement, Collection<? super RelatedItemLineMarkerInfo> result) {
private void entityClassMarker(PsiElement psiElement, Collection<? super RelatedItemLineMarkerInfo<?>> result) {

PsiElement phpClassContext = psiElement.getContext();
if(!(phpClassContext instanceof PhpClass)) {
Expand Down Expand Up @@ -186,7 +186,7 @@ private void entityClassMarker(PsiElement psiElement, Collection<? super Related
result.add(builder.createLineMarkerInfo(psiElement));
}

private void repositoryClassMarker(PsiElement psiElement, Collection<? super RelatedItemLineMarkerInfo> result) {
private void repositoryClassMarker(PsiElement psiElement, Collection<? super RelatedItemLineMarkerInfo<?>> result) {

PsiElement phpClassContext = psiElement.getContext();
if(!(phpClassContext instanceof PhpClass)) {
Expand Down Expand Up @@ -214,7 +214,7 @@ private void repositoryClassMarker(PsiElement psiElement, Collection<? super Rel
result.add(builder.createLineMarkerInfo(psiElement));
}

private void formNameMarker(PsiElement psiElement, Collection<? super RelatedItemLineMarkerInfo> result) {
private void formNameMarker(PsiElement psiElement, Collection<? super RelatedItemLineMarkerInfo<?>> result) {

if(!(psiElement instanceof StringLiteralExpression)) {
return;
Expand Down Expand Up @@ -246,7 +246,7 @@ private void formNameMarker(PsiElement psiElement, Collection<? super RelatedIte

}

private void routeAnnotationFileResource(@NotNull PsiFile psiFile, Collection<? super RelatedItemLineMarkerInfo> results) {
private void routeAnnotationFileResource(@NotNull PsiFile psiFile, Collection<? super RelatedItemLineMarkerInfo<?>> results) {
RelatedItemLineMarkerInfo<PsiElement> lineMarker = FileResourceUtil.getFileImplementsLineMarkerInFolderScope(psiFile);
if(lineMarker != null) {
results.add(lineMarker);
Expand All @@ -256,7 +256,7 @@ private void routeAnnotationFileResource(@NotNull PsiFile psiFile, Collection<?
/**
* Constraints in same namespace and validateBy service name
*/
private void validatorClassMarker(PsiElement psiElement, Collection<LineMarkerInfo> results) {
private void validatorClassMarker(PsiElement psiElement, Collection<? super LineMarkerInfo<?>> results) {
PsiElement phpClassContext = psiElement.getContext();
if(!(phpClassContext instanceof PhpClass) || !PhpElementsUtil.isInstanceOf((PhpClass) phpClassContext, "\\Symfony\\Component\\Validator\\Constraint")) {
return;
Expand All @@ -282,7 +282,7 @@ private void validatorClassMarker(PsiElement psiElement, Collection<LineMarkerIn
/**
* "FooValidator" back to "Foo" constraint
*/
private void constraintValidatorClassMarker(PsiElement psiElement, Collection<LineMarkerInfo> results) {
private void constraintValidatorClassMarker(PsiElement psiElement, Collection<? super LineMarkerInfo<?>> results) {
PsiElement phpClass = psiElement.getContext();
if(!(phpClass instanceof PhpClass) || !PhpElementsUtil.isInstanceOf((PhpClass) phpClass, "Symfony\\Component\\Validator\\ConstraintValidatorInterface")) {
return;
Expand All @@ -308,7 +308,7 @@ private void constraintValidatorClassMarker(PsiElement psiElement, Collection<Li
results.add(builder.createLineMarkerInfo(psiElement));
}

private void autowireConstructorMarker(PsiElement psiElement, Collection<LineMarkerInfo> results) {
private void autowireConstructorMarker(PsiElement psiElement, Collection<? super LineMarkerInfo<?>> results) {
PsiElement method = psiElement.getParent();
if (!(method instanceof Method)) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
import org.jetbrains.yaml.YAMLTokenTypes;
import org.jetbrains.yaml.psi.*;

import java.util.Collection;
import java.util.stream.Collectors;

/**
* @author Daniel Espendiller <daniel@espendiller.net>
*/
Expand Down Expand Up @@ -199,18 +202,24 @@ private String getEventTypeHint(@NotNull ProblemDescriptor problemDescriptor, @N
return null;
}

String taggedEventMethodParameter = EventSubscriberUtil.getTaggedEventMethodParameter(problemDescriptor.getPsiElement().getProject(), eventName);
if (taggedEventMethodParameter == null) {
Collection<String> taggedEventMethodParameter = EventSubscriberUtil.getTaggedEventMethodParameter(problemDescriptor.getPsiElement().getProject(), eventName);
if (taggedEventMethodParameter.isEmpty()) {
return null;
}

String qualifiedName = AnnotationBackportUtil.getQualifiedName(phpClass, taggedEventMethodParameter);
if (qualifiedName != null && !qualifiedName.equals(StringUtils.stripStart(taggedEventMethodParameter, "\\"))) {
return taggedEventMethodParameter.stream()
.map(fqn -> importIfNecessary(phpClass, fqn))
.collect(Collectors.joining("|"));
}

private String importIfNecessary(@NotNull PhpClass phpClass, String fqn) {
String qualifiedName = AnnotationBackportUtil.getQualifiedName(phpClass, fqn);
if (qualifiedName != null && !qualifiedName.equals(StringUtils.stripStart(fqn, "\\"))) {
// class already imported
return qualifiedName;
}

return PhpElementsUtil.insertUseIfNecessary(phpClass, taggedEventMethodParameter);
return PhpElementsUtil.insertUseIfNecessary(phpClass, fqn);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ public class ControllerMethodLineMarkerProvider implements LineMarkerProvider {

@Nullable
@Override
public LineMarkerInfo getLineMarkerInfo(@NotNull PsiElement psiElement) {
public LineMarkerInfo<?> getLineMarkerInfo(@NotNull PsiElement psiElement) {
return null;
}

@Nullable
public LineMarkerInfo collect(PsiElement psiElement) {
public LineMarkerInfo<?> collect(PsiElement psiElement) {
if(!Symfony2ProjectComponent.isEnabled(psiElement) || psiElement.getNode().getElementType() != PhpTokenTypes.IDENTIFIER) {
return null;
}
Expand Down Expand Up @@ -102,10 +102,10 @@ public static List<GotoRelatedItem> getGotoRelatedItems(Method method) {
}

@Override
public void collectSlowLineMarkers(@NotNull List<PsiElement> psiElements, @NotNull Collection<LineMarkerInfo> results) {
public void collectSlowLineMarkers(@NotNull List<? extends PsiElement> psiElements, @NotNull Collection<? super LineMarkerInfo<?>> results) {

for(PsiElement psiElement: psiElements) {
LineMarkerInfo lineMarkerInfo = collect(psiElement);
LineMarkerInfo<?> lineMarkerInfo = collect(psiElement);
if(lineMarkerInfo != null) {
results.add(lineMarkerInfo);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
public class XmlLineMarkerProvider implements LineMarkerProvider {
@Nullable
@Override
public LineMarkerInfo getLineMarkerInfo(@NotNull PsiElement psiElement) {
public LineMarkerInfo<?> getLineMarkerInfo(@NotNull PsiElement psiElement) {
return null;
}

@Override
public void collectSlowLineMarkers(@NotNull List<PsiElement> psiElements, @NotNull Collection<LineMarkerInfo> result) {
public void collectSlowLineMarkers(@NotNull List<? extends PsiElement> psiElements, @NotNull Collection<? super LineMarkerInfo<?>> result) {
if(psiElements.size() == 0 || !Symfony2ProjectComponent.isEnabled(psiElements.get(0))) {
return;
}
Expand Down Expand Up @@ -57,7 +57,7 @@ public void collectSlowLineMarkers(@NotNull List<PsiElement> psiElements, @NotNu
/**
* <service id="foo"/>
*/
private void visitServiceId(@NotNull PsiElement leafTarget, @NotNull XmlTag xmlTag, @NotNull Collection<LineMarkerInfo> result, @NotNull LazyDecoratedParentServiceValues lazyDecoratedParentServiceValues) {
private void visitServiceId(@NotNull PsiElement leafTarget, @NotNull XmlTag xmlTag, @NotNull Collection<? super LineMarkerInfo<?>> result, @NotNull LazyDecoratedParentServiceValues lazyDecoratedParentServiceValues) {
String id = xmlTag.getAttributeValue("id");
if(StringUtils.isBlank(id)) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
public class YamlLineMarkerProvider implements LineMarkerProvider {
@Nullable
@Override
public LineMarkerInfo getLineMarkerInfo(@NotNull PsiElement psiElement) {
public LineMarkerInfo<?> getLineMarkerInfo(@NotNull PsiElement psiElement) {
return null;
}

@Override
public void collectSlowLineMarkers(@NotNull List<PsiElement> psiElements, @NotNull Collection<LineMarkerInfo> result) {
public void collectSlowLineMarkers(@NotNull List<? extends PsiElement> psiElements, @NotNull Collection<? super LineMarkerInfo<?>> result) {
if(psiElements.size() == 0 || !Symfony2ProjectComponent.isEnabled(psiElements.get(0))) {
return;
}
Expand All @@ -55,7 +55,7 @@ public void collectSlowLineMarkers(@NotNull List<PsiElement> psiElements, @NotNu
}
}

private void visitServiceId(@NotNull PsiElement leafTarget, @NotNull YAMLKeyValue yamlKeyValue, @NotNull Collection<LineMarkerInfo> result, @NotNull LazyDecoratedParentServiceValues lazyDecoratedServices) {
private void visitServiceId(@NotNull PsiElement leafTarget, @NotNull YAMLKeyValue yamlKeyValue, @NotNull Collection<? super LineMarkerInfo<?>> result, @NotNull LazyDecoratedParentServiceValues lazyDecoratedServices) {
String id = yamlKeyValue.getKeyText();
if(StringUtils.isBlank(id)) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ public class DoctrineMetadataLineMarkerProvider implements LineMarkerProvider {

@Nullable
@Override
public LineMarkerInfo getLineMarkerInfo(@NotNull PsiElement element) {
public LineMarkerInfo<?> getLineMarkerInfo(@NotNull PsiElement element) {
return null;
}

@Override
public void collectSlowLineMarkers(@NotNull List<PsiElement> psiElements, @NotNull Collection<LineMarkerInfo> results) {
public void collectSlowLineMarkers(@NotNull List<? extends PsiElement> psiElements, @NotNull Collection<? super LineMarkerInfo<?>> results) {
// we need project element; so get it from first item
if(psiElements.size() == 0) {
return;
Expand All @@ -53,7 +53,7 @@ public void collectSlowLineMarkers(@NotNull List<PsiElement> psiElements, @NotNu
}
}

private void attachXmlRelationMarker(@NotNull PsiElement target, @NotNull XmlAttributeValue psiElement, @NotNull Collection<LineMarkerInfo> results) {
private void attachXmlRelationMarker(@NotNull PsiElement target, @NotNull XmlAttributeValue psiElement, @NotNull Collection<? super LineMarkerInfo<?>> results) {
String value = psiElement.getValue();
if(StringUtils.isBlank(value)) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
public class XmlLineMarkerProvider implements LineMarkerProvider {

@Override
public void collectSlowLineMarkers(@NotNull List<PsiElement> psiElements, @NotNull Collection<LineMarkerInfo> lineMarkerInfos) {
public void collectSlowLineMarkers(@NotNull List<? extends PsiElement> psiElements, @NotNull Collection<? super LineMarkerInfo<?>> lineMarkerInfos) {
if(psiElements.size() == 0 || !Symfony2ProjectComponent.isEnabled(psiElements.get(0))) {
return;
}
Expand All @@ -44,7 +44,7 @@ public void collectSlowLineMarkers(@NotNull List<PsiElement> psiElements, @NotNu

}

private void attachRouteActions(@NotNull PsiElement psiElement, @NotNull Collection<LineMarkerInfo> lineMarkerInfos) {
private void attachRouteActions(@NotNull PsiElement psiElement, @NotNull Collection<? super LineMarkerInfo<?>> lineMarkerInfos) {
PsiElement xmlTag = psiElement.getParent();
if(!(xmlTag instanceof XmlTag) || !Pattern.getRouteTag().accepts(xmlTag)) {
return;
Expand All @@ -65,7 +65,7 @@ private void attachRouteActions(@NotNull PsiElement psiElement, @NotNull Collect

@Nullable
@Override
public LineMarkerInfo getLineMarkerInfo(@NotNull PsiElement psiElement) {
public LineMarkerInfo<?> getLineMarkerInfo(@NotNull PsiElement psiElement) {
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
public class YamlLineMarkerProvider implements LineMarkerProvider {

@Override
public void collectSlowLineMarkers(@NotNull List<PsiElement> psiElements, @NotNull Collection<LineMarkerInfo> lineMarkerInfos) {
public void collectSlowLineMarkers(@NotNull List<? extends PsiElement> psiElements, @NotNull Collection<? super LineMarkerInfo<?>> lineMarkerInfos) {
if(psiElements.size() == 0 || !Symfony2ProjectComponent.isEnabled(psiElements.get(0))) {
return;
}
Expand All @@ -47,7 +47,7 @@ public void collectSlowLineMarkers(@NotNull List<PsiElement> psiElements, @NotNu
}
}

private void attachEntityClass(@NotNull Collection<LineMarkerInfo> lineMarkerInfos, @NotNull PsiElement psiElement) {
private void attachEntityClass(@NotNull Collection<? super LineMarkerInfo<?>> lineMarkerInfos, @NotNull PsiElement psiElement) {
if(psiElement.getNode().getElementType() != YAMLTokenTypes.SCALAR_KEY) {
return;
}
Expand Down Expand Up @@ -89,7 +89,7 @@ private void attachEntityClass(@NotNull Collection<LineMarkerInfo> lineMarkerInf
* defaults: { _controller: "Bundle:Foo:Bar" }
* controller: "Bundle:Foo:Bar"
*/
private void attachRouteActions(@NotNull Collection<LineMarkerInfo> lineMarkerInfos, @NotNull PsiElement psiElement) {
private void attachRouteActions(@NotNull Collection<? super LineMarkerInfo<?>> lineMarkerInfos, @NotNull PsiElement psiElement) {
if(psiElement.getNode().getElementType() != YAMLTokenTypes.SCALAR_KEY) {
return;
}
Expand All @@ -114,7 +114,7 @@ private void attachRouteActions(@NotNull Collection<LineMarkerInfo> lineMarkerIn

@Nullable
@Override
public LineMarkerInfo getLineMarkerInfo(@NotNull PsiElement psiElement) {
public LineMarkerInfo<?> getLineMarkerInfo(@NotNull PsiElement psiElement) {
return null;
}

Expand All @@ -124,7 +124,7 @@ public LineMarkerInfo getLineMarkerInfo(@NotNull PsiElement psiElement) {
* foo:
* targetEntity: Class
*/
private void attachRelationClass(@NotNull Collection<LineMarkerInfo> lineMarkerInfos, @NotNull PsiElement psiElement) {
private void attachRelationClass(@NotNull Collection<? super LineMarkerInfo<?>> lineMarkerInfos, @NotNull PsiElement psiElement) {
if(psiElement.getNode().getElementType() != YAMLTokenTypes.SCALAR_KEY) {
return;
}
Expand Down
Loading