From 93ca74b194ccf4796969525ca5d2e247274e3298 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20FIDRY?= Date: Tue, 12 Mar 2024 21:06:21 +0100 Subject: [PATCH] fix mutation --- src/RequirementChecker/RequirementsBuilder.php | 2 +- tests/RequirementChecker/RequirementsBuilderTest.php | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/RequirementChecker/RequirementsBuilder.php b/src/RequirementChecker/RequirementsBuilder.php index 1cf8a9339..d8a5b4a2d 100644 --- a/src/RequirementChecker/RequirementsBuilder.php +++ b/src/RequirementChecker/RequirementsBuilder.php @@ -138,7 +138,7 @@ static function (array $sources): array { usort( $sources, static fn (array $sourceTypePairA, array $sourceTypePairB) => strcmp( - (string) $sourceTypePairA[0], + $sourceTypePairA[0], (string) $sourceTypePairB[0], ), ); diff --git a/tests/RequirementChecker/RequirementsBuilderTest.php b/tests/RequirementChecker/RequirementsBuilderTest.php index 7331cea88..f98cad507 100644 --- a/tests/RequirementChecker/RequirementsBuilderTest.php +++ b/tests/RequirementChecker/RequirementsBuilderTest.php @@ -68,6 +68,10 @@ public function test_it_can_build_requirements_from_required_extensions(): void new Extension('http'), 'package2', ); + $this->builder->addRequiredExtension( + new Extension('http'), + null, + ); $this->builder->addRequiredExtension( new Extension('phar'), 'package1', @@ -83,6 +87,7 @@ public function test_it_can_build_requirements_from_required_extensions(): void ); $expected = new Requirements([ + Requirement::forRequiredExtension('http', null), Requirement::forRequiredExtension('http', 'package1'), Requirement::forRequiredExtension('http', 'package2'), Requirement::forRequiredExtension('openssl', 'package3'),