Skip to content

Commit

Permalink
Fix CS
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandre-daubois committed Dec 3, 2024
1 parent c9d2677 commit b1fd95a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/DependencyResolver/Package.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@
use Php\Pie\ExtensionName;
use Php\Pie\ExtensionType;
use Php\Pie\Platform\OperatingSystemFamily;

use Webmozart\Assert\Assert;

use function array_key_exists;
use function array_map;
use function array_slice;
use function explode;
use function implode;
use function parse_url;
use function sprintf;
use function str_contains;
use function str_starts_with;
use function strtolower;
Expand Down Expand Up @@ -75,7 +74,7 @@ public static function fromComposerCompletePackage(CompletePackageInterface $com
? $phpExtOptions['build-path']
: null;

$compatibleOsFamilies = $phpExtOptions['os-families'] ?? null;
$compatibleOsFamilies = $phpExtOptions['os-families'] ?? null;

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

View workflow job for this annotation

GitHub Actions / static-analysis

MixedAssignment

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

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

View workflow job for this annotation

GitHub Actions / static-analysis

InvalidArrayOffset

src/DependencyResolver/Package.php:77:35: 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 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 $incompatibleOsFamilies 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: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) {
Expand Down
4 changes: 2 additions & 2 deletions test/unit/DependencyResolver/PackageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function testFromComposerCompletePackageWithOsFamilies(): void
public function testFromComposerCompletePackageWithEmptyExcludedOsFamilies(): void
{
$composerCompletePackage = new CompletePackage('vendor/foo', '1.2.3.0', '1.2.3');
$composerCompletePackage->setPhpExt(['os-families-exclude' => []]);
$composerCompletePackage->setPhpExt(['os-families-exclude' => null]);

Check failure on line 80 in test/unit/DependencyResolver/PackageTest.php

View workflow job for this annotation

GitHub Actions / static-analysis

InvalidArgument

test/unit/DependencyResolver/PackageTest.php:80:45: InvalidArgument: Argument 1 of Composer\Package\CompletePackage::setPhpExt expects array{'build-path'?: null|string, 'configure-options'?: list<array{description?: string, name: string}>, 'extension-name'?: string, 'support-nts'?: bool, 'support-zts'?: bool, priority?: int}|null, but array{'os-families-exclude': null} with additional array shape fields (os-families-exclude) was provided (see https://psalm.dev/004)

$package = Package::fromComposerCompletePackage($composerCompletePackage);

Expand All @@ -92,7 +92,7 @@ public function testFromComposerCompletePackageWithEmptyExcludedOsFamilies(): vo
public function testFromComposerCompletePackageWithEmptyOsFamilies(): void
{
$composerCompletePackage = new CompletePackage('vendor/foo', '1.2.3.0', '1.2.3');
$composerCompletePackage->setPhpExt(['os-families' => []]);
$composerCompletePackage->setPhpExt(['os-families' => null]);

Check failure on line 95 in test/unit/DependencyResolver/PackageTest.php

View workflow job for this annotation

GitHub Actions / static-analysis

InvalidArgument

test/unit/DependencyResolver/PackageTest.php:95:45: InvalidArgument: Argument 1 of Composer\Package\CompletePackage::setPhpExt expects array{'build-path'?: null|string, 'configure-options'?: list<array{description?: string, name: string}>, 'extension-name'?: string, 'support-nts'?: bool, 'support-zts'?: bool, priority?: int}|null, but array{'os-families': null} with additional array shape fields (os-families) was provided (see https://psalm.dev/004)

$package = Package::fromComposerCompletePackage($composerCompletePackage);

Expand Down

0 comments on commit b1fd95a

Please sign in to comment.