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
@@ -1153,15 +1162,18 @@ public function testHashing(): void
1153
1162
[
1154
1163
"Strict comparison using === between lowercase-string&non-falsy-string and 'ABC' will always evaluate to false.",
1155
1164
9,
1165
+
"'ABC' is not lowercase.",
1156
1166
],
1157
1167
[
1158
1168
"Strict comparison using === between (lowercase-string&non-falsy-string)|false and 'ABC' will always evaluate to false.",
1159
1169
12,
1170
+
"'ABC' is not lowercase.",
1160
1171
],
1161
1172
[
1162
1173
"Strict comparison using === between (lowercase-string&non-falsy-string)|(non-falsy-string&numeric-string) and 'A' will always evaluate to false.",
1163
1174
31,
1164
-
'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%</>.',
1175
+
"• 'A' is not lowercase.
1176
+
• 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