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

Commit

Permalink
Switch to Laravel preset for StyleCI (#316)
Browse files Browse the repository at this point in the history
* Switch to Laravel preset for StyleCI

Switch to Laravel preset for StyleCI

* Apply fix.
  • Loading branch information
lucasmichot authored and iget-esoares committed Dec 28, 2019
1 parent 37bd2ce commit a177879
Show file tree
Hide file tree
Showing 23 changed files with 63 additions and 63 deletions.
2 changes: 1 addition & 1 deletion .styleci.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
preset: psr2
preset: laravel
10 changes: 5 additions & 5 deletions src/Builders/FilterBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace ScoutElastic\Builders;

use Laravel\Scout\Builder;
use Illuminate\Support\Arr;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Arr;
use Laravel\Scout\Builder;

class FilterBuilder extends Builder
{
Expand Down Expand Up @@ -84,7 +84,7 @@ public function where($field, $value)
$args = func_get_args();

if (count($args) == 3) {
list($field, $operator, $value) = $args;
[$field, $operator, $value] = $args;
} else {
$operator = '=';
}
Expand Down Expand Up @@ -379,8 +379,8 @@ public function whereGeoShape($field, array $shape, $relation = 'INTERSECTS')
'geo_shape' => [
$field => [
'shape' => $shape,
'relation' => $relation
]
'relation' => $relation,
],
],
];

Expand Down
6 changes: 3 additions & 3 deletions src/Console/ElasticIndexCreateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

namespace ScoutElastic\Console;

use ScoutElastic\Migratable;
use Illuminate\Console\Command;
use ScoutElastic\Console\Features\RequiresIndexConfiguratorArgument;
use ScoutElastic\Facades\ElasticClient;
use ScoutElastic\Migratable;
use ScoutElastic\Payloads\IndexPayload;
use ScoutElastic\Console\Features\RequiresIndexConfiguratorArgument;

class ElasticIndexCreateCommand extends Command
{
Expand Down Expand Up @@ -53,7 +53,7 @@ protected function createWriteAlias()
{
$configurator = $this->getIndexConfigurator();

if (!in_array(Migratable::class, class_uses_recursive($configurator))) {
if (! in_array(Migratable::class, class_uses_recursive($configurator))) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Console/ElasticIndexDropCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
namespace ScoutElastic\Console;

use Illuminate\Console\Command;
use ScoutElastic\Console\Features\RequiresIndexConfiguratorArgument;
use ScoutElastic\Facades\ElasticClient;
use ScoutElastic\IndexConfigurator;
use ScoutElastic\Migratable;
use ScoutElastic\Console\Features\RequiresIndexConfiguratorArgument;
use ScoutElastic\Payloads\RawPayload;

class ElasticIndexDropCommand extends Command
Expand Down
12 changes: 6 additions & 6 deletions src/Console/ElasticIndexUpdateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
namespace ScoutElastic\Console;

use Exception;
use LogicException;
use ScoutElastic\Migratable;
use Illuminate\Console\Command;
use ScoutElastic\Payloads\RawPayload;
use LogicException;
use ScoutElastic\Console\Features\RequiresIndexConfiguratorArgument;
use ScoutElastic\Facades\ElasticClient;
use ScoutElastic\Migratable;
use ScoutElastic\Payloads\IndexPayload;
use ScoutElastic\Console\Features\RequiresIndexConfiguratorArgument;
use ScoutElastic\Payloads\RawPayload;

class ElasticIndexUpdateCommand extends Command
{
Expand Down Expand Up @@ -39,7 +39,7 @@ protected function updateIndex()

$indices = ElasticClient::indices();

if (!$indices->exists($indexPayload)) {
if (! $indices->exists($indexPayload)) {
throw new LogicException(sprintf(
'Index %s doesn\'t exist',
$configurator->getName()
Expand Down Expand Up @@ -79,7 +79,7 @@ protected function createWriteAlias()
{
$configurator = $this->getIndexConfigurator();

if (!in_array(Migratable::class, class_uses_recursive($configurator))) {
if (! in_array(Migratable::class, class_uses_recursive($configurator))) {
return;
}

Expand Down
10 changes: 5 additions & 5 deletions src/Console/ElasticMigrateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
namespace ScoutElastic\Console;

use Exception;
use ScoutElastic\Migratable;
use Illuminate\Console\Command;
use ScoutElastic\Payloads\RawPayload;
use ScoutElastic\Console\Features\RequiresModelArgument;
use ScoutElastic\Facades\ElasticClient;
use ScoutElastic\Migratable;
use ScoutElastic\Payloads\IndexPayload;
use ScoutElastic\Payloads\RawPayload;
use Symfony\Component\Console\Input\InputArgument;
use ScoutElastic\Console\Features\RequiresModelArgument;

class ElasticMigrateCommand extends Command
{
Expand Down Expand Up @@ -159,7 +159,7 @@ protected function updateTargetIndexMapping()
->set('index', $targetIndex)
->set('type', $targetType)
->set('include_type_name', 'true')
->set('body.' . $targetType, $mapping)
->set('body.'.$targetType, $mapping)
->get();

ElasticClient::indices()
Expand Down Expand Up @@ -329,7 +329,7 @@ public function handle()
$sourceModel = $this->getModel();
$sourceIndexConfigurator = $sourceModel->getIndexConfigurator();

if (!in_array(Migratable::class, class_uses_recursive($sourceIndexConfigurator))) {
if (! in_array(Migratable::class, class_uses_recursive($sourceIndexConfigurator))) {
$this->error(sprintf(
'The %s index configurator must use the %s trait.',
get_class($sourceIndexConfigurator),
Expand Down
10 changes: 5 additions & 5 deletions src/Console/ElasticUpdateMappingCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

namespace ScoutElastic\Console;

use Illuminate\Console\Command;
use LogicException;
use ScoutElastic\Console\Features\RequiresModelArgument;
use ScoutElastic\Facades\ElasticClient;
use ScoutElastic\Migratable;
use Illuminate\Console\Command;
use ScoutElastic\Payloads\TypePayload;
use ScoutElastic\Facades\ElasticClient;
use ScoutElastic\Console\Features\RequiresModelArgument;

class ElasticUpdateMappingCommand extends Command
{
Expand All @@ -30,7 +30,7 @@ class ElasticUpdateMappingCommand extends Command
*/
public function handle()
{
if (!$model = $this->getModel()) {
if (! $model = $this->getModel()) {
return;
}

Expand All @@ -46,7 +46,7 @@ public function handle()
}

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

if (in_array(Migratable::class, class_uses_recursive($configurator))) {
Expand Down
4 changes: 2 additions & 2 deletions src/Console/Features/RequiresModelArgument.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace ScoutElastic\Console\Features;

use ScoutElastic\Searchable;
use InvalidArgumentException;
use Illuminate\Database\Eloquent\Model;
use InvalidArgumentException;
use ScoutElastic\Searchable;
use Symfony\Component\Console\Input\InputArgument;

trait RequiresModelArgument
Expand Down
2 changes: 1 addition & 1 deletion src/Console/SearchableModelMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace ScoutElastic\Console;

use Symfony\Component\Console\Input\InputOption;
use Illuminate\Foundation\Console\ModelMakeCommand;
use Symfony\Component\Console\Input\InputOption;

class SearchableModelMakeCommand extends ModelMakeCommand
{
Expand Down
14 changes: 7 additions & 7 deletions src/ElasticEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

namespace ScoutElastic;

use stdClass;
use Laravel\Scout\Builder;
use Illuminate\Support\Arr;
use Laravel\Scout\Engines\Engine;
use ScoutElastic\Payloads\TypePayload;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Artisan;
use ScoutElastic\Facades\ElasticClient;
use Laravel\Scout\Builder;
use Laravel\Scout\Engines\Engine;
use ScoutElastic\Builders\SearchBuilder;
use ScoutElastic\Facades\ElasticClient;
use ScoutElastic\Indexers\IndexerInterface;
use Illuminate\Database\Eloquent\Collection;
use ScoutElastic\Payloads\TypePayload;
use stdClass;

class ElasticEngine extends Engine
{
Expand Down
4 changes: 2 additions & 2 deletions src/Indexers/BulkIndexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

namespace ScoutElastic\Indexers;

use Illuminate\Database\Eloquent\Collection;
use ScoutElastic\Facades\ElasticClient;
use ScoutElastic\Migratable;
use ScoutElastic\Payloads\RawPayload;
use ScoutElastic\Payloads\TypePayload;
use ScoutElastic\Facades\ElasticClient;
use Illuminate\Database\Eloquent\Collection;

class BulkIndexer implements IndexerInterface
{
Expand Down
4 changes: 2 additions & 2 deletions src/Indexers/SingleIndexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace ScoutElastic\Indexers;

use ScoutElastic\Migratable;
use Illuminate\Database\Eloquent\Collection;
use ScoutElastic\Facades\ElasticClient;
use ScoutElastic\Migratable;
use ScoutElastic\Payloads\DocumentPayload;
use Illuminate\Database\Eloquent\Collection;

class SingleIndexer implements IndexerInterface
{
Expand Down
2 changes: 1 addition & 1 deletion src/Payloads/TypePayload.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
namespace ScoutElastic\Payloads;

use Exception;
use ScoutElastic\Searchable;
use Illuminate\Database\Eloquent\Model;
use ScoutElastic\Searchable;

class TypePayload extends IndexPayload
{
Expand Down
12 changes: 6 additions & 6 deletions src/ScoutElasticServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@

namespace ScoutElastic;

use InvalidArgumentException;
use Elasticsearch\ClientBuilder;
use Laravel\Scout\EngineManager;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\ServiceProvider;
use ScoutElastic\Console\ElasticMigrateCommand;
use ScoutElastic\Console\SearchRuleMakeCommand;
use ScoutElastic\Console\ElasticIndexDropCommand;
use InvalidArgumentException;
use Laravel\Scout\EngineManager;
use ScoutElastic\Console\ElasticIndexCreateCommand;
use ScoutElastic\Console\ElasticIndexDropCommand;
use ScoutElastic\Console\ElasticIndexUpdateCommand;
use ScoutElastic\Console\SearchableModelMakeCommand;
use ScoutElastic\Console\ElasticMigrateCommand;
use ScoutElastic\Console\ElasticUpdateMappingCommand;
use ScoutElastic\Console\IndexConfiguratorMakeCommand;
use ScoutElastic\Console\SearchableModelMakeCommand;
use ScoutElastic\Console\SearchRuleMakeCommand;

class ScoutElasticServiceProvider extends ServiceProvider
{
Expand Down
6 changes: 3 additions & 3 deletions src/Searchable.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

use Exception;
use Illuminate\Support\Arr;
use Laravel\Scout\Searchable as SourceSearchable;
use ScoutElastic\Builders\FilterBuilder;
use ScoutElastic\Builders\SearchBuilder;
use Laravel\Scout\Searchable as SourceSearchable;

trait Searchable
{
Expand All @@ -31,8 +31,8 @@ public function getIndexConfigurator()
{
static $indexConfigurator;

if (!$indexConfigurator) {
if (!isset($this->indexConfigurator) || empty($this->indexConfigurator)) {
if (! $indexConfigurator) {
if (! isset($this->indexConfigurator) || empty($this->indexConfigurator)) {
throw new Exception(sprintf(
'An index configurator for the %s model is not specified.',
__CLASS__
Expand Down
4 changes: 2 additions & 2 deletions tests/Builders/FilterBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ public function testWhereGeoShape()
];

$relation = 'WITHIN';

$builder = (new FilterBuilder($this->mockModel()))
->whereGeoShape('foo', $shape, $relation);

Expand All @@ -362,7 +362,7 @@ public function testWhereGeoShape()
'geo_shape' => [
'foo' => [
'shape' => $shape,
'relation' => $relation
'relation' => $relation,
],
],
],
Expand Down
2 changes: 1 addition & 1 deletion tests/Builders/SearchBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace ScoutElastic\Tests\Builders;

use ScoutElastic\SearchRule;
use ScoutElastic\Builders\SearchBuilder;
use ScoutElastic\SearchRule;
use ScoutElastic\Tests\AbstractTestCase;
use ScoutElastic\Tests\Dependencies\Model;

Expand Down
8 changes: 4 additions & 4 deletions tests/ElasticEngineTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

namespace ScoutElastic\Tests;

use stdClass;
use ScoutElastic\ElasticEngine;
use ScoutElastic\Facades\ElasticClient;
use ScoutElastic\Builders\FilterBuilder;
use ScoutElastic\Builders\SearchBuilder;
use ScoutElastic\Tests\Stubs\SearchRule;
use ScoutElastic\ElasticEngine;
use ScoutElastic\Facades\ElasticClient;
use ScoutElastic\Tests\Dependencies\Model;
use ScoutElastic\Tests\Stubs\SearchRule;
use stdClass;

class ElasticEngineTest extends AbstractTestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Indexers/AbstractIndexerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace ScoutElastic\Tests\Indexers;

use Illuminate\Database\Eloquent\Collection;
use ScoutElastic\Tests\AbstractTestCase;
use ScoutElastic\Tests\Dependencies\Model;
use Illuminate\Database\Eloquent\Collection;

abstract class AbstractIndexerTest extends AbstractTestCase
{
Expand Down
4 changes: 2 additions & 2 deletions tests/Indexers/BulkIndexerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace ScoutElastic\Tests\Indexers;

use ScoutElastic\Tests\Config;
use ScoutElastic\Indexers\BulkIndexer;
use ScoutElastic\Facades\ElasticClient;
use ScoutElastic\Indexers\BulkIndexer;
use ScoutElastic\Tests\Config;

class BulkIndexerTest extends AbstractIndexerTest
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Indexers/SingleIndexerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace ScoutElastic\Tests\Indexers;

use ScoutElastic\Tests\Config;
use ScoutElastic\Facades\ElasticClient;
use ScoutElastic\Indexers\SingleIndexer;
use ScoutElastic\Tests\Config;

class SingleIndexerTest extends AbstractIndexerTest
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Payloads/DocumentPayloadTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace ScoutElastic\Tests\Payloads;

use ScoutElastic\Tests\AbstractTestCase;
use ScoutElastic\Payloads\DocumentPayload;
use ScoutElastic\Tests\AbstractTestCase;
use ScoutElastic\Tests\Dependencies\Model;

class DocumentPayloadTest extends AbstractTestCase
Expand Down
Loading

0 comments on commit a177879

Please sign in to comment.