Make (in)compatible OS families non-empty-list or a nullable to express intent better#2
Merged
alexandre-daubois merged 2 commits intoalexandre-daubois:os-composer-jsonfrom Dec 3, 2024
Conversation
asgrim
commented
Nov 28, 2024
| ? $phpExtOptions['build-path'] | ||
| : null; | ||
|
|
||
| /** @var list<string> $compatibleOsFamilies */ |
Author
There was a problem hiding this comment.
These are not necessary; we need upstream Composer support first
| : []; | ||
| : null; | ||
|
|
||
| /** @var list<string> $incompatibleOsFamilies */ |
Author
There was a problem hiding this comment.
These are not necessary; we need upstream Composer support first
| * @param list<OperatingSystemFamily> $compatibleOsFamilies | ||
| * @param list<OperatingSystemFamily> $incompatibleOsFamilies | ||
| * @param list<ConfigureOption> $configureOptions | ||
| * @param non-empty-list<OperatingSystemFamily>|null $compatibleOsFamilies |
Author
There was a problem hiding this comment.
The key change here is that the OS families can either be null (explicitly not specified in php-ext), or a non-empty-list; I think this helps express intent better, otherwise, maybe someone could try:
"os-families": []
which does not make sense
| $osFamilies = []; | ||
| foreach ($input as $value) { | ||
| // try to normalize a bit the input | ||
| $valueToTry = ucfirst(strtolower($value)); |
Author
There was a problem hiding this comment.
One improvement I didn't do, but I think it could make sense to always lowercase (including the enum values), to avoid case sensitivity nonsense, as this approach isn't flawless.
Seldaek
reviewed
Nov 28, 2024
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.
Proposed enhancement to your PR php#116