diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index c7d6f2d..1f43c29 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -16,7 +16,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php: [ "8.2", "8.4" ] + php: [ "8.2", "8.5" ] steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index a4c3e4b..98253eb 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -8,7 +8,7 @@ jobs: strategy: matrix: include: - - php: "8.4" + - php: "8.5" stability: --prefer-stable - php: "8.2" stability: --prefer-lowest @@ -49,7 +49,7 @@ jobs: - name: Run tests run: | - export WITH_COVERAGE=$(if [[ ("${{ matrix.php }}" = "8.4") && ("${{ matrix.stability }}" = "--prefer-stable") ]]; then echo "true"; else echo "false"; fi) + export WITH_COVERAGE=$(if [[ ("${{ matrix.php }}" = "8.5") && ("${{ matrix.stability }}" = "--prefer-stable") ]]; then echo "true"; else echo "false"; fi) echo "WITH_COVERAGE=${WITH_COVERAGE}" >> $GITHUB_ENV make vendor make tests diff --git a/.scrutinizer.yml b/.scrutinizer.yml index b5802ce..8479ec8 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -3,7 +3,7 @@ build: analysis: environment: php: - version: 8.4 + version: 8.5 cache: disabled: false directories: diff --git a/Makefile b/Makefile index 7316c21..1c1f89e 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ DOCKER_COMPOSE ?= docker compose EXEC_PHP = $(DOCKER_COMPOSE) run --rm php -PHP_VERSION ?= 8.4 +PHP_VERSION ?= 8.5 DEPS_STRATEGY ?= --prefer-stable COMPOSER = $(EXEC_PHP) composer WITH_COVERAGE ?= "FALSE" @@ -25,7 +25,7 @@ setup: build .PHONY: build kill setup -PHPUNIT_FLAGS = $(if $(filter 8.4,$(PHP_VERSION)),--display-deprecations,) \ +PHPUNIT_FLAGS = $(if $(filter 8.5,$(PHP_VERSION)),--display-deprecations,) \ $(if $(filter true,$(WITH_COVERAGE)),--coverage-clover clover.xml,) tests: ## Run all tests diff --git a/docker-compose.yml b/docker-compose.yml index 5fe6fe3..e7dd2c7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,10 +1,10 @@ services: php: - image: tigitz/phpspellchecker:${PHP_VERSION:-8.4} + image: tigitz/phpspellchecker:${PHP_VERSION:-8.5} build: context: docker/php args: - PHP_VERSION: ${PHP_VERSION:-8.4} + PHP_VERSION: ${PHP_VERSION:-8.5} volumes: - .:/usr/src/myapp - ./cache:/root/composer/cache diff --git a/docker/php/Dockerfile b/docker/php/Dockerfile index 90dd230..3ad71c8 100644 --- a/docker/php/Dockerfile +++ b/docker/php/Dockerfile @@ -28,14 +28,14 @@ RUN apt-get update \ libpspell-dev RUN pecl channel-update pecl.php.net && \ - pecl install xdebug-3.4.0 && \ + pecl install xdebug-3.5.1 && \ docker-php-ext-enable xdebug -RUN if [ "${PHP_VERSION}" = "8.4" ]; then \ - pecl install pspell; \ - else \ +RUN if [ "${PHP_VERSION}" = "8.2" ] || [ "${PHP_VERSION}" = "8.3" ]; then \ docker-php-ext-configure pspell && \ docker-php-ext-install pspell; \ + else \ + pecl install pspell; \ fi && \ docker-php-ext-enable pspell && \ rm -r /var/lib/apt/lists/* diff --git a/src/Spellchecker/LanguageTool/LanguageToolApiClient.php b/src/Spellchecker/LanguageTool/LanguageToolApiClient.php index 2da4fb5..601cbf5 100644 --- a/src/Spellchecker/LanguageTool/LanguageToolApiClient.php +++ b/src/Spellchecker/LanguageTool/LanguageToolApiClient.php @@ -55,15 +55,14 @@ public function spellCheck(string $text, array $languages, array $options): arra */ public function getSupportedLanguages(): array { - /** @var array */ - return array_values(array_unique(array_column( - $this->requestAPI( - '/v2/languages', - 'GET', - 'Accept: application/json' - ), - 'longCode' - ))); + /** @var array $languages */ + $languages = $this->requestAPI( + '/v2/languages', + 'GET', + 'Accept: application/json' + ); + + return array_values(array_unique(array_column($languages, 'longCode'))); } /** diff --git a/src/Utils/php-functions.php b/src/Utils/php-functions.php index d538f7a..c303102 100644 --- a/src/Utils/php-functions.php +++ b/src/Utils/php-functions.php @@ -59,7 +59,7 @@ function preg_match_all(string $pattern, string $subject, &$matches = [], int $f * * @param-out 0|positive-int $count * - * @return ($subject is array ? list : string) + * @return ($subject is array ? array : string) */ function preg_replace(array|string $pattern, array|string $replacement, array|string $subject, int $limit = -1, ?int &$count = null): array|string {