From 82cc054092af23509e8e906ee69b2502cab93960 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20L=C3=BCck?= Date: Tue, 28 Dec 2021 18:22:14 +0100 Subject: [PATCH] Support PHP 8.1 release --- .github/workflows/ci.yml | 1 + bin/phar-composer | 3 +++ phpunit.xml.dist | 3 ++- src/Clue/PharComposer/Package/Bundle.php | 1 + tests/Command/SearchTest.php | 1 + 5 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fb6e40c..063d6dd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,6 +11,7 @@ jobs: strategy: matrix: php: + - 8.1 - 8.0 - 7.4 - 7.3 diff --git a/bin/phar-composer b/bin/phar-composer index ee0d171..5bbbcde 100755 --- a/bin/phar-composer +++ b/bin/phar-composer @@ -10,5 +10,8 @@ if (file_exists(__DIR__ . '/../vendor/autoload.php')) { exit(1); } +// hide PHP 8.1 deprecations +error_reporting(E_ALL & ~E_DEPRECATED); + $app = new Clue\PharComposer\App(); $app->run(); diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 3bea625..8c8b3ae 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -5,7 +5,8 @@ xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd" bootstrap="tests/bootstrap.php" cacheResult="false" - colors="true"> + colors="true" + convertDeprecationsToExceptions="true"> ./tests/ diff --git a/src/Clue/PharComposer/Package/Bundle.php b/src/Clue/PharComposer/Package/Bundle.php index aa96392..d2547b5 100644 --- a/src/Clue/PharComposer/Package/Bundle.php +++ b/src/Clue/PharComposer/Package/Bundle.php @@ -86,6 +86,7 @@ private function directoryContains(Finder $dir, $resource) * * @return \Traversable */ + #[\ReturnTypeWillChange] public function getIterator() { return new \ArrayIterator($this->resources); diff --git a/tests/Command/SearchTest.php b/tests/Command/SearchTest.php index 22543b5..705ca8c 100644 --- a/tests/Command/SearchTest.php +++ b/tests/Command/SearchTest.php @@ -117,6 +117,7 @@ public function testExecuteWithProjectAndSearchReturnsOneMatchWillAskForProject( $packager = $this->getMockBuilder('Clue\PharComposer\Phar\Packager')->getMock(); $result = $this->getMockBuilder('Packagist\Api\Result\Result')->getMock(); + $result->expects($this->exactly(2))->method('getName')->willReturn('foo/bar'); $packagist = $this->getMockBuilder('Packagist\Api\Client')->getMock(); $packagist->expects($this->once())->method('search')->with('foo')->willReturn(array($result));