Skip to content
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

DateFunctionReturnTypeExtension: support more precise single-char date-formats #721

Merged
merged 4 commits into from Nov 3, 2021

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Oct 19, 2021

this PR adds Integer-Ranges for the most basic date single-char formats. IMO these are used in the wild rather often, therefore these are worth supporting.

as a followup it would also be great to add support for the formats which contains leading zeros, but these cannot be represented user Integer-Range, I think.
We might instead use unions for those zero-leading formats which only support a countable number of values though - this should be a separate PR though.

@staabm staabm marked this pull request as ready for review October 19, 2021 15:46
@staabm
Copy link
Contributor Author

staabm commented Oct 19, 2021

Doing a bit more research I realized I should rework this to return unions of strings instead

@staabm staabm marked this pull request as draft October 19, 2021 17:15
@staabm staabm marked this pull request as ready for review October 19, 2021 20:00
@staabm
Copy link
Contributor Author

staabm commented Oct 19, 2021

Done - Test failure seems unrelated

@ondrejmirtes
Copy link
Member

Yeah, let's try this, but I worry that I'll have to revert it for some reason or another :) In that case I'd welcome if it returned at least a non-empty-string.

@ondrejmirtes ondrejmirtes merged commit 9beb27e into phpstan:master Nov 3, 2021
@ondrejmirtes
Copy link
Member

Thank you!

@staabm staabm deleted the date branch November 11, 2021 08:44
@staabm
Copy link
Contributor Author

staabm commented Nov 11, 2021

really like that phpstan with this PR tells me that I have a type-mismatch in this case <3

grafik

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants