Skip to content

Conversation

@browner12
Copy link
Contributor

version_compare() can be called without a 3rd argument, and return a -1|0|1, or with a 3rd argument and return a boolean. we currently use this function 28 times in the framework:

  • 23 with the 3rd argument
  • 5 without the 3rd argument

this commit standardizes our calls to always use the 3rd argument and return a boolean, which has a couple benefits:

  • consistency
  • slight readability improvement rather than magic numbers (subjective I guess)
  • defensive against operator precedence issues

https://www.php.net/manual/en/function.version-compare.php

`version_compare()` can be called without a 3rd argument, and return a -1|0|1, or with a 3rd argument and return a boolean.  we currently use this function 28 times in the framework:

- 23 with the 3rd argument
- 5 without the 3rd argument

this commit standardizes our calls to ***always*** use the 3rd argument and return a boolean, which has a couple benefits:

- consistency
- slight readability improvement rather than magic numbers (subjective I guess)
- defensive against operator precedence issues

https://www.php.net/manual/en/function.version-compare.php
@taylorotwell taylorotwell merged commit 2a10877 into laravel:12.x Oct 29, 2025
68 checks passed
@browner12 browner12 deleted the AB-standardize-version-compare branch October 29, 2025 14:47
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.

2 participants