Skip to content

Commit a836419

Browse files
Fix tests
1 parent ad6e17b commit a836419

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

@@ -1201,15 +1210,18 @@ public function testHashing(): void
12011210
[
12021211
"Strict comparison using === between lowercase-string&non-falsy-string and 'ABC' will always evaluate to false.",
12031212
9,
1213+
"'ABC' is not lowercase.",
12041214
],
12051215
[
12061216
"Strict comparison using === between (lowercase-string&non-falsy-string)|false and 'ABC' will always evaluate to false.",
12071217
12,
1218+
"'ABC' is not lowercase.",
12081219
],
12091220
[
12101221
"Strict comparison using === between (lowercase-string&non-falsy-string)|(non-falsy-string&numeric-string) and 'A' will always evaluate to false.",
12111222
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%</>.",
12131225
],
12141226
]);
12151227
}

0 commit comments

Comments
 (0)