Skip to content
This repository was archived by the owner on Nov 4, 2021. It is now read-only.

Commit a177879

Browse files
lucasmichotiget-esoares
authored andcommitted
Switch to Laravel preset for StyleCI (#316)
* Switch to Laravel preset for StyleCI Switch to Laravel preset for StyleCI * Apply fix.
1 parent 37bd2ce commit a177879

23 files changed

+63
-63
lines changed

.styleci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
preset: psr2
1+
preset: laravel

src/Builders/FilterBuilder.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
namespace ScoutElastic\Builders;
44

5-
use Laravel\Scout\Builder;
6-
use Illuminate\Support\Arr;
75
use Illuminate\Database\Eloquent\Model;
6+
use Illuminate\Support\Arr;
7+
use Laravel\Scout\Builder;
88

99
class FilterBuilder extends Builder
1010
{
@@ -84,7 +84,7 @@ public function where($field, $value)
8484
$args = func_get_args();
8585

8686
if (count($args) == 3) {
87-
list($field, $operator, $value) = $args;
87+
[$field, $operator, $value] = $args;
8888
} else {
8989
$operator = '=';
9090
}
@@ -379,8 +379,8 @@ public function whereGeoShape($field, array $shape, $relation = 'INTERSECTS')
379379
'geo_shape' => [
380380
$field => [
381381
'shape' => $shape,
382-
'relation' => $relation
383-
]
382+
'relation' => $relation,
383+
],
384384
],
385385
];
386386

src/Console/ElasticIndexCreateCommand.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
namespace ScoutElastic\Console;
44

5-
use ScoutElastic\Migratable;
65
use Illuminate\Console\Command;
6+
use ScoutElastic\Console\Features\RequiresIndexConfiguratorArgument;
77
use ScoutElastic\Facades\ElasticClient;
8+
use ScoutElastic\Migratable;
89
use ScoutElastic\Payloads\IndexPayload;
9-
use ScoutElastic\Console\Features\RequiresIndexConfiguratorArgument;
1010

1111
class ElasticIndexCreateCommand extends Command
1212
{
@@ -53,7 +53,7 @@ protected function createWriteAlias()
5353
{
5454
$configurator = $this->getIndexConfigurator();
5555

56-
if (!in_array(Migratable::class, class_uses_recursive($configurator))) {
56+
if (! in_array(Migratable::class, class_uses_recursive($configurator))) {
5757
return;
5858
}
5959

src/Console/ElasticIndexDropCommand.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
namespace ScoutElastic\Console;
44

55
use Illuminate\Console\Command;
6+
use ScoutElastic\Console\Features\RequiresIndexConfiguratorArgument;
67
use ScoutElastic\Facades\ElasticClient;
78
use ScoutElastic\IndexConfigurator;
89
use ScoutElastic\Migratable;
9-
use ScoutElastic\Console\Features\RequiresIndexConfiguratorArgument;
1010
use ScoutElastic\Payloads\RawPayload;
1111

1212
class ElasticIndexDropCommand extends Command

src/Console/ElasticIndexUpdateCommand.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
namespace ScoutElastic\Console;
44

55
use Exception;
6-
use LogicException;
7-
use ScoutElastic\Migratable;
86
use Illuminate\Console\Command;
9-
use ScoutElastic\Payloads\RawPayload;
7+
use LogicException;
8+
use ScoutElastic\Console\Features\RequiresIndexConfiguratorArgument;
109
use ScoutElastic\Facades\ElasticClient;
10+
use ScoutElastic\Migratable;
1111
use ScoutElastic\Payloads\IndexPayload;
12-
use ScoutElastic\Console\Features\RequiresIndexConfiguratorArgument;
12+
use ScoutElastic\Payloads\RawPayload;
1313

1414
class ElasticIndexUpdateCommand extends Command
1515
{
@@ -39,7 +39,7 @@ protected function updateIndex()
3939

4040
$indices = ElasticClient::indices();
4141

42-
if (!$indices->exists($indexPayload)) {
42+
if (! $indices->exists($indexPayload)) {
4343
throw new LogicException(sprintf(
4444
'Index %s doesn\'t exist',
4545
$configurator->getName()
@@ -79,7 +79,7 @@ protected function createWriteAlias()
7979
{
8080
$configurator = $this->getIndexConfigurator();
8181

82-
if (!in_array(Migratable::class, class_uses_recursive($configurator))) {
82+
if (! in_array(Migratable::class, class_uses_recursive($configurator))) {
8383
return;
8484
}
8585

src/Console/ElasticMigrateCommand.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
namespace ScoutElastic\Console;
44

55
use Exception;
6-
use ScoutElastic\Migratable;
76
use Illuminate\Console\Command;
8-
use ScoutElastic\Payloads\RawPayload;
7+
use ScoutElastic\Console\Features\RequiresModelArgument;
98
use ScoutElastic\Facades\ElasticClient;
9+
use ScoutElastic\Migratable;
1010
use ScoutElastic\Payloads\IndexPayload;
11+
use ScoutElastic\Payloads\RawPayload;
1112
use Symfony\Component\Console\Input\InputArgument;
12-
use ScoutElastic\Console\Features\RequiresModelArgument;
1313

1414
class ElasticMigrateCommand extends Command
1515
{
@@ -159,7 +159,7 @@ protected function updateTargetIndexMapping()
159159
->set('index', $targetIndex)
160160
->set('type', $targetType)
161161
->set('include_type_name', 'true')
162-
->set('body.' . $targetType, $mapping)
162+
->set('body.'.$targetType, $mapping)
163163
->get();
164164

165165
ElasticClient::indices()
@@ -329,7 +329,7 @@ public function handle()
329329
$sourceModel = $this->getModel();
330330
$sourceIndexConfigurator = $sourceModel->getIndexConfigurator();
331331

332-
if (!in_array(Migratable::class, class_uses_recursive($sourceIndexConfigurator))) {
332+
if (! in_array(Migratable::class, class_uses_recursive($sourceIndexConfigurator))) {
333333
$this->error(sprintf(
334334
'The %s index configurator must use the %s trait.',
335335
get_class($sourceIndexConfigurator),

src/Console/ElasticUpdateMappingCommand.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
namespace ScoutElastic\Console;
44

5+
use Illuminate\Console\Command;
56
use LogicException;
7+
use ScoutElastic\Console\Features\RequiresModelArgument;
8+
use ScoutElastic\Facades\ElasticClient;
69
use ScoutElastic\Migratable;
7-
use Illuminate\Console\Command;
810
use ScoutElastic\Payloads\TypePayload;
9-
use ScoutElastic\Facades\ElasticClient;
10-
use ScoutElastic\Console\Features\RequiresModelArgument;
1111

1212
class ElasticUpdateMappingCommand extends Command
1313
{
@@ -30,7 +30,7 @@ class ElasticUpdateMappingCommand extends Command
3030
*/
3131
public function handle()
3232
{
33-
if (!$model = $this->getModel()) {
33+
if (! $model = $this->getModel()) {
3434
return;
3535
}
3636

@@ -46,7 +46,7 @@ public function handle()
4646
}
4747

4848
$payload = (new TypePayload($model))
49-
->set('body.' . $model->searchableAs(), $mapping)
49+
->set('body.'.$model->searchableAs(), $mapping)
5050
->set('include_type_name', 'true');
5151

5252
if (in_array(Migratable::class, class_uses_recursive($configurator))) {

src/Console/Features/RequiresModelArgument.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
namespace ScoutElastic\Console\Features;
44

5-
use ScoutElastic\Searchable;
6-
use InvalidArgumentException;
75
use Illuminate\Database\Eloquent\Model;
6+
use InvalidArgumentException;
7+
use ScoutElastic\Searchable;
88
use Symfony\Component\Console\Input\InputArgument;
99

1010
trait RequiresModelArgument

src/Console/SearchableModelMakeCommand.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
namespace ScoutElastic\Console;
44

5-
use Symfony\Component\Console\Input\InputOption;
65
use Illuminate\Foundation\Console\ModelMakeCommand;
6+
use Symfony\Component\Console\Input\InputOption;
77

88
class SearchableModelMakeCommand extends ModelMakeCommand
99
{

src/ElasticEngine.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22

33
namespace ScoutElastic;
44

5-
use stdClass;
6-
use Laravel\Scout\Builder;
7-
use Illuminate\Support\Arr;
8-
use Laravel\Scout\Engines\Engine;
9-
use ScoutElastic\Payloads\TypePayload;
5+
use Illuminate\Database\Eloquent\Collection;
106
use Illuminate\Database\Eloquent\Model;
7+
use Illuminate\Support\Arr;
118
use Illuminate\Support\Facades\Artisan;
12-
use ScoutElastic\Facades\ElasticClient;
9+
use Laravel\Scout\Builder;
10+
use Laravel\Scout\Engines\Engine;
1311
use ScoutElastic\Builders\SearchBuilder;
12+
use ScoutElastic\Facades\ElasticClient;
1413
use ScoutElastic\Indexers\IndexerInterface;
15-
use Illuminate\Database\Eloquent\Collection;
14+
use ScoutElastic\Payloads\TypePayload;
15+
use stdClass;
1616

1717
class ElasticEngine extends Engine
1818
{

src/Indexers/BulkIndexer.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
namespace ScoutElastic\Indexers;
44

5+
use Illuminate\Database\Eloquent\Collection;
6+
use ScoutElastic\Facades\ElasticClient;
57
use ScoutElastic\Migratable;
68
use ScoutElastic\Payloads\RawPayload;
79
use ScoutElastic\Payloads\TypePayload;
8-
use ScoutElastic\Facades\ElasticClient;
9-
use Illuminate\Database\Eloquent\Collection;
1010

1111
class BulkIndexer implements IndexerInterface
1212
{

src/Indexers/SingleIndexer.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
namespace ScoutElastic\Indexers;
44

5-
use ScoutElastic\Migratable;
5+
use Illuminate\Database\Eloquent\Collection;
66
use ScoutElastic\Facades\ElasticClient;
7+
use ScoutElastic\Migratable;
78
use ScoutElastic\Payloads\DocumentPayload;
8-
use Illuminate\Database\Eloquent\Collection;
99

1010
class SingleIndexer implements IndexerInterface
1111
{

src/Payloads/TypePayload.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
namespace ScoutElastic\Payloads;
44

55
use Exception;
6-
use ScoutElastic\Searchable;
76
use Illuminate\Database\Eloquent\Model;
7+
use ScoutElastic\Searchable;
88

99
class TypePayload extends IndexPayload
1010
{

src/ScoutElasticServiceProvider.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22

33
namespace ScoutElastic;
44

5-
use InvalidArgumentException;
65
use Elasticsearch\ClientBuilder;
7-
use Laravel\Scout\EngineManager;
86
use Illuminate\Support\Facades\Config;
97
use Illuminate\Support\ServiceProvider;
10-
use ScoutElastic\Console\ElasticMigrateCommand;
11-
use ScoutElastic\Console\SearchRuleMakeCommand;
12-
use ScoutElastic\Console\ElasticIndexDropCommand;
8+
use InvalidArgumentException;
9+
use Laravel\Scout\EngineManager;
1310
use ScoutElastic\Console\ElasticIndexCreateCommand;
11+
use ScoutElastic\Console\ElasticIndexDropCommand;
1412
use ScoutElastic\Console\ElasticIndexUpdateCommand;
15-
use ScoutElastic\Console\SearchableModelMakeCommand;
13+
use ScoutElastic\Console\ElasticMigrateCommand;
1614
use ScoutElastic\Console\ElasticUpdateMappingCommand;
1715
use ScoutElastic\Console\IndexConfiguratorMakeCommand;
16+
use ScoutElastic\Console\SearchableModelMakeCommand;
17+
use ScoutElastic\Console\SearchRuleMakeCommand;
1818

1919
class ScoutElasticServiceProvider extends ServiceProvider
2020
{

src/Searchable.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
use Exception;
66
use Illuminate\Support\Arr;
7+
use Laravel\Scout\Searchable as SourceSearchable;
78
use ScoutElastic\Builders\FilterBuilder;
89
use ScoutElastic\Builders\SearchBuilder;
9-
use Laravel\Scout\Searchable as SourceSearchable;
1010

1111
trait Searchable
1212
{
@@ -31,8 +31,8 @@ public function getIndexConfigurator()
3131
{
3232
static $indexConfigurator;
3333

34-
if (!$indexConfigurator) {
35-
if (!isset($this->indexConfigurator) || empty($this->indexConfigurator)) {
34+
if (! $indexConfigurator) {
35+
if (! isset($this->indexConfigurator) || empty($this->indexConfigurator)) {
3636
throw new Exception(sprintf(
3737
'An index configurator for the %s model is not specified.',
3838
__CLASS__

tests/Builders/FilterBuilderTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ public function testWhereGeoShape()
351351
];
352352

353353
$relation = 'WITHIN';
354-
354+
355355
$builder = (new FilterBuilder($this->mockModel()))
356356
->whereGeoShape('foo', $shape, $relation);
357357

@@ -362,7 +362,7 @@ public function testWhereGeoShape()
362362
'geo_shape' => [
363363
'foo' => [
364364
'shape' => $shape,
365-
'relation' => $relation
365+
'relation' => $relation,
366366
],
367367
],
368368
],

tests/Builders/SearchBuilderTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
namespace ScoutElastic\Tests\Builders;
44

5-
use ScoutElastic\SearchRule;
65
use ScoutElastic\Builders\SearchBuilder;
6+
use ScoutElastic\SearchRule;
77
use ScoutElastic\Tests\AbstractTestCase;
88
use ScoutElastic\Tests\Dependencies\Model;
99

tests/ElasticEngineTest.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
namespace ScoutElastic\Tests;
44

5-
use stdClass;
6-
use ScoutElastic\ElasticEngine;
7-
use ScoutElastic\Facades\ElasticClient;
85
use ScoutElastic\Builders\FilterBuilder;
96
use ScoutElastic\Builders\SearchBuilder;
10-
use ScoutElastic\Tests\Stubs\SearchRule;
7+
use ScoutElastic\ElasticEngine;
8+
use ScoutElastic\Facades\ElasticClient;
119
use ScoutElastic\Tests\Dependencies\Model;
10+
use ScoutElastic\Tests\Stubs\SearchRule;
11+
use stdClass;
1212

1313
class ElasticEngineTest extends AbstractTestCase
1414
{

tests/Indexers/AbstractIndexerTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
namespace ScoutElastic\Tests\Indexers;
44

5+
use Illuminate\Database\Eloquent\Collection;
56
use ScoutElastic\Tests\AbstractTestCase;
67
use ScoutElastic\Tests\Dependencies\Model;
7-
use Illuminate\Database\Eloquent\Collection;
88

99
abstract class AbstractIndexerTest extends AbstractTestCase
1010
{

tests/Indexers/BulkIndexerTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
namespace ScoutElastic\Tests\Indexers;
44

5-
use ScoutElastic\Tests\Config;
6-
use ScoutElastic\Indexers\BulkIndexer;
75
use ScoutElastic\Facades\ElasticClient;
6+
use ScoutElastic\Indexers\BulkIndexer;
7+
use ScoutElastic\Tests\Config;
88

99
class BulkIndexerTest extends AbstractIndexerTest
1010
{

tests/Indexers/SingleIndexerTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
namespace ScoutElastic\Tests\Indexers;
44

5-
use ScoutElastic\Tests\Config;
65
use ScoutElastic\Facades\ElasticClient;
76
use ScoutElastic\Indexers\SingleIndexer;
7+
use ScoutElastic\Tests\Config;
88

99
class SingleIndexerTest extends AbstractIndexerTest
1010
{

tests/Payloads/DocumentPayloadTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
namespace ScoutElastic\Tests\Payloads;
44

5-
use ScoutElastic\Tests\AbstractTestCase;
65
use ScoutElastic\Payloads\DocumentPayload;
6+
use ScoutElastic\Tests\AbstractTestCase;
77
use ScoutElastic\Tests\Dependencies\Model;
88

99
class DocumentPayloadTest extends AbstractTestCase

0 commit comments

Comments
 (0)