From d27ffece10d21f7f4752d4966a2f653348ee60db Mon Sep 17 00:00:00 2001 From: Devin Beeuwkes <46448173+DevinCodes@users.noreply.github.com> Date: Mon, 6 Feb 2023 09:27:02 +0100 Subject: [PATCH] feat: Laravel 10 support (#320) * feat: add support for Laravel 10 * fix: remove support for PHP 8.0 * fix: force yes when adding repo * chore: update testbench dependency * Update composer.json * Update phpstan.neon.dist * chore: drop Laravel 8 support * chore: change dispatch function call * chore: drop PHP 7.x support --- .circleci/config.yml | 10 +++++----- composer.json | 18 +++++++++--------- phpstan.neon.dist | 2 -- src/Engines/AlgoliaEngine.php | 4 ++-- src/Jobs/UpdateJob.php | 2 +- 5 files changed, 17 insertions(+), 19 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4e772b2..3c1f737 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -70,7 +70,7 @@ jobs: steps: - checkout - - run: sudo add-apt-repository ppa:ondrej/php + - run: sudo add-apt-repository ppa:ondrej/php -y - run: sudo apt-get update - run: sudo apt-get install -y php<>-zip php<>-sqlite3 - restore_cache: *restore_cache @@ -85,10 +85,10 @@ workflows: - test: matrix: parameters: - version: ['7.3', '7.4', '8.0', '8.1'] - laravel: ['^8.0'] + version: ['8.0', '8.1', '8.2'] + laravel: ['^9.0'] - test: matrix: parameters: - version: ['8.0', '8.1'] - laravel: ['^9.0'] + version: ['8.1', '8.2'] + laravel: ['^10.0'] diff --git a/composer.json b/composer.json index 8b7f9d9..ada0fc8 100644 --- a/composer.json +++ b/composer.json @@ -14,15 +14,15 @@ } ], "require": { - "php": "^7.3|^8.0", + "php": "^8.0", "ext-json": "*", "algolia/algoliasearch-client-php": "^3.0.0", - "illuminate/console": "^8.0|^9.0", - "illuminate/contracts": "^8.0|^9.0", - "illuminate/database": "^8.0|^9.0", - "illuminate/filesystem": "^8.0|^9.0", - "illuminate/support": "^8.0|^9.0", - "laravel/scout": "^8.0|^9.0", + "illuminate/console": "^9.0|^10.0", + "illuminate/contracts": "^9.0|^10.0", + "illuminate/database": "^9.0|^10.0", + "illuminate/filesystem": "^9.0|^10.0", + "illuminate/support": "^9.0|^10.0", + "laravel/scout": "^9.0|^10.0", "riimu/kit-phpencoder": "^2.4" }, "suggest": { @@ -31,8 +31,8 @@ "require-dev": { "fakerphp/faker": "^1.13", "mockery/mockery": "^1.4", - "nunomaduro/larastan": "^1.0", - "orchestra/testbench": "^4.9|^5.9|^6.6|^7.0", + "nunomaduro/larastan": "^1.0|^2.0", + "orchestra/testbench": "^4.9|^5.9|^6.6|^7.0|^8.0", "phpstan/phpstan": "^1.3", "phpunit/phpunit": "^8.0|^9.0", "laravel/legacy-factories": "^1.1" diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 69a0a80..cc452f0 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -9,5 +9,3 @@ parameters: - '#Illuminate\\Database\\Eloquent\\Model::searchableAs\(\)#' - '#Algolia\\ScoutExtended\\ScoutExtendedServiceProvider::getModel\(\)#' - '#Unsafe usage of new static#' - - '#Call to an undefined method Illuminate\\Support\\Collection::searchable\(\).#' - - '#Call to an undefined method Illuminate\\Support\\Collection::unsearchable\(\).#' diff --git a/src/Engines/AlgoliaEngine.php b/src/Engines/AlgoliaEngine.php index b57f3bd..c056f03 100644 --- a/src/Engines/AlgoliaEngine.php +++ b/src/Engines/AlgoliaEngine.php @@ -69,7 +69,7 @@ public function getClient(): SearchClient */ public function update($searchables) { - dispatch_now(new UpdateJob($searchables)); + dispatch_sync(new UpdateJob($searchables)); } /** @@ -77,7 +77,7 @@ public function update($searchables) */ public function delete($searchables) { - dispatch_now(new DeleteJob($searchables)); + dispatch_sync(new DeleteJob($searchables)); } /** diff --git a/src/Jobs/UpdateJob.php b/src/Jobs/UpdateJob.php index 238a7b2..b39bdd7 100644 --- a/src/Jobs/UpdateJob.php +++ b/src/Jobs/UpdateJob.php @@ -135,7 +135,7 @@ public function handle(SearchClient $client): void } } - dispatch_now(new DeleteJob(collect($searchablesToDelete))); + dispatch_sync(new DeleteJob(collect($searchablesToDelete))); $result = $index->saveObjects($objectsToSave); if (config('scout.synchronous', false)) {