From 9c3211d89fb6e867ff559636f2d2ba43805f0c3f Mon Sep 17 00:00:00 2001 From: Fabian Grutschus Date: Fri, 2 Feb 2024 13:04:04 +0100 Subject: [PATCH] Added support for PHP 8.3 --- .github/workflows/{static.yml => ci.yml} | 36 +++++++++++++++ .github/workflows/unit.yml | 45 ------------------- README.md | 3 +- composer.json | 4 +- src/Listener/Service/RouteListenerFactory.php | 2 +- ...LanguageTreeRouteStackDelegatorFactory.php | 2 +- .../Service/LanguageRouteOptionsFactory.php | 2 +- .../Helper/Service/LanguageSwitchFactory.php | 2 +- .../Service/RouteListenerFactoryTest.php | 2 +- tests/src/ModuleTest.php | 2 +- ...uageTreeRouteStackDelegatorFactoryTest.php | 2 +- .../LanguageRouteOptionsFactoryTest.php | 2 +- .../Service/LanguageSwitchFactoryTest.php | 2 +- 13 files changed, 48 insertions(+), 58 deletions(-) rename .github/workflows/{static.yml => ci.yml} (51%) delete mode 100644 .github/workflows/unit.yml diff --git a/.github/workflows/static.yml b/.github/workflows/ci.yml similarity index 51% rename from .github/workflows/static.yml rename to .github/workflows/ci.yml index fdb34ba..23c410b 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/ci.yml @@ -34,3 +34,39 @@ jobs: files: "**.php" # you may customize glob as needed phpcs_path: php phpcs.phar standard: phpcs.xml + + unittest: + runs-on: ubuntu-latest + + strategy: + matrix: + php_version: ['7.4', '8.0', '8.1', '8.2', '8.3'] + prefer-lowest: ['', '--prefer-lowest'] + + name: Unit Tests - PHP ${{ matrix.php_version }} ${{ matrix.prefer-lowest }} + + steps: + - uses: actions/checkout@v3 + + - name: Install PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php_version }} + + - name: Validate composer.json and composer.lock + run: composer validate --strict + + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v3 + with: + path: vendor + key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php- + + - name: Install dependencies + run: composer update --prefer-dist --no-progress --with-all-dependencies ${{ matrix.prefer-lowest }} + + - name: Run test suite + run: ./vendor/bin/phpunit --verbose --order-by=random diff --git a/.github/workflows/unit.yml b/.github/workflows/unit.yml deleted file mode 100644 index 4bbc494..0000000 --- a/.github/workflows/unit.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: Unit Tests - -on: - push: - branches: - - '*' - pull_request: - - '*' - -jobs: - unittest: - runs-on: ubuntu-latest - - strategy: - matrix: - php_version: ['7.4', '8.0', '8.1'] - prefer-lowest: ['', '--prefer-lowest'] - - name: Unit Tests - PHP ${{ matrix.php_version }} ${{ matrix.prefer-lowest }} - - steps: - - uses: actions/checkout@v2 - - - name: Install PHP - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php_version }} - - - name: Validate composer.json and composer.lock - run: composer validate --strict - - - name: Cache Composer packages - id: composer-cache - uses: actions/cache@v2 - with: - path: vendor - key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} - restore-keys: | - ${{ runner.os }}-php- - - - name: Install dependencies - run: composer update --prefer-dist --no-progress --with-all-dependencies ${{ matrix.prefer-lowest }} - - - name: Run test suite - run: ./vendor/bin/phpunit --verbose --order-by=random diff --git a/README.md b/README.md index cd0533c..109ef56 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,7 @@ language in the MvcTranslator. [![Latest Stable Version](http://poser.pugx.org/fabiang/laminas-language-route/v)](https://packagist.org/packages/fabiang/laminas-language-route) [![PHP Version Require](http://poser.pugx.org/fabiang/laminas-language-route/require/php)](https://packagist.org/packages/fabiang/laminas-language-route) [![License](http://poser.pugx.org/fabiang/laminas-language-route/license)](https://packagist.org/packages/fabiang/laminas-language-route) -[![Static Code Analysis](https://github.com/fabiang/laminas-language-route/actions/workflows/static.yml/badge.svg)](https://github.com/fabiang/laminas-language-route/actions/workflows/static.yml) -[![Unit Tests](https://github.com/fabiang/laminas-language-route/actions/workflows/unit.yml/badge.svg)](https://github.com/fabiang/laminas-language-route/actions/workflows/unit.yml) +[![Continuous Integration](https://github.com/fabiang/laminas-language-route/actions/workflows/ci.yml/badge.svg)](https://github.com/fabiang/laminas-language-route/actions/workflows/ci.yml) ## Installation diff --git a/composer.json b/composer.json index 3abc730..b61be93 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,7 @@ } }, "require": { - "php": "^7.4 || 8.0.* || 8.1.*", + "php": "^7.4 || 8.0.* || 8.1.* || ~8.2.0 || ~8.3.0", "laminas/laminas-mvc": "^2.7.10 || ^3.0.1", "laminas/laminas-servicemanager": "^3.1", "laminas/laminas-eventmanager": "^3.0.1", @@ -31,7 +31,7 @@ "laminas/laminas-mvc-i18n": "^1.0" }, "require-dev": { - "phpunit/phpunit": "^9.5", + "phpunit/phpunit": "^9.5 || ^10.0", "phpspec/prophecy-phpunit": "^2.0", "vimeo/psalm": "^4.22", "squizlabs/php_codesniffer": "^3.6", diff --git a/src/Listener/Service/RouteListenerFactory.php b/src/Listener/Service/RouteListenerFactory.php index 6cb60a4..e19bd03 100644 --- a/src/Listener/Service/RouteListenerFactory.php +++ b/src/Listener/Service/RouteListenerFactory.php @@ -24,8 +24,8 @@ use Fabiang\LaminasLanguageRoute\Listener\RouteListener; use Fabiang\LaminasLanguageRoute\Options\LanguageRouteOptions; -use Interop\Container\ContainerInterface; use Laminas\ServiceManager\Factory\FactoryInterface; +use Psr\Container\ContainerInterface; final class RouteListenerFactory implements FactoryInterface { diff --git a/src/Mvc/Router/Http/Service/LanguageTreeRouteStackDelegatorFactory.php b/src/Mvc/Router/Http/Service/LanguageTreeRouteStackDelegatorFactory.php index ceab896..30127c8 100644 --- a/src/Mvc/Router/Http/Service/LanguageTreeRouteStackDelegatorFactory.php +++ b/src/Mvc/Router/Http/Service/LanguageTreeRouteStackDelegatorFactory.php @@ -24,9 +24,9 @@ use Fabiang\LaminasLanguageRoute\Mvc\Router\Http\LanguageTreeRouteStack; use Fabiang\LaminasLanguageRoute\Options\LanguageRouteOptions; -use Interop\Container\ContainerInterface; use Laminas\Router\RouteStackInterface; use Laminas\ServiceManager\Factory\DelegatorFactoryInterface; +use Psr\Container\ContainerInterface; final class LanguageTreeRouteStackDelegatorFactory implements DelegatorFactoryInterface { diff --git a/src/Options/Service/LanguageRouteOptionsFactory.php b/src/Options/Service/LanguageRouteOptionsFactory.php index 18791ca..2bcd164 100644 --- a/src/Options/Service/LanguageRouteOptionsFactory.php +++ b/src/Options/Service/LanguageRouteOptionsFactory.php @@ -23,8 +23,8 @@ namespace Fabiang\LaminasLanguageRoute\Options\Service; use Fabiang\LaminasLanguageRoute\Options\LanguageRouteOptions; -use Interop\Container\ContainerInterface; use Laminas\ServiceManager\Factory\FactoryInterface; +use Psr\Container\ContainerInterface; final class LanguageRouteOptionsFactory implements FactoryInterface { diff --git a/src/View/Helper/Service/LanguageSwitchFactory.php b/src/View/Helper/Service/LanguageSwitchFactory.php index 549d988..7c1b353 100644 --- a/src/View/Helper/Service/LanguageSwitchFactory.php +++ b/src/View/Helper/Service/LanguageSwitchFactory.php @@ -24,8 +24,8 @@ use Fabiang\LaminasLanguageRoute\Options\LanguageRouteOptions; use Fabiang\LaminasLanguageRoute\View\Helper\LanguageSwitch; -use Interop\Container\ContainerInterface; use Laminas\ServiceManager\Factory\FactoryInterface; +use Psr\Container\ContainerInterface; final class LanguageSwitchFactory implements FactoryInterface { diff --git a/tests/src/Listener/Service/RouteListenerFactoryTest.php b/tests/src/Listener/Service/RouteListenerFactoryTest.php index 4221da3..10c64b5 100644 --- a/tests/src/Listener/Service/RouteListenerFactoryTest.php +++ b/tests/src/Listener/Service/RouteListenerFactoryTest.php @@ -24,13 +24,13 @@ use Fabiang\LaminasLanguageRoute\Listener\RouteListener; use Fabiang\LaminasLanguageRoute\Options\LanguageRouteOptions; -use Interop\Container\ContainerInterface; use Laminas\Authentication\AuthenticationServiceInterface; use Laminas\I18n\Translator\TranslatorInterface; use Laminas\Router\RouteStackInterface; use Laminas\Stdlib\RequestInterface; use PHPUnit\Framework\TestCase; use Prophecy\PhpUnit\ProphecyTrait; +use Psr\Container\ContainerInterface; /** * @coversDefaultClass \Fabiang\LaminasLanguageRoute\Listener\Service\RouteListenerFactory diff --git a/tests/src/ModuleTest.php b/tests/src/ModuleTest.php index 79ce7a7..2089fae 100644 --- a/tests/src/ModuleTest.php +++ b/tests/src/ModuleTest.php @@ -24,7 +24,6 @@ use Fabiang\LaminasLanguageRoute\Listener\RouteListener; use Fabiang\LaminasLanguageRoute\Mvc\Router\Http\LanguageTreeRouteStack; -use Interop\Container\ContainerInterface; use Laminas\EventManager\EventManagerInterface; use Laminas\EventManager\ListenerAggregateInterface; use Laminas\Mvc\ApplicationInterface; @@ -32,6 +31,7 @@ use PHPUnit\Framework\TestCase; use Prophecy\Argument; use Prophecy\PhpUnit\ProphecyTrait; +use Psr\Container\ContainerInterface; /** * @coversDefaultClass \Fabiang\LaminasLanguageRoute\Module diff --git a/tests/src/Mvc/Router/Http/Service/LanguageTreeRouteStackDelegatorFactoryTest.php b/tests/src/Mvc/Router/Http/Service/LanguageTreeRouteStackDelegatorFactoryTest.php index aabc0d0..d118ab2 100644 --- a/tests/src/Mvc/Router/Http/Service/LanguageTreeRouteStackDelegatorFactoryTest.php +++ b/tests/src/Mvc/Router/Http/Service/LanguageTreeRouteStackDelegatorFactoryTest.php @@ -24,11 +24,11 @@ use Fabiang\LaminasLanguageRoute\Mvc\Router\Http\LanguageTreeRouteStack; use Fabiang\LaminasLanguageRoute\Options\LanguageRouteOptions; -use Interop\Container\ContainerInterface; use Laminas\Authentication\AuthenticationServiceInterface; use Laminas\Router\RouteStackInterface; use PHPUnit\Framework\TestCase; use Prophecy\PhpUnit\ProphecyTrait; +use Psr\Container\ContainerInterface; /** * @coversDefaultClass \Fabiang\LaminasLanguageRoute\Mvc\Router\Http\Service\LanguageTreeRouteStackDelegatorFactory diff --git a/tests/src/Options/Service/LanguageRouteOptionsFactoryTest.php b/tests/src/Options/Service/LanguageRouteOptionsFactoryTest.php index ce29b4a..caed5f1 100644 --- a/tests/src/Options/Service/LanguageRouteOptionsFactoryTest.php +++ b/tests/src/Options/Service/LanguageRouteOptionsFactoryTest.php @@ -23,9 +23,9 @@ namespace Fabiang\LaminasLanguageRoute\Options\Service; use Fabiang\LaminasLanguageRoute\Options\LanguageRouteOptions; -use Interop\Container\ContainerInterface; use PHPUnit\Framework\TestCase; use Prophecy\PhpUnit\ProphecyTrait; +use Psr\Container\ContainerInterface; /** * @coversDefaultClass \Fabiang\LaminasLanguageRoute\Options\Service\LanguageRouteOptionsFactory diff --git a/tests/src/View/Helper/Service/LanguageSwitchFactoryTest.php b/tests/src/View/Helper/Service/LanguageSwitchFactoryTest.php index 3cceece..6ababf8 100644 --- a/tests/src/View/Helper/Service/LanguageSwitchFactoryTest.php +++ b/tests/src/View/Helper/Service/LanguageSwitchFactoryTest.php @@ -24,12 +24,12 @@ use Fabiang\LaminasLanguageRoute\Options\LanguageRouteOptions; use Fabiang\LaminasLanguageRoute\View\Helper\LanguageSwitch; -use Interop\Container\ContainerInterface; use Laminas\Mvc\Application; use Laminas\Mvc\MvcEvent; use Laminas\Router\Http\RouteMatch; use PHPUnit\Framework\TestCase; use Prophecy\PhpUnit\ProphecyTrait; +use Psr\Container\ContainerInterface; /** * @coversDefaultClass \Fabiang\LaminasLanguageRoute\View\Helper\Service\LanguageSwitchFactory