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
Psalm correctly detects that substr() may lead to an empty string:
Psalm output (using commit [16b24bd](https://github.com/vimeo/psalm/commit/16b24bd)):
INFO: [LessSpecificReturnStatement](https://psalm.dev/129) - 8:12 - The type 'string' is more general than the declared return type 'non-empty-string' for cut_to_4_chars
INFO: [MoreSpecificReturnType](https://psalm.dev/070) - 5:12 - The declared return type 'non-empty-string' for cut_to_4_chars is more specific than the inferred return type 'string'
I'm wondering if it's worth expanding the substr() signature so that it detects the non-empty-string case for a 0 index, and a positive length.
The text was updated successfully, but these errors were encountered:
Psalm output (using commit 16b24bd):
INFO: LessSpecificReturnStatement - 8:12 - The type 'string' is more general than the declared return type 'non-empty-string' for cut_to_4_chars
INFO: MoreSpecificReturnType - 5:12 - The declared return type 'non-empty-string' for cut_to_4_chars is more specific than the inferred return type 'string'
Given following snippet ( https://psalm.dev/r/7528930261 ) :
Psalm correctly detects that
substr()
may lead to an empty string:I'm wondering if it's worth expanding the
substr()
signature so that it detects thenon-empty-string
case for a0
index, and a positive length.The text was updated successfully, but these errors were encountered: