-
Notifications
You must be signed in to change notification settings - Fork 0
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
Make (in)compatible OS families non-empty-list or a nullable to express intent better #2
Make (in)compatible OS families non-empty-list or a nullable to express intent better #2
Conversation
@@ -74,17 +75,15 @@ public static function fromComposerCompletePackage(CompletePackageInterface $com | |||
? $phpExtOptions['build-path'] | |||
: null; | |||
|
|||
/** @var list<string> $compatibleOsFamilies */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are not necessary; we need upstream Composer support first
|
||
/** @var list<string> $incompatibleOsFamilies */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
if ($input === null) { | ||
return null; | ||
} | ||
|
||
$osFamilies = []; | ||
foreach ($input as $value) { | ||
// try to normalize a bit the input | ||
$valueToTry = ucfirst(strtolower($value)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Proposed enhancement to your PR php#116