-
Notifications
You must be signed in to change notification settings - Fork 509
mb_str_split() / str_split() always returns non-empty-array
#633
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
non-empty-array
'$strSplitConstantStringWithInvalidSplitLengthType', | ||
], | ||
[ | ||
'array<int, string>&nonEmpty', | ||
'$strSplitConstantStringWithVariableStringAndConstantSplitLength', | ||
], | ||
[ | ||
PHP_VERSION_ID < 80000 ? 'array<int, string>|false' : 'array<int, string>', | ||
PHP_VERSION_ID < 80000 ? '(array<int, string>&nonEmpty)|false' : 'array<int, string>&nonEmpty', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
interessting.. sometimes a type including braces is produced, and sometimes without
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
phpstan-src/src/Type/UnionType.php
Lines 150 to 168 in 119facc
$joinTypes = static function (array $types) use ($level): string { | |
$typeNames = []; | |
foreach ($types as $type) { | |
if ($type instanceof ClosureType || $type instanceof CallableType) { | |
$typeNames[] = sprintf('(%s)', $type->describe($level)); | |
} elseif ($type instanceof IntersectionType) { | |
$intersectionDescription = $type->describe($level); | |
if (strpos($intersectionDescription, '&') !== false) { | |
$typeNames[] = sprintf('(%s)', $type->describe($level)); | |
} else { | |
$typeNames[] = $intersectionDescription; | |
} | |
} else { | |
$typeNames[] = $type->describe($level); | |
} | |
} | |
return implode('|', $typeNames); | |
}; |
Call to function is_array() with array<int, string>&nonEmpty will always evaluate to true.
non-empty-array
non-empty-array
@ondrejmirtes fixed remaining php8 error. should be good to go |
Thank you! |
https://3v4l.org/TNDjR
inspired by vimeo/psalm#6324