Improve image related functions signature#3127
Merged
ondrejmirtes merged 1 commit intophpstan:1.11.xfrom Jun 10, 2024
Merged
Conversation
Contributor
thg2k
commented
Jun 5, 2024
- The parameters involving red, green, blue, and alpha are now required to be in the respective allowed range (0-255 for colors and 0-127 for alpha).
- Return values are specified in their possible ranges (0-max for color indexes, and 0-256 for imagecolorstotal()).
- imagecreate() and imagecreatetruecolor() now returns a benevolent union, it can only return false if width x height exceeds INT_MAX, and the size parameters are required to be in the range 1-max.
- imagesx() and imagesy() return value is in the range 1-max and can no longer return false.
- Return type of imagecolorsforindex() now contains the array signature.
Contributor
Author
|
@ondrejmirtes What's the feeling about this? I saw the CI integration errors but not sure how I should handle them. Clearly, restricting the parameters type will break people's SA but it is also true that if those restrictions are not met PHP >= 8.0 throws ValueError exceptions... so I figured that's the whole point of SA. If you are not happy with this I can submit only the return type restrictions, that should cause no problem. |
Member
|
Return type changes: can be in functionMap.php Thanks. |
- The parameters involving red, green, blue, and alpha are now required to be in the respective allowed range (0-255 for colors and 0-127 for alpha) in bleeding edge mode. - Return values are specified in their possible ranges (0-max for color indexes, and 0-256 for imagecolorstotal()). - imagecreate() and imagecreatetruecolor() now returns a benevolent union, it can only return false if width x height exceeds INT_MAX, and the size parameters are required to be in the range 1-max in bleeding edge. - imagesx() and imagesy() return value is in the range 1-max and can no longer return false. - Return type of imagecolorsforindex() now contains the array signature.
Contributor
Author
Seems reasonable! I pushed the rebased change. |
Member
|
Thank you. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.