You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tests/PHPStan/Rules/Comparison/StrictComparisonOfDifferentTypesRuleTest.php
+22-10Lines changed: 22 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -277,7 +277,8 @@ public function testStrictComparison(): void
277
277
[
278
278
'Strict comparison using === between lowercase-string|false and \'AB\' will always evaluate to false.',
279
279
1014,
280
-
$tipText,
280
+
"• 'AB' is not lowercase.
281
+
• Because the type is coming from a PHPDoc, you can turn off this check by setting <fg=cyan>treatPhpDocTypesAsCertain: false</> in your <fg=cyan>%configurationFile%</>.",
281
282
],
282
283
[
283
284
'Strict comparison using === between mixed and null will always evaluate to false.',
@@ -451,7 +452,8 @@ public function testStrictComparisonWithoutAlwaysTrue(): void
451
452
[
452
453
'Strict comparison using === between lowercase-string|false and \'AB\' will always evaluate to false.',
453
454
1014,
454
-
$tipText,
455
+
"• 'AB' is not lowercase.
456
+
• Because the type is coming from a PHPDoc, you can turn off this check by setting <fg=cyan>treatPhpDocTypesAsCertain: false</> in your <fg=cyan>%configurationFile%</>.",
455
457
],
456
458
[
457
459
'Strict comparison using === between mixed and null will always evaluate to false.',
@@ -1098,41 +1100,48 @@ public function testLowercaseString(): void
1098
1100
[
1099
1101
"Strict comparison using === between lowercase-string and 'AB' will always evaluate to false.",
1100
1102
10,
1101
-
'Because the type is coming from a PHPDoc, you can turn off this check by setting <fg=cyan>treatPhpDocTypesAsCertain: false</> in your <fg=cyan>%configurationFile%</>.',
1103
+
"• 'AB' is not lowercase.
1104
+
• Because the type is coming from a PHPDoc, you can turn off this check by setting <fg=cyan>treatPhpDocTypesAsCertain: false</> in your <fg=cyan>%configurationFile%</>.",
1102
1105
],
1103
1106
[
1104
1107
"Strict comparison using === between 'AB' and lowercase-string will always evaluate to false.",
1105
1108
11,
1106
-
'Because the type is coming from a PHPDoc, you can turn off this check by setting <fg=cyan>treatPhpDocTypesAsCertain: false</> in your <fg=cyan>%configurationFile%</>.',
1109
+
"• 'AB' is not lowercase.
1110
+
• Because the type is coming from a PHPDoc, you can turn off this check by setting <fg=cyan>treatPhpDocTypesAsCertain: false</> in your <fg=cyan>%configurationFile%</>.",
1107
1111
],
1108
1112
[
1109
1113
"Strict comparison using !== between 'AB' and lowercase-string will always evaluate to true.",
1110
1114
12,
1111
-
'Because the type is coming from a PHPDoc, you can turn off this check by setting <fg=cyan>treatPhpDocTypesAsCertain: false</> in your <fg=cyan>%configurationFile%</>.',
1115
+
"• 'AB' is not lowercase.
1116
+
• Because the type is coming from a PHPDoc, you can turn off this check by setting <fg=cyan>treatPhpDocTypesAsCertain: false</> in your <fg=cyan>%configurationFile%</>.",
1112
1117
],
1113
1118
[
1114
1119
"Strict comparison using === between lowercase-string and 'aBc' will always evaluate to false.",
1115
1120
15,
1116
-
'Because the type is coming from a PHPDoc, you can turn off this check by setting <fg=cyan>treatPhpDocTypesAsCertain: false</> in your <fg=cyan>%configurationFile%</>.',
1121
+
"• 'aBc' is not lowercase.
1122
+
• Because the type is coming from a PHPDoc, you can turn off this check by setting <fg=cyan>treatPhpDocTypesAsCertain: false</> in your <fg=cyan>%configurationFile%</>.",
1117
1123
],
1118
1124
[
1119
1125
"Strict comparison using !== between lowercase-string and 'aBc' will always evaluate to true.",
1120
1126
16,
1121
-
'Because the type is coming from a PHPDoc, you can turn off this check by setting <fg=cyan>treatPhpDocTypesAsCertain: false</> in your <fg=cyan>%configurationFile%</>.',
1127
+
"• 'aBc' is not lowercase.
1128
+
• Because the type is coming from a PHPDoc, you can turn off this check by setting <fg=cyan>treatPhpDocTypesAsCertain: false</> in your <fg=cyan>%configurationFile%</>.",
1122
1129
],
1123
1130
];
1124
1131
1125
1132
if (PHP_VERSION_ID < 80000) {
1126
1133
$errors[] = [
1127
1134
"Strict comparison using === between lowercase-string|false and 'AB' will always evaluate to false.",
1128
1135
28,
1129
-
'Because the type is coming from a PHPDoc, you can turn off this check by setting <fg=cyan>treatPhpDocTypesAsCertain: false</> in your <fg=cyan>%configurationFile%</>.',
1136
+
"• 'AB' is not lowercase.
1137
+
• Because the type is coming from a PHPDoc, you can turn off this check by setting <fg=cyan>treatPhpDocTypesAsCertain: false</> in your <fg=cyan>%configurationFile%</>.",
1130
1138
];
1131
1139
} else {
1132
1140
$errors[] = [
1133
1141
"Strict comparison using === between lowercase-string and 'AB' will always evaluate to false.",
1134
1142
28,
1135
-
'Because the type is coming from a PHPDoc, you can turn off this check by setting <fg=cyan>treatPhpDocTypesAsCertain: false</> in your <fg=cyan>%configurationFile%</>.',
1143
+
"• 'AB' is not lowercase.
1144
+
• Because the type is coming from a PHPDoc, you can turn off this check by setting <fg=cyan>treatPhpDocTypesAsCertain: false</> in your <fg=cyan>%configurationFile%</>.",
1136
1145
];
1137
1146
}
1138
1147
@@ -1201,15 +1210,18 @@ public function testHashing(): void
1201
1210
[
1202
1211
"Strict comparison using === between lowercase-string&non-falsy-string and 'ABC' will always evaluate to false.",
1203
1212
9,
1213
+
"'ABC' is not lowercase.",
1204
1214
],
1205
1215
[
1206
1216
"Strict comparison using === between (lowercase-string&non-falsy-string)|false and 'ABC' will always evaluate to false.",
1207
1217
12,
1218
+
"'ABC' is not lowercase.",
1208
1219
],
1209
1220
[
1210
1221
"Strict comparison using === between (lowercase-string&non-falsy-string)|(non-falsy-string&numeric-string) and 'A' will always evaluate to false.",
1211
1222
31,
1212
-
'Because the type is coming from a PHPDoc, you can turn off this check by setting <fg=cyan>treatPhpDocTypesAsCertain: false</> in your <fg=cyan>%configurationFile%</>.',
1223
+
"• 'A' is not lowercase.
1224
+
• Because the type is coming from a PHPDoc, you can turn off this check by setting <fg=cyan>treatPhpDocTypesAsCertain: false</> in your <fg=cyan>%configurationFile%</>.",
0 commit comments