diff --git a/src/main/java/de/espend/idea/php/annotation/doctrine/inspection/DoctrineTypeDeprecatedInspection.java b/src/main/java/de/espend/idea/php/annotation/doctrine/inspection/DoctrineTypeDeprecatedInspection.java index ffe2b628..08605a82 100644 --- a/src/main/java/de/espend/idea/php/annotation/doctrine/inspection/DoctrineTypeDeprecatedInspection.java +++ b/src/main/java/de/espend/idea/php/annotation/doctrine/inspection/DoctrineTypeDeprecatedInspection.java @@ -78,11 +78,11 @@ private static String getContentIfTypeValid(@NotNull PsiElement psiElement, @Not PsiElement attributeNamePsi = PhpPsiUtil.getPrevSibling(psiElement, psiElement1 -> psiElement1 instanceof PsiWhiteSpace || psiElement1.getNode().getElementType() == PhpTokenTypes.opCOLON); if (attributeNamePsi != null && attributeNamePsi.getNode().getElementType() == PhpTokenTypes.IDENTIFIER) { String text = attributeNamePsi.getText(); - if (text.equals("type")) { + if (property.equals(text)) { PhpAttribute phpAttribute = PsiTreeUtil.getParentOfType(psiElement, PhpAttribute.class); if (phpAttribute != null) { String fqn = phpAttribute.getFQN(); - if (fqn != null) { + if (PhpLangUtil.equalsClassNames(clazz, fqn)) { return ((StringLiteralExpression) psiElement).getContents(); } } diff --git a/src/test/java/de/espend/idea/php/annotation/tests/inspection/DoctrineTypeDeprecatedInspectionTest.java b/src/test/java/de/espend/idea/php/annotation/tests/inspection/DoctrineTypeDeprecatedInspectionTest.java index e446e7c6..c9cd07ae 100644 --- a/src/test/java/de/espend/idea/php/annotation/tests/inspection/DoctrineTypeDeprecatedInspectionTest.java +++ b/src/test/java/de/espend/idea/php/annotation/tests/inspection/DoctrineTypeDeprecatedInspectionTest.java @@ -51,5 +51,14 @@ public void testThatDeprecatedInspectionIsDisplayedDoctrineColumnTypesForAttribu "}", "[Annotations] Deprecated: Use JsonType instead" ); + + assertLocalInspectionIsEmpty("test.php", "_array')]\n" + + "class Foo\n" + + "{\n" + + "}" + ); } }