Skip to content

Conversation

VincentLanglet
Copy link
Contributor

No description provided.

@VincentLanglet VincentLanglet marked this pull request as ready for review September 26, 2024 21:49
@phpstan-bot
Copy link
Collaborator

This pull request has been marked as ready for review.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this case also need lowercase stuff?

@VincentLanglet VincentLanglet marked this pull request as draft September 27, 2024 07:17
Comment on lines 141 to 152
if ($isLowercase) {
$singlePlaceholderEarlyReturn = new IntersectionType([
new StringType(),
new AccessoryLowercaseStringType(),
new AccessoryNumericStringType(),
]);
} else {
$singlePlaceholderEarlyReturn = new IntersectionType([
new StringType(),
new AccessoryNumericStringType(),
]);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe it would make sense to extract this "if lowercase, add lowercase-type" into a separate method, so you don't need to repeat it over and over

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried b22c45b

@VincentLanglet VincentLanglet marked this pull request as ready for review September 27, 2024 12:37
@phpstan-bot
Copy link
Collaborator

This pull request has been marked as ready for review.

continue;
}

$singlePlaceholderEarlyReturn = $checkArgType->toString();
Copy link
Contributor

@staabm staabm Sep 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder this line is also missing lowercase handling

maybe instead of fiddling with this complex loop and all its paths, just add it once here:

		if ($singlePlaceholderEarlyReturn !== null) {
			return $singlePlaceholderEarlyReturn;
		}

Copy link
Contributor Author

@VincentLanglet VincentLanglet Sep 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I shouldn't add lowercase handling here and just rely on toString.

I'll open a PR to update IntegerType::toString to fix https://phpstan.org/r/79f89e3e-f19f-4a44-bd58-63f3c77db487

@ondrejmirtes ondrejmirtes merged commit 133c60e into phpstan:1.12.x Oct 6, 2024
482 of 500 checks passed
@ondrejmirtes
Copy link
Member

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants