Skip to content

Commit

Permalink
Simplify os-families/os-families-exclude expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
asgrim authored and alexandre-daubois committed Dec 3, 2024
1 parent 3636bf9 commit c9d2677
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/DependencyResolver/Package.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,8 @@ public static function fromComposerCompletePackage(CompletePackageInterface $com
? $phpExtOptions['build-path']
: null;

$compatibleOsFamilies = $phpExtOptions !== null && array_key_exists('os-families', $phpExtOptions)
? $phpExtOptions['os-families']
: null;

$incompatibleOsFamilies = $phpExtOptions !== null && array_key_exists('os-families-exclude', $phpExtOptions)
? $phpExtOptions['os-families-exclude']
: null;
$compatibleOsFamilies = $phpExtOptions['os-families'] ?? null;

Check failure on line 78 in src/DependencyResolver/Package.php

View workflow job for this annotation

GitHub Actions / static-analysis

MixedAssignment

src/DependencyResolver/Package.php:78:9: MixedAssignment: Unable to determine the type that $compatibleOsFamilies is being assigned to (see https://psalm.dev/032)

Check failure on line 78 in src/DependencyResolver/Package.php

View workflow job for this annotation

GitHub Actions / static-analysis

InvalidArrayOffset

src/DependencyResolver/Package.php:78:33: InvalidArrayOffset: Cannot access value on variable $phpExtOptions using offset value of 'os-families', expecting 'extension-name', 'priority', 'support-zts', 'support-nts', 'build-path' or 'configure-options' (see https://psalm.dev/115)
$incompatibleOsFamilies = $phpExtOptions['os-families-exclude'] ?? null;

Check failure on line 79 in src/DependencyResolver/Package.php

View workflow job for this annotation

GitHub Actions / static-analysis

MixedAssignment

src/DependencyResolver/Package.php:79:9: MixedAssignment: Unable to determine the type that $incompatibleOsFamilies is being assigned to (see https://psalm.dev/032)

Check failure on line 79 in src/DependencyResolver/Package.php

View workflow job for this annotation

GitHub Actions / static-analysis

InvalidArrayOffset

src/DependencyResolver/Package.php:79:35: InvalidArrayOffset: Cannot access value on variable $phpExtOptions using offset value of 'os-families-exclude', expecting 'extension-name', 'priority', 'support-zts', 'support-nts', 'build-path', 'configure-options' or 'os-families' (see https://psalm.dev/115)

if ($compatibleOsFamilies !== null && $incompatibleOsFamilies !== null) {
throw new InvalidArgumentException('Cannot specify both "os-families" and "os-families-exclude" in composer.json');
Expand Down

0 comments on commit c9d2677

Please sign in to comment.