Skip to content

Commit ef2a056

Browse files
authored
Merge pull request #784 from bohdan-harniuk/uct-inspection-rephrase-messages-for-deprecations
UCT-774: Rephrased messages for deprecations
2 parents 02db1b8 + edb4af8 commit ef2a056

16 files changed

+138
-59
lines changed

resources/uct/bundle/inspection.properties

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,18 @@ inspection.displayName.UsedNonExistentConstant=Used non-existent Adobe Commerce
2727
inspection.displayName.UsedNonExistentProperty=Used non-existent Adobe Commerce property
2828
inspection.displayName.ImportedNonApiClass=Imported non Adobe Commerce API class
2929
inspection.displayName.ImportedNonApiInterface=Imported non Adobe Commerce API interface
30-
customCode.warnings.deprecated.1131=[1131] Extending from @deprecated class ''{0}''
31-
customCode.warnings.deprecated.1132=[1132] Importing @deprecated class ''{0}''
32-
customCode.warnings.deprecated.1134=[1134] Using @deprecated class ''{0}''
33-
customCode.warnings.deprecated.1234=[1234] Using @deprecated constant ''{0}''
34-
customCode.warnings.deprecated.1235=[1235] Overriding @deprecated constant ''{0}''
35-
customCode.warnings.deprecated.1332=[1332] Imported @deprecated interface ''{0}''
36-
customCode.warnings.deprecated.1334=[1334] Used @deprecated interface ''{0}''
37-
customCode.warnings.deprecated.1337=[1337] Inherited from @deprecated interface ''{0}''
38-
customCode.warnings.deprecated.1338=[1338] Implemented @deprecated interface ''{0}''
39-
customCode.warnings.deprecated.1439=[1439] Call @deprecated method ''{0}''
40-
customCode.warnings.deprecated.1534=[1534] Using @deprecated property ''{0}''
41-
customCode.warnings.deprecated.1535=[1535] Overriding @deprecated property ''{0}''
30+
customCode.warnings.deprecated.1131=[1131] Extended class ''{0}'' that is @deprecated in the ''{1}''
31+
customCode.warnings.deprecated.1132=[1132] Imported class ''{0}'' that is @deprecated in the ''{1}''
32+
customCode.warnings.deprecated.1134=[1134] Used class ''{0}'' that is @deprecated in the ''{1}''
33+
customCode.warnings.deprecated.1234=[1234] Used constant ''{0}'' that is @deprecated in the ''{1}''
34+
customCode.warnings.deprecated.1235=[1235] Overridden constant ''{0}'' that is @deprecated in the ''{1}''
35+
customCode.warnings.deprecated.1332=[1332] Imported interface ''{0}'' that is @deprecated in the ''{1}''
36+
customCode.warnings.deprecated.1334=[1334] Used interface ''{0}'' that is @deprecated in the ''{1}''
37+
customCode.warnings.deprecated.1337=[1337] Inherited from interface ''{0}'' that is @deprecated in the ''{1}''
38+
customCode.warnings.deprecated.1338=[1338] Implemented interface ''{0}'' that is @deprecated in the ''{1}''
39+
customCode.warnings.deprecated.1439=[1439] Called method ''{0}'' that is @deprecated in the ''{1}''
40+
customCode.warnings.deprecated.1534=[1534] Used property ''{0}'' that is @deprecated in the ''{1}''
41+
customCode.warnings.deprecated.1535=[1535] Overridden property ''{0}'' that is @deprecated in the ''{1}''
4242
customCode.critical.existence.1112=[1112] Imported class ''{0}'' that is removed in the ''{1}''
4343
customCode.critical.existence.1312=[1312] Imported interface ''{0}'' that is removed in the ''{1}''
4444
customCode.critical.existence.1317=[1317] Inherited interface ''{0}'' that is removed in the ''{1}''

src/com/magento/idea/magento2uct/inspections/php/deprecation/CallingDeprecatedMethod.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,14 @@ protected void execute(
3434
SupportedIssue.CALLING_DEPRECATED_METHOD.getCode()
3535
);
3636
}
37+
final String deprecatedIn = VersionStateManager.getInstance(project)
38+
.getDeprecatedInVersion(type);
39+
3740
problemsHolder.registerProblem(
3841
methodReference,
3942
SupportedIssue.CALLING_DEPRECATED_METHOD.getMessage(
40-
type.replace(".", "::")
43+
type.replace(".", "::"),
44+
deprecatedIn
4145
),
4246
ProblemHighlightType.LIKE_DEPRECATED
4347
);

src/com/magento/idea/magento2uct/inspections/php/deprecation/ExtendingDeprecatedClass.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ protected void execute(
3232
if (!VersionStateManager.getInstance(project).isDeprecated(parentFqn)) {
3333
return;
3434
}
35+
final String deprecatedIn = VersionStateManager.getInstance(project)
36+
.getDeprecatedInVersion(parentFqn);
37+
3538
for (final ClassReference classReference : childExtends.getReferenceElements()) {
3639
if (parentFqn.equals(classReference.getFQN())) {
3740
if (problemsHolder instanceof UctProblemsHolder) {
@@ -42,7 +45,8 @@ protected void execute(
4245
problemsHolder.registerProblem(
4346
classReference,
4447
SupportedIssue.EXTENDING_DEPRECATED_CLASS.getMessage(
45-
parentClass.getFQN()
48+
parentClass.getFQN(),
49+
deprecatedIn
4650
),
4751
ProblemHighlightType.LIKE_DEPRECATED
4852
);

src/com/magento/idea/magento2uct/inspections/php/deprecation/ImplementedDeprecatedInterface.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,14 @@ protected void execute(
3131
SupportedIssue.IMPLEMENTED_DEPRECATED_INTERFACE.getCode()
3232
);
3333
}
34+
final String deprecatedIn = VersionStateManager.getInstance(project)
35+
.getDeprecatedInVersion(interfaceFqn);
36+
3437
problemsHolder.registerProblem(
3538
reference,
3639
SupportedIssue.IMPLEMENTED_DEPRECATED_INTERFACE.getMessage(
37-
interfaceFqn
40+
interfaceFqn,
41+
deprecatedIn
3842
),
3943
ProblemHighlightType.LIKE_DEPRECATED
4044
);

src/com/magento/idea/magento2uct/inspections/php/deprecation/ImportingDeprecatedClass.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,15 @@ protected void execute(
3434
SupportedIssue.IMPORTING_DEPRECATED_CLASS.getCode()
3535
);
3636
}
37+
final String deprecatedIn = VersionStateManager.getInstance(project)
38+
.getDeprecatedInVersion(use.getFQN());
39+
3740
problemsHolder.registerProblem(
3841
use,
39-
SupportedIssue.IMPORTING_DEPRECATED_CLASS.getMessage(use.getFQN()),
42+
SupportedIssue.IMPORTING_DEPRECATED_CLASS.getMessage(
43+
use.getFQN(),
44+
deprecatedIn
45+
),
4046
ProblemHighlightType.LIKE_DEPRECATED
4147
);
4248
}

src/com/magento/idea/magento2uct/inspections/php/deprecation/ImportingDeprecatedInterface.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,15 @@ protected void execute(
3434
SupportedIssue.IMPORTING_DEPRECATED_INTERFACE.getCode()
3535
);
3636
}
37+
final String deprecatedIn = VersionStateManager.getInstance(project)
38+
.getDeprecatedInVersion(use.getFQN());
39+
3740
problemsHolder.registerProblem(
3841
use,
39-
SupportedIssue.IMPORTING_DEPRECATED_INTERFACE.getMessage(use.getFQN()),
42+
SupportedIssue.IMPORTING_DEPRECATED_INTERFACE.getMessage(
43+
use.getFQN(),
44+
deprecatedIn
45+
),
4046
ProblemHighlightType.LIKE_DEPRECATED
4147
);
4248
}

src/com/magento/idea/magento2uct/inspections/php/deprecation/InheritedDeprecatedInterface.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,15 @@ protected void execute(
3131
SupportedIssue.INHERITED_DEPRECATED_INTERFACE.getCode()
3232
);
3333
}
34+
final String deprecatedIn = VersionStateManager.getInstance(project)
35+
.getDeprecatedInVersion(interfaceFqn);
36+
3437
problemsHolder.registerProblem(
3538
reference,
36-
SupportedIssue.INHERITED_DEPRECATED_INTERFACE.getMessage(interfaceFqn),
39+
SupportedIssue.INHERITED_DEPRECATED_INTERFACE.getMessage(
40+
interfaceFqn,
41+
deprecatedIn
42+
),
3743
ProblemHighlightType.LIKE_DEPRECATED
3844
);
3945
}

src/com/magento/idea/magento2uct/inspections/php/deprecation/OverridingDeprecatedConstant.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,16 @@ protected void execute(
3737
SupportedIssue.OVERRIDING_DEPRECATED_CONSTANT.getCode()
3838
);
3939
}
40+
final String deprecatedIn = VersionStateManager.getInstance(project)
41+
.getDeprecatedInVersion(overriddenField.getFQN());
42+
4043
problemsHolder.registerProblem(
4144
field,
4245
SupportedIssue.OVERRIDING_DEPRECATED_CONSTANT.getMessage(
4346
parentClass.getFQN()
4447
.concat("::")
45-
.concat(overriddenField.getName())
48+
.concat(overriddenField.getName()),
49+
deprecatedIn
4650
),
4751
ProblemHighlightType.LIKE_DEPRECATED
4852
);

src/com/magento/idea/magento2uct/inspections/php/deprecation/OverridingDeprecatedProperty.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,16 @@ protected void execute(
3737
SupportedIssue.OVERRIDING_DEPRECATED_PROPERTY.getCode()
3838
);
3939
}
40+
final String deprecatedIn = VersionStateManager.getInstance(project)
41+
.getDeprecatedInVersion(overriddenField.getFQN());
42+
4043
problemsHolder.registerProblem(
4144
field,
4245
SupportedIssue.OVERRIDING_DEPRECATED_PROPERTY.getMessage(
4346
parentClass.getFQN()
4447
.concat("::")
45-
.concat(overriddenField.getName())
48+
.concat(overriddenField.getName()),
49+
deprecatedIn
4650
),
4751
ProblemHighlightType.LIKE_DEPRECATED
4852
);

src/com/magento/idea/magento2uct/inspections/php/deprecation/UsingDeprecatedClass.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,15 @@ protected void execute(
3535
SupportedIssue.USING_DEPRECATED_CLASS.getCode()
3636
);
3737
}
38+
final String deprecatedIn = VersionStateManager.getInstance(project)
39+
.getDeprecatedInVersion(phpClass.getFQN());
40+
3841
problemsHolder.registerProblem(
3942
reference,
40-
SupportedIssue.USING_DEPRECATED_CLASS.getMessage(phpClass.getFQN()),
43+
SupportedIssue.USING_DEPRECATED_CLASS.getMessage(
44+
phpClass.getFQN(),
45+
deprecatedIn
46+
),
4147
ProblemHighlightType.LIKE_DEPRECATED
4248
);
4349
}

0 commit comments

Comments
 (0)