From 057d95df2121291d75295f977dd741f5d4d00394 Mon Sep 17 00:00:00 2001 From: Henrique Moody Date: Mon, 2 Dec 2024 13:50:38 +0100 Subject: [PATCH] Add support for most recent PHP version --- .github/workflows/continuous-integration.yml | 14 ++++++-------- composer.json | 18 +++++++++--------- src/AbstractDatabase.php | 4 ++-- src/IsoCodesFactory.php | 4 ++-- tests/docker/docker-php-entrypoint | 2 +- 5 files changed, 20 insertions(+), 22 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 1e7d0a2e..0cee7779 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -13,12 +13,10 @@ jobs: strategy: matrix: php-version: - - "7.1" - - "7.2" - - "7.3" - - "7.4" - - "8.0" - "8.1" + - "8.2" + - "8.3" + - "8.4" steps: - uses: actions/checkout@v2 @@ -34,7 +32,7 @@ jobs: - name: Cache Composer packages id: composer-cache - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: vendor key: ${{ runner.os }}-php-composer-${{ matrix.php-version }}-${{ hashFiles('**/composer.lock') }} @@ -91,7 +89,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: "7.4" + php-version: "8.4" ini-values: post_max_size=256M, max_execution_time=180 - name: Install dependencies @@ -102,4 +100,4 @@ jobs: run: composer check-style - name: Run static analyse - run: composer psalm \ No newline at end of file + run: composer psalm diff --git a/composer.json b/composer.json index d99c0b8b..434690a5 100644 --- a/composer.json +++ b/composer.json @@ -9,19 +9,18 @@ } ], "require": { - "php": ">=7.1", + "php": ">=8.1", "ext-json": "*" }, "require-dev": { "ext-gettext": "*", + "php-coveralls/php-coveralls": "^2.7", + "phpmd/phpmd": "^2.15", + "phpunit/phpunit": "^9.6", "sokil/php-isocodes-db-i18n": "^4.0.0", - "phpunit/phpunit": ">=7.5.20", - "php-coveralls/php-coveralls": "^2.1", - "squizlabs/php_codesniffer": "^3.4", - "phpmd/phpmd" : "@stable", - "symfony/translation": "^4.4.17|^5.2", - "vimeo/psalm": "^4.3", - "infection/infection": ">=0.11.5" + "squizlabs/php_codesniffer": "^3.11", + "symfony/translation": "^7.2", + "vimeo/psalm": "^4.30" }, "autoload": { "psr-4": { @@ -53,6 +52,7 @@ "config": { "allow-plugins": { "infection/extension-installer": true - } + }, + "sort-packages": true } } diff --git a/src/AbstractDatabase.php b/src/AbstractDatabase.php index 4ba3af19..86efd692 100644 --- a/src/AbstractDatabase.php +++ b/src/AbstractDatabase.php @@ -50,8 +50,8 @@ abstract class AbstractDatabase implements \Iterator, \Countable * @throws \RuntimeException when base directory not specified and directory can not be located automatically */ public function __construct( - string $baseDirectory = null, - TranslationDriverInterface $translationDriver = null + ?string $baseDirectory = null, + ?TranslationDriverInterface $translationDriver = null ) { if (empty($baseDirectory)) { // Require external database in "sokil/php-isocodes-db-*" packages diff --git a/src/IsoCodesFactory.php b/src/IsoCodesFactory.php index 7e55ce40..fb33cf99 100644 --- a/src/IsoCodesFactory.php +++ b/src/IsoCodesFactory.php @@ -61,8 +61,8 @@ class IsoCodesFactory private $translationDriver; public function __construct( - string $baseDirectory = null, - TranslationDriverInterface $translationDriver = null + ?string $baseDirectory = null, + ?TranslationDriverInterface $translationDriver = null ) { $this->baseDirectory = $baseDirectory; $this->translationDriver = $translationDriver ?? new GettextExtensionDriver(); diff --git a/tests/docker/docker-php-entrypoint b/tests/docker/docker-php-entrypoint index 421f949b..c776d20a 100755 --- a/tests/docker/docker-php-entrypoint +++ b/tests/docker/docker-php-entrypoint @@ -14,4 +14,4 @@ echo "uk_UA.UTF-8 UTF-8" > /etc/locale.gen locale-gen # run tests -/php-isocodes/vendor/bin/phpunit -c /php-isocodes/tests/phpunit.xml /php-isocodes/tests \ No newline at end of file +/php-isocodes/vendor/bin/phpunit /php-isocodes/tests