[6.x] Update 'windows_os()' helper to use PHP_OS_FAMILY #30660
Merged
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.
Originally opened against
7.x
, see #30658.Since Laravel 6+ depends on PHP 7.2 or later, the
PHP_OS_FAMILY
constant is available.Whereas the
PHP_OS
constant can beWINNT
,WIN32
,Windows
, etc., thePHP_OS_FAMILY
will always beWindows
if PHP is built for Windows (and has a predefined list of available values).The performance of
PHP_OS_FAMILY
is a micro-optimisation, compared to the existingPHP_OS
usage (except for on PHP 7.1, which isn't supported by Laravel 6), but it seems to be handled better when used in iterations. However, the existing method works fine, so I understand this probably won't be merged. I'd be interested to hear peoples opinions on using this over the older method. 👍I've tested this in Windows, Windows Subsystem for Linux (WSL), MinGW, MacOS, and Ubuntu.