Skip to content

Commit 0087cd2

Browse files
Fix tests
1 parent 3b11d00 commit 0087cd2

File tree

1 file changed

+22
-10
lines changed

1 file changed

+22
-10
lines changed

tests/PHPStan/Rules/Comparison/StrictComparisonOfDifferentTypesRuleTest.php

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,8 @@ public function testStrictComparison(): void
277277
[
278278
'Strict comparison using === between lowercase-string|false and \'AB\' will always evaluate to false.',
279279
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%</>.",
281282
],
282283
[
283284
'Strict comparison using === between mixed and null will always evaluate to false.',
@@ -451,7 +452,8 @@ public function testStrictComparisonWithoutAlwaysTrue(): void
451452
[
452453
'Strict comparison using === between lowercase-string|false and \'AB\' will always evaluate to false.',
453454
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%</>.",
455457
],
456458
[
457459
'Strict comparison using === between mixed and null will always evaluate to false.',
@@ -1098,41 +1100,48 @@ public function testLowercaseString(): void
10981100
[
10991101
"Strict comparison using === between lowercase-string and 'AB' will always evaluate to false.",
11001102
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%</>.",
11021105
],
11031106
[
11041107
"Strict comparison using === between 'AB' and lowercase-string will always evaluate to false.",
11051108
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%</>.",
11071111
],
11081112
[
11091113
"Strict comparison using !== between 'AB' and lowercase-string will always evaluate to true.",
11101114
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%</>.",
11121117
],
11131118
[
11141119
"Strict comparison using === between lowercase-string and 'aBc' will always evaluate to false.",
11151120
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%</>.",
11171123
],
11181124
[
11191125
"Strict comparison using !== between lowercase-string and 'aBc' will always evaluate to true.",
11201126
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%</>.",
11221129
],
11231130
];
11241131

11251132
if (PHP_VERSION_ID < 80000) {
11261133
$errors[] = [
11271134
"Strict comparison using === between lowercase-string|false and 'AB' will always evaluate to false.",
11281135
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%</>.",
11301138
];
11311139
} else {
11321140
$errors[] = [
11331141
"Strict comparison using === between lowercase-string and 'AB' will always evaluate to false.",
11341142
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%</>.",
11361145
];
11371146
}
11381147

@@ -1153,15 +1162,18 @@ public function testHashing(): void
11531162
[
11541163
"Strict comparison using === between lowercase-string&non-falsy-string and 'ABC' will always evaluate to false.",
11551164
9,
1165+
"'ABC' is not lowercase.",
11561166
],
11571167
[
11581168
"Strict comparison using === between (lowercase-string&non-falsy-string)|false and 'ABC' will always evaluate to false.",
11591169
12,
1170+
"'ABC' is not lowercase.",
11601171
],
11611172
[
11621173
"Strict comparison using === between (lowercase-string&non-falsy-string)|(non-falsy-string&numeric-string) and 'A' will always evaluate to false.",
11631174
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%</>.",
11651177
],
11661178
]);
11671179
}

0 commit comments

Comments
 (0)