From f913a16c7dd8648d117c9bd0455d40ed8c422e7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Burak=20=C3=87ak=C4=B1rel?= Date: Mon, 9 Mar 2020 00:39:41 +0300 Subject: [PATCH 01/17] Update Laravel Scout and its dependencies --- README.md | 4 ++-- composer.json | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 555af767..f0194998 100644 --- a/README.md +++ b/README.md @@ -38,8 +38,8 @@ Don't forget to :star: the package if you like it. :pray: ## :warning: Requirements -- PHP version >= 7.1.3 -- Laravel Framework version >= 5.6 +- PHP version >= 7.2.0 +- Laravel Framework version >= 6.0.0 | Elasticsearch version | ElasticsearchDSL version | | --------------------- | --------------------------- | diff --git a/composer.json b/composer.json index 4841233d..836d64c8 100644 --- a/composer.json +++ b/composer.json @@ -17,17 +17,17 @@ } ], "require": { - "php": "^7.1.3", + "php": "^7.2", "elasticsearch/elasticsearch": ">=7.2", - "laravel/scout": "^6.1.1|^7.0", + "laravel/scout": "^8.0", "ongr/elasticsearch-dsl": "^7.0" }, "require-dev": { "fzaninotto/faker": "^1.8", - "phpstan/phpstan": "^0.11", - "orchestra/testbench": "^3.0", - "phpunit/phpunit": "^7.4", - "illuminate/support": "5.6.*|5.7.*|5.8.*", + "phpstan/phpstan": "^0.12", + "orchestra/testbench": "^4.0|^5.0", + "phpunit/phpunit": "^8.0|^9.0", + "illuminate/support": "^6.0|^7.0", "nunomaduro/larastan": "~0.3", "nette/bootstrap": "^2.4.6" }, From f93e20720be66ca464fd287e04f2b3fe6536cefa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Burak=20=C3=87ak=C4=B1rel?= Date: Mon, 9 Mar 2020 00:44:04 +0300 Subject: [PATCH 02/17] Remove PHP 7.1 dependency from travis --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index f82d302e..c354ff50 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,6 @@ env: - ELASTICSEARCH_BUILD=7.1.1-amd64.deb ELASTICSEARCH_HOST=localhost:9200 DB_DATABASE=scout_database DB_USERNAME=travis DB_PASSWORD="" php: - - 7.1 - 7.2 - 7.3 - nightly From 6a8f53776ee5e478602c54a618fb5519585f35c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Burak=20=C3=87ak=C4=B1rel?= Date: Mon, 9 Mar 2020 03:51:50 +0300 Subject: [PATCH 03/17] Fix phpstan errors --- phpstan.neon.dist | 1 + src/Console/Commands/ImportCommand.php | 7 ++++--- src/Console/Commands/ProgressBarFactory.php | 3 ++- src/Database/Scopes/ChunkScope.php | 2 +- .../EloquentHitsIteratorAggregate.php | 2 +- .../Params/Indices/Alias/Get.php | 2 +- .../Params/Indices/Alias/Update.php | 4 ++-- src/Engines/ElasticSearchEngine.php | 2 +- src/Jobs/ImportStages.php | 2 +- src/Jobs/QueueableJob.php | 2 +- .../Stages/SwitchToNewAndRemoveOldIndex.php | 2 +- src/ProgressReportable.php | 5 ++++- src/Searchable/DefaultImportSource.php | 20 +++++++++++++++---- src/Searchable/ImportSource.php | 15 ++++++++++---- src/Searchable/SearchableListFactory.php | 3 +++ 15 files changed, 50 insertions(+), 22 deletions(-) diff --git a/phpstan.neon.dist b/phpstan.neon.dist index d20fdfcf..879cc7b8 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -5,6 +5,7 @@ parameters: paths: - src reportUnmatchedIgnoredErrors: false + checkMissingIterableValueType: false ignoreErrors: - path: %currentWorkingDirectory%/src/Engines/ElasticSearchEngine.php diff --git a/src/Console/Commands/ImportCommand.php b/src/Console/Commands/ImportCommand.php index bd5c927a..18c8656a 100644 --- a/src/Console/Commands/ImportCommand.php +++ b/src/Console/Commands/ImportCommand.php @@ -5,6 +5,7 @@ namespace Matchish\ScoutElasticSearch\Console\Commands; use Illuminate\Console\Command; +use Illuminate\Support\Collection; use Matchish\ScoutElasticSearch\Jobs\Import; use Matchish\ScoutElasticSearch\Jobs\QueueableJob; use Matchish\ScoutElasticSearch\Searchable\ImportSource; @@ -27,13 +28,13 @@ final class ImportCommand extends Command */ public function handle(): void { - $this->searchableList($this->argument('searchable')) + $this->searchableList((array) $this->argument('searchable')) ->each(function ($searchable) { $this->import($searchable); }); } - private function searchableList($argument) + private function searchableList(array $argument): Collection { return collect($argument)->whenEmpty(function () { $factory = new SearchableListFactory(app()->getNamespace(), app()->path()); @@ -42,7 +43,7 @@ private function searchableList($argument) }); } - private function import($searchable) + private function import(string $searchable): void { $sourceFactory = app(ImportSourceFactory::class); $source = $sourceFactory::from($searchable); diff --git a/src/Console/Commands/ProgressBarFactory.php b/src/Console/Commands/ProgressBarFactory.php index 531379c1..e9bbcd90 100644 --- a/src/Console/Commands/ProgressBarFactory.php +++ b/src/Console/Commands/ProgressBarFactory.php @@ -2,6 +2,7 @@ namespace Matchish\ScoutElasticSearch\Console\Commands; +use Symfony\Component\Console\Helper\ProgressBar; use Symfony\Component\Console\Style\OutputStyle; class ProgressBarFactory @@ -19,7 +20,7 @@ public function __construct(OutputStyle $output) $this->output = $output; } - public function create(int $max = 0) + public function create(int $max = 0): ProgressBar { $bar = $this->output->createProgressBar($max); $bar->setBarCharacter('⚬'); diff --git a/src/Database/Scopes/ChunkScope.php b/src/Database/Scopes/ChunkScope.php index 68835cb4..08d4cc7e 100644 --- a/src/Database/Scopes/ChunkScope.php +++ b/src/Database/Scopes/ChunkScope.php @@ -48,7 +48,7 @@ public function apply(Builder $builder, Model $model) }); } - public function key() + public function key(): string { return static::class; } diff --git a/src/ElasticSearch/EloquentHitsIteratorAggregate.php b/src/ElasticSearch/EloquentHitsIteratorAggregate.php index d42b38d1..ea8997e5 100644 --- a/src/ElasticSearch/EloquentHitsIteratorAggregate.php +++ b/src/ElasticSearch/EloquentHitsIteratorAggregate.php @@ -65,6 +65,6 @@ public function getIterator() })->filter()->all(); } - return new \ArrayIterator($hits); + return new \ArrayIterator((array) $hits); } } diff --git a/src/ElasticSearch/Params/Indices/Alias/Get.php b/src/ElasticSearch/Params/Indices/Alias/Get.php index 68e148ce..0d6ffbac 100644 --- a/src/ElasticSearch/Params/Indices/Alias/Get.php +++ b/src/ElasticSearch/Params/Indices/Alias/Get.php @@ -38,7 +38,7 @@ public function toArray() ]; } - public static function anyIndex($alias) + public static function anyIndex(string $alias): Get { return new static($alias, '*'); } diff --git a/src/ElasticSearch/Params/Indices/Alias/Update.php b/src/ElasticSearch/Params/Indices/Alias/Update.php index 35d57c62..684f689e 100644 --- a/src/ElasticSearch/Params/Indices/Alias/Update.php +++ b/src/ElasticSearch/Params/Indices/Alias/Update.php @@ -32,7 +32,7 @@ public function toArray(): array ]; } - public function add(string $index, string $alias) + public function add(string $index, string $alias): void { $this->actions[] = ['add' => [ 'index' => $index, @@ -40,7 +40,7 @@ public function add(string $index, string $alias) ]]; } - public function removeIndex($index) + public function removeIndex(string $index): void { $this->actions[] = ['remove_index' => ['index' => $index]]; } diff --git a/src/Engines/ElasticSearchEngine.php b/src/Engines/ElasticSearchEngine.php index 5f2b83ea..fa3813b2 100644 --- a/src/Engines/ElasticSearchEngine.php +++ b/src/Engines/ElasticSearchEngine.php @@ -141,7 +141,7 @@ private function performSearch(BaseBuilder $builder, $options = []) $searchBody ); } - /** @var Searchable $model */ + $model = $builder->model; $indexName = $builder->index ?: $model->searchableAs(); $params = new SearchParams($indexName, $searchBody->toArray()); diff --git a/src/Jobs/ImportStages.php b/src/Jobs/ImportStages.php index 576486d6..e3a50300 100644 --- a/src/Jobs/ImportStages.php +++ b/src/Jobs/ImportStages.php @@ -21,7 +21,7 @@ public static function fromSource(ImportSource $source) { $index = Index::fromSource($source); - return (new static([ + return (new self([ new CleanUp($source), new CreateWriteIndex($source, $index), PullFromSource::chunked($source), diff --git a/src/Jobs/QueueableJob.php b/src/Jobs/QueueableJob.php index 8d4c9564..027ab896 100644 --- a/src/Jobs/QueueableJob.php +++ b/src/Jobs/QueueableJob.php @@ -11,7 +11,7 @@ class QueueableJob implements ShouldQueue use Queueable; use ProgressReportable; - public function handle() + public function handle(): void { } } diff --git a/src/Jobs/Stages/SwitchToNewAndRemoveOldIndex.php b/src/Jobs/Stages/SwitchToNewAndRemoveOldIndex.php index 05b726de..7e0b4e0d 100644 --- a/src/Jobs/Stages/SwitchToNewAndRemoveOldIndex.php +++ b/src/Jobs/Stages/SwitchToNewAndRemoveOldIndex.php @@ -41,7 +41,7 @@ public function handle(Client $elasticsearch): void $params = new Update(); foreach ($response as $indexName => $alias) { if ($indexName != $this->index->name()) { - $params->removeIndex($indexName); + $params->removeIndex((string) $indexName); } else { $params->add((string) $indexName, $source->searchableAs()); } diff --git a/src/ProgressReportable.php b/src/ProgressReportable.php index 37e512d8..f240030c 100644 --- a/src/ProgressReportable.php +++ b/src/ProgressReportable.php @@ -7,9 +7,12 @@ trait ProgressReportable { + /** + * @var ProgressBar + */ private $progressBar; - public function withProgressReport(ProgressBar $progressBar) + public function withProgressReport(ProgressBar $progressBar): void { $this->progressBar = $progressBar; } diff --git a/src/Searchable/DefaultImportSource.php b/src/Searchable/DefaultImportSource.php index c7c71b58..bf74759b 100644 --- a/src/Searchable/DefaultImportSource.php +++ b/src/Searchable/DefaultImportSource.php @@ -2,13 +2,22 @@ namespace Matchish\ScoutElasticSearch\Searchable; +use Illuminate\Database\Eloquent\Builder; +use Illuminate\Database\Eloquent\Collection as EloquentCollection; use Matchish\ScoutElasticSearch\Database\Scopes\PageScope; +use Illuminate\Support\Collection; final class DefaultImportSource implements ImportSource { const DEFAULT_CHUNK_SIZE = 500; + /** + * @var string + */ private $className; + /** + * @var array + */ private $scopes; /** @@ -22,12 +31,12 @@ public function __construct(string $className, array $scopes = []) $this->scopes = $scopes; } - public function syncWithSearchUsingQueue() + public function syncWithSearchUsingQueue(): ?string { return $this->model()->syncWithSearchUsingQueue(); } - public function syncWithSearchUsing() + public function syncWithSearchUsing(): ?string { return $this->model()->syncWithSearchUsing(); } @@ -37,7 +46,7 @@ public function searchableAs(): string return $this->model()->searchableAs(); } - public function chunked() + public function chunked(): Collection { $query = $this->newQuery(); $totalSearchables = $query->count(); @@ -63,7 +72,7 @@ private function model() return new $this->className; } - private function newQuery() + private function newQuery(): Builder { $query = $this->model()->newQuery(); $softDelete = $this->className::usesSoftDelete() && config('scout.soft_delete', false); @@ -81,6 +90,9 @@ private function newQuery() }, $query); } + /** + * @return Builder[]|EloquentCollection + */ public function get() { return $this->newQuery()->get(); diff --git a/src/Searchable/ImportSource.php b/src/Searchable/ImportSource.php index 73e9cd0d..c5b65de8 100644 --- a/src/Searchable/ImportSource.php +++ b/src/Searchable/ImportSource.php @@ -2,15 +2,22 @@ namespace Matchish\ScoutElasticSearch\Searchable; +use Illuminate\Database\Eloquent\Builder; +use Illuminate\Database\Eloquent\Collection as EloquentCollection; +use Illuminate\Support\Collection; + interface ImportSource { - public function syncWithSearchUsingQueue(); + public function syncWithSearchUsingQueue(): ?string; - public function syncWithSearchUsing(); + public function syncWithSearchUsing(): ?string; - public function searchableAs(); + public function searchableAs(): string; - public function chunked(); + public function chunked(): Collection; + /** + * @return Builder[]|EloquentCollection + */ public function get(); } diff --git a/src/Searchable/SearchableListFactory.php b/src/Searchable/SearchableListFactory.php index ad3fecb5..d3456555 100644 --- a/src/Searchable/SearchableListFactory.php +++ b/src/Searchable/SearchableListFactory.php @@ -12,6 +12,9 @@ final class SearchableListFactory { + /** + * @var array + */ private static $declaredClasses; /** * @var string From 0db14aabdf55e2fc02d3c8092d14a1cc9283a4d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Burak=20=C3=87ak=C4=B1rel?= Date: Mon, 9 Mar 2020 15:12:00 +0300 Subject: [PATCH 04/17] Remove unnecessary packages --- composer.json | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 836d64c8..59808ca4 100644 --- a/composer.json +++ b/composer.json @@ -24,12 +24,10 @@ }, "require-dev": { "fzaninotto/faker": "^1.8", - "phpstan/phpstan": "^0.12", "orchestra/testbench": "^4.0|^5.0", "phpunit/phpunit": "^8.0|^9.0", "illuminate/support": "^6.0|^7.0", - "nunomaduro/larastan": "~0.3", - "nette/bootstrap": "^2.4.6" + "nunomaduro/larastan": "~0.5" }, "autoload-dev": { "psr-4": { From 1f6d2561ebf5a7c578bd75fc85fe18f1d6398e68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Burak=20=C3=87ak=C4=B1rel?= Date: Tue, 10 Mar 2020 13:19:37 +0300 Subject: [PATCH 05/17] Fix "Ternary operator condition is always true" phpstan error --- src/ProgressReportable.php | 2 +- src/Searchable/DefaultImportSource.php | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/ProgressReportable.php b/src/ProgressReportable.php index f240030c..480fdb9a 100644 --- a/src/ProgressReportable.php +++ b/src/ProgressReportable.php @@ -19,6 +19,6 @@ public function withProgressReport(ProgressBar $progressBar): void private function progressBar(): ProgressBar { - return $this->progressBar ?: new ProgressBar(new NullOutput()); + return $this->progressBar; } } diff --git a/src/Searchable/DefaultImportSource.php b/src/Searchable/DefaultImportSource.php index bf74759b..150a166b 100644 --- a/src/Searchable/DefaultImportSource.php +++ b/src/Searchable/DefaultImportSource.php @@ -90,9 +90,6 @@ private function newQuery(): Builder }, $query); } - /** - * @return Builder[]|EloquentCollection - */ public function get() { return $this->newQuery()->get(); From af1ea7df263ea77e35d5149b88f904398f9a5e5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Burak=20=C3=87ak=C4=B1rel?= Date: Tue, 10 Mar 2020 14:04:59 +0300 Subject: [PATCH 06/17] Fix SytleCI issues --- src/Engines/ElasticSearchEngine.php | 12 +++++++----- src/ProgressReportable.php | 1 - src/Searchable/DefaultImportSource.php | 3 +-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Engines/ElasticSearchEngine.php b/src/Engines/ElasticSearchEngine.php index fa3813b2..c29936de 100644 --- a/src/Engines/ElasticSearchEngine.php +++ b/src/Engines/ElasticSearchEngine.php @@ -6,7 +6,6 @@ use Illuminate\Database\Eloquent\Collection; use Laravel\Scout\Builder as BaseBuilder; use Laravel\Scout\Engines\Engine; -use Laravel\Scout\Searchable; use Matchish\ScoutElasticSearch\ElasticSearch\HitsIteratorAggregate; use Matchish\ScoutElasticSearch\ElasticSearch\Params\Bulk; use Matchish\ScoutElasticSearch\ElasticSearch\Params\Indices\Refresh; @@ -107,10 +106,13 @@ public function mapIds($results) */ public function map(BaseBuilder $builder, $results, $model) { - $hits = app()->makeWith(HitsIteratorAggregate::class, - ['results' => $results, - 'callback' => $builder->queryCallback, - ]); + $hits = app()->makeWith( + HitsIteratorAggregate::class, + [ + 'results' => $results, + 'callback' => $builder->queryCallback, + ] + ); return new Collection($hits); } diff --git a/src/ProgressReportable.php b/src/ProgressReportable.php index 480fdb9a..aa700ba1 100644 --- a/src/ProgressReportable.php +++ b/src/ProgressReportable.php @@ -3,7 +3,6 @@ namespace Matchish\ScoutElasticSearch; use Symfony\Component\Console\Helper\ProgressBar; -use Symfony\Component\Console\Output\NullOutput; trait ProgressReportable { diff --git a/src/Searchable/DefaultImportSource.php b/src/Searchable/DefaultImportSource.php index 150a166b..9c0422ba 100644 --- a/src/Searchable/DefaultImportSource.php +++ b/src/Searchable/DefaultImportSource.php @@ -3,9 +3,8 @@ namespace Matchish\ScoutElasticSearch\Searchable; use Illuminate\Database\Eloquent\Builder; -use Illuminate\Database\Eloquent\Collection as EloquentCollection; -use Matchish\ScoutElasticSearch\Database\Scopes\PageScope; use Illuminate\Support\Collection; +use Matchish\ScoutElasticSearch\Database\Scopes\PageScope; final class DefaultImportSource implements ImportSource { From 6fe320f71fd80a7b9f46c7943b0b8db58330c234 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Burak=20=C3=87ak=C4=B1rel?= Date: Tue, 10 Mar 2020 22:06:07 +0300 Subject: [PATCH 07/17] Add "null" type for progressBar property in ProgressReportable class --- src/ProgressReportable.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ProgressReportable.php b/src/ProgressReportable.php index aa700ba1..b1af0103 100644 --- a/src/ProgressReportable.php +++ b/src/ProgressReportable.php @@ -3,11 +3,12 @@ namespace Matchish\ScoutElasticSearch; use Symfony\Component\Console\Helper\ProgressBar; +use Symfony\Component\Console\Output\NullOutput; trait ProgressReportable { /** - * @var ProgressBar + * @var ProgressBar|null */ private $progressBar; @@ -18,6 +19,6 @@ public function withProgressReport(ProgressBar $progressBar): void private function progressBar(): ProgressBar { - return $this->progressBar; + return $this->progressBar ?: new ProgressBar(new NullOutput()); } } From 112b20d0dbb1795fa3522537b91d40aa4d7aaec3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Burak=20=C3=87ak=C4=B1rel?= Date: Wed, 11 Mar 2020 11:11:40 +0300 Subject: [PATCH 08/17] Change PHP version to 7.3 for Scrutinizer --- .scrutinizer.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.scrutinizer.yml b/.scrutinizer.yml index 4f0a98a5..ca28025d 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -10,7 +10,7 @@ filter: build: environment: php: - version: '7.2' + version: '7.3' variables: ELASTICSEARCH_HOST: 'localhost:9200' DB_HOST: '127.0.0.1' From 4462b333cf6e6144faa3c0fe6e0bfadebbb06a1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Burak=20=C3=87ak=C4=B1rel?= Date: Wed, 11 Mar 2020 18:24:20 +0300 Subject: [PATCH 09/17] Fix phpstan error and warning --- phpstan.neon.dist | 2 +- src/Searchable/DefaultImportSource.php | 8 ++++++-- src/Searchable/ImportSource.php | 6 +----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 879cc7b8..8422a749 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -12,7 +12,7 @@ parameters: message: '#Call to an undefined method Illuminate\\Database\\Eloquent\\Model::searchableAs\(\)\.#' - path: %currentWorkingDirectory%/src/Engines/ElasticSearchEngine.php - message: '#message.*ServerErrorResponseException constructor expects string, string|false given.#' + message: '#message.*ServerErrorResponseException constructor expects string, string\|false given.#' - path: %currentWorkingDirectory%/src/Engines/ElasticSearchEngine.php message: '#Parameter \#2 \$search of function array_key_exists expects array, array\|\(callable\) given\.#' diff --git a/src/Searchable/DefaultImportSource.php b/src/Searchable/DefaultImportSource.php index 9c0422ba..9dee9b21 100644 --- a/src/Searchable/DefaultImportSource.php +++ b/src/Searchable/DefaultImportSource.php @@ -3,6 +3,7 @@ namespace Matchish\ScoutElasticSearch\Searchable; use Illuminate\Database\Eloquent\Builder; +use Illuminate\Database\Eloquent\Collection as EloquentCollection; use Illuminate\Support\Collection; use Matchish\ScoutElasticSearch\Database\Scopes\PageScope; @@ -89,8 +90,11 @@ private function newQuery(): Builder }, $query); } - public function get() + public function get(): EloquentCollection { - return $this->newQuery()->get(); + /** @var EloquentCollection $models */ + $models = $this->newQuery()->get(); + + return $models; } } diff --git a/src/Searchable/ImportSource.php b/src/Searchable/ImportSource.php index c5b65de8..874fdb53 100644 --- a/src/Searchable/ImportSource.php +++ b/src/Searchable/ImportSource.php @@ -2,7 +2,6 @@ namespace Matchish\ScoutElasticSearch\Searchable; -use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Collection as EloquentCollection; use Illuminate\Support\Collection; @@ -16,8 +15,5 @@ public function searchableAs(): string; public function chunked(): Collection; - /** - * @return Builder[]|EloquentCollection - */ - public function get(); + public function get(): EloquentCollection; } From 837ff355f39c8ea35e2f15262c97930c58816e8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Burak=20=C3=87ak=C4=B1rel?= Date: Thu, 12 Mar 2020 12:06:44 +0300 Subject: [PATCH 10/17] Update version --- CHANGELOG.md | 4 ++++ composer.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 523c3d5a..6bad89bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/) ## [Unreleased] +## [4.0.0] - 2020-03-12 +### Added +- Laravel 7 Support + ## [3.0.1] - 2020-03-02 ### Fixed - Respect the model uses soft delete diff --git a/composer.json b/composer.json index 59808ca4..532eb332 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "matchish/laravel-scout-elasticsearch", "description": "Search among multiple models with ElasticSearch and Laravel Scout", - "version": "3.0.1", + "version": "4.0.0", "keywords": [ "laravel", "scout", From 910bd818b70f88f4363fedb06c1fabce7c8bef53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Burak=20=C3=87ak=C4=B1rel?= Date: Thu, 12 Mar 2020 13:13:33 +0300 Subject: [PATCH 11/17] Update readme --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6bad89bb..53959f60 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/) ## [4.0.0] - 2020-03-12 ### Added -- Laravel 7 Support +- Scout 8 Support ## [3.0.1] - 2020-03-02 ### Fixed From 0a18ed36bd7e0049b2eba0c55ea7a4e517b6cc1f Mon Sep 17 00:00:00 2001 From: Sergey Shliakhov Date: Wed, 11 Mar 2020 08:07:45 +0100 Subject: [PATCH 12/17] Take dependency from last green build Debug commit Down to 3.6 Down to 3.5 Config from last working build --- phpstan.neon.dist | 1 + 1 file changed, 1 insertion(+) diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 8422a749..5f68aad9 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -5,6 +5,7 @@ parameters: paths: - src reportUnmatchedIgnoredErrors: false + inferPrivatePropertyTypeFromConstructor: true checkMissingIterableValueType: false ignoreErrors: - From ad4ee4cb42ef110273fd11aca3ec93c4608d81ea Mon Sep 17 00:00:00 2001 From: Sergey Shliakhov Date: Fri, 13 Mar 2020 05:47:28 +0100 Subject: [PATCH 13/17] Don't ignore platform on composer install --- .scrutinizer.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.scrutinizer.yml b/.scrutinizer.yml index ca28025d..80f241ef 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -33,3 +33,6 @@ build: coverage: file: 'coverage.clover' format: 'clover' + dependencies: + override: + - composer update --no-interaction --no-suggest --prefer-source From b8f2611c807b90029dbe3e309aa80f6099a2edad Mon Sep 17 00:00:00 2001 From: Sergey Shliakhov Date: Fri, 13 Mar 2020 05:58:52 +0100 Subject: [PATCH 14/17] Fix hierarchy of scrutinizer config --- .scrutinizer.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.scrutinizer.yml b/.scrutinizer.yml index 80f241ef..307f71c6 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -33,6 +33,6 @@ build: coverage: file: 'coverage.clover' format: 'clover' - dependencies: - override: - - composer update --no-interaction --no-suggest --prefer-source + dependencies: + override: + - composer update --no-interaction --no-suggest --prefer-source From 7bf4a888567b70337adde67e06d2e3a239214bc5 Mon Sep 17 00:00:00 2001 From: Sergey Shlyakhov Date: Fri, 13 Mar 2020 05:22:01 +0000 Subject: [PATCH 15/17] Apply fixes from StyleCI --- .../Elasticsearch/HitsIteratorAggregateTest.php | 12 ++++++------ tests/Unit/ElasticSearch/IndexTest.php | 2 +- tests/Unit/Engines/ElasticSearchEngineTest.php | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/tests/Integration/Elasticsearch/HitsIteratorAggregateTest.php b/tests/Integration/Elasticsearch/HitsIteratorAggregateTest.php index 6a89eca4..18a269c1 100644 --- a/tests/Integration/Elasticsearch/HitsIteratorAggregateTest.php +++ b/tests/Integration/Elasticsearch/HitsIteratorAggregateTest.php @@ -12,9 +12,9 @@ class HitsIteratorAggregateTest extends TestCase public function test_hits_iterator_aggregate_binds_to_eloquent_implementation() { $iteratorAggregate = $this->app->makeWith(HitsIteratorAggregate::class, [ - 'results' => [], - 'callback' => null, - ]); + 'results' => [], + 'callback' => null, + ]); $this->assertEquals(EloquentHitsIteratorAggregate::class, get_class($iteratorAggregate)); } @@ -24,9 +24,9 @@ public function test_override_bind_for_custom_iterator_aggregate_implementation( $this->app->bind(HitsIteratorAggregate::class, CustomHitsIteratorAggregate::class); $iteratorAggregate = $this->app->makeWith(HitsIteratorAggregate::class, [ - 'results' => [], - 'callback' => null, - ]); + 'results' => [], + 'callback' => null, + ]); $this->assertEquals(CustomHitsIteratorAggregate::class, get_class($iteratorAggregate)); } diff --git a/tests/Unit/ElasticSearch/IndexTest.php b/tests/Unit/ElasticSearch/IndexTest.php index 882fac43..8b77dc3c 100644 --- a/tests/Unit/ElasticSearch/IndexTest.php +++ b/tests/Unit/ElasticSearch/IndexTest.php @@ -18,7 +18,7 @@ public function test_creation_from_searchable() namespace Matchish\ScoutElasticSearch\ElasticSearch; -function time():int +function time(): int { return 1525376494; } diff --git a/tests/Unit/Engines/ElasticSearchEngineTest.php b/tests/Unit/Engines/ElasticSearchEngineTest.php index ca886efe..989bec6a 100644 --- a/tests/Unit/Engines/ElasticSearchEngineTest.php +++ b/tests/Unit/Engines/ElasticSearchEngineTest.php @@ -58,12 +58,12 @@ public function test_pass_query_to_callback_before_executing() 'hits' => [ [ '_id' => 1, '_source' => [ - '__class_name' => Product::class, - ], ], + '__class_name' => Product::class, + ], ], [ '_id' => 2, '_source' => [ - '__class_name' => Product::class, - ], ], + '__class_name' => Product::class, + ], ], ], 'total' => 2, ], ], new Product()); From 7164a0719d314198cf311774baae7e7f9526b1f7 Mon Sep 17 00:00:00 2001 From: Sergey Shliakhov Date: Fri, 13 Mar 2020 06:24:50 +0100 Subject: [PATCH 16/17] Revert "Update README.md" This reverts commit 3d835ff9 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f0194998..3495e37c 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Import progress report

- Build Status + Build Status Code quality Coverage Total Downloads From 8433720ca4349320e31b49ccc8ae3a0694c7c252 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Burak=20=C3=87ak=C4=B1rel?= Date: Fri, 13 Mar 2020 11:49:35 +0300 Subject: [PATCH 17/17] Remove unnecessary parameter from phpstan config --- phpstan.neon.dist | 1 - 1 file changed, 1 deletion(-) diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 5f68aad9..8422a749 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -5,7 +5,6 @@ parameters: paths: - src reportUnmatchedIgnoredErrors: false - inferPrivatePropertyTypeFromConstructor: true checkMissingIterableValueType: false ignoreErrors: -