Repository navigation
fix(stubs): strtolower and mb_strtolower of string literals are the lowercased literals - #14321
Conversation
…owercased literals vimeo#14258 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
✅ Performance: unchanged · Types: increased
How to read this table
✅ symfony: issues +1 −0Memory 3 600 → 3 600 MB (<0.1 %) · Wall 155.8 → 164.4 s (+5.5 %) Weighted 98 405 → 98 409 (+4, <0.01 %): L4 +1
Added (1)
head bb13eb6 · base c5f4dfd (merge-base) · workflow run |
|
Behaviour change
|
…o#14258 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Pushed c4b9663, a test fix (no source change), for the CI failure of
|
# Conflicts: # tests/FunctionCallTest.php
orklah
left a comment
There was a problem hiding this comment.
Thanks, the direction looks right to me. One issue:
lowercaseLiterals() builds new Union($literals), which drops the argument's from_docblock. So a
defensive check after strtolower() of a docblock-typed parameter is now reported as a hard
TypeDoesNotContainType instead of DocblockTypeContradiction. That's the symfony +1 in the perf report
(Cookie.php:299, whose $sameSite is @param self::SAMESITE_*|''|null):
/** @param 'A'|'B' $k */
function eq(string $k): void {
$l = strtolower($k);
if ($l === 'c') {} // TypeDoesNotContainType, expected DocblockTypeContradiction
$m = $k;
if ($m === 'c') {} // DocblockTypeContradiction
}return new Union($literals, ['from_docblock' => $type->from_docblock]); fixes it (checked locally). Please
add an invalid-code case for it, e.g.:
'strtolowerOfDocblockLiteralsKeepsFromDocblock' => [
'code' => '<?php
/** @param \'A\'|\'B\' $k */
function f(string $k): void {
$l = strtolower($k);
if ($l === \'c\') {}
}',
'error_message' => 'DocblockTypeContradiction',
],…of the argument Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Pushed bb13eb6. |
strtolower()andmb_strtolower()of string literals returnnon-empty-lowercase-stringinstead of the lowercased literals.Before
After
Fixes #14258