Skip to content

Commit

Permalink
style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
LaravelFreelancerNL committed Jan 2, 2024
1 parent 5f85c17 commit e88a930
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
- name: Run all QA tests
run: |
./vendor/bin/phpmd src/ text phpmd-ruleset.xml
./vendor/bin/phpstan analyse -c phpstan.neon
./vendor/bin/phpstan analyse -c phpstan.neon.dist
./vendor/bin/testbench migrate:fresh --path=tests/Setup/Database/Migrations --realpath --seed
./vendor/bin/testbench package:test --coverage --min=80 tests
env:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ ray.php
/vendor
/*.cache
/workbench
phpstan.neon
12 changes: 12 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
includes:
- ./vendor/nunomaduro/larastan/extension.neon

parameters:
level: 8
checkGenericClassInNonGenericObjectType: false
universalObjectCratesClasses:
- 'Illuminate\Support\Fluent'
paths:
- src
excludePaths:
- src/Schema
4 changes: 2 additions & 2 deletions src/AranguentServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ public function register()
$this->app->when(MigrationCreator::class)
->needs('$customStubPath')
->give(function () {
return __DIR__.'/../stubs';
return __DIR__ . '/../stubs';
});
$this->app->when(IlluminateMigrationCreator::class)
->needs('$customStubPath')
->give(function () {
return __DIR__.'/../stubs';
return __DIR__ . '/../stubs';
});

$this->app->resolving(
Expand Down
2 changes: 1 addition & 1 deletion src/Console/ModelMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ protected function resolveStubPath($stub)
{
return file_exists($customPath = $this->laravel->basePath(trim($stub, '/')))
? $customPath
: __DIR__.$stub;
: __DIR__ . $stub;
}
}
6 changes: 3 additions & 3 deletions src/Schema/Concerns/Columns.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ public function hasColumn($column)
$parameters = [];
$parameters['handler'] = 'aql';
$parameters['explanation'] = "Checking if any document within the table has the '"
.implode(', ', (array) $column)
."' column(s).";
. implode(', ', (array) $column)
. "' column(s).";
$parameters['column'] = $column;

return $this->addCommand('hasAttribute', $parameters);
Expand Down Expand Up @@ -57,7 +57,7 @@ public function dropColumn($columns)
$parameters = [];
$parameters['handler'] = 'aql';
$parameters['attributes'] = $columns;
$parameters['explanation'] = 'Drop the following column(s): '.implode(',', $columns).'.';
$parameters['explanation'] = 'Drop the following column(s): ' . implode(',', $columns) . '.';

return $this->addCommand('dropAttribute', compact('parameters'));
}
Expand Down
2 changes: 1 addition & 1 deletion src/Schema/Concerns/Tables.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ protected function creating()
public function executeCreateCommand($command)
{
if ($this->connection->pretending()) {
$this->connection->logQuery('/* '.$command->explanation." */\n", []);
$this->connection->logQuery('/* ' . $command->explanation . " */\n", []);

return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

beforeEach(function () {
//Copy a stub with Illuminate usage to migrations directory
$stub = __DIR__.'/../Setup/Database/stubs/test_stub_for_migration_conversion.php';
$this->conversionMigration = __DIR__.'/../Setup/Database/Migrations/test_migration_conversion.php';
$stub = __DIR__ . '/../Setup/Database/stubs/test_stub_for_migration_conversion.php';
$this->conversionMigration = __DIR__ . '/../Setup/Database/Migrations/test_migration_conversion.php';
copy($stub, $this->conversionMigration);
});

Expand Down
2 changes: 1 addition & 1 deletion tests/Database/ConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
test('change database name', function () {
$initialName = $this->connection->getDatabaseName();

$newName = $initialName.'New';
$newName = $initialName . 'New';
$this->connection->setDatabaseName($newName);
$currentName = $this->connection->getDatabaseName();

Expand Down
2 changes: 1 addition & 1 deletion tests/Eloquent/ModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
]
)->run();

$file = __DIR__.'/../../vendor/orchestra/testbench-core/laravel/app/Models/AranguentModelTest.php';
$file = __DIR__ . '/../../vendor/orchestra/testbench-core/laravel/app/Models/AranguentModelTest.php';

//assert file exists
expect($file)->toBeFile();
Expand Down
16 changes: 8 additions & 8 deletions tests/Schema/GrammarTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@
$parameters['name'] = 'hasAttribute';
$parameters['handler'] = 'aql';
$parameters['explanation'] = "Checking if any document within the collection has the '"
.implode(', ', $attributes)."' attribute(s).";
. implode(', ', $attributes) . "' attribute(s).";
$parameters['columns'] = $attributes;
$command = new Fluent($parameters);
$results = $this->grammar->compileHasColumn($collection, $command);

$this->assertEquals(
'FOR doc IN GrammarTestCollection FILTER doc.firstAttribute != null AND doc.SecondAttribute != null '
.'AND doc.@theThirdAttribute != null LIMIT 1 RETURN true',
. 'AND doc.@theThirdAttribute != null LIMIT 1 RETURN true',
$results->aqb
);
});
Expand All @@ -46,14 +46,14 @@
$parameters['name'] = 'dropAttribute';
$parameters['handler'] = 'aql';
$parameters['attributes'] = $attributes;
$parameters['explanation'] = 'Drop the following attribute(s): '.implode(',', $attributes).'.';
$parameters['explanation'] = 'Drop the following attribute(s): ' . implode(',', $attributes) . '.';
$command = new Fluent($parameters);
$results = $this->grammar->compileDropAttribute($collection, $command);
$this->assertEquals(
'FOR doc IN GrammarTestCollection FILTER doc.firstAttribute != null OR doc.SecondAttribute != null '
.'OR doc.@theThirdAttribute != null UPDATE doc WITH '
.'{"firstAttribute":null,"SecondAttribute":null,"@theThirdAttribute":null} '
.'IN GrammarTestCollection OPTIONS {"keepNull":false}',
. 'OR doc.@theThirdAttribute != null UPDATE doc WITH '
. '{"firstAttribute":null,"SecondAttribute":null,"@theThirdAttribute":null} '
. 'IN GrammarTestCollection OPTIONS {"keepNull":false}',
$results->aqb
);
expect($results->aqb->collections['write'])->toEqual([$collection]);
Expand All @@ -73,8 +73,8 @@
$results = $this->grammar->compileRenameAttribute($collection, $command);
self::assertEquals(
'FOR doc IN GrammarTestCollection FILTER doc.oldAttributeName != null AND doc.newAttributeName == null'
.' UPDATE doc WITH {"oldAttributeName":null,"newAttributeName":doc.oldAttributeName} '
.'IN GrammarTestCollection OPTIONS {"keepNull":true}',
. ' UPDATE doc WITH {"oldAttributeName":null,"newAttributeName":doc.oldAttributeName} '
. 'IN GrammarTestCollection OPTIONS {"keepNull":true}',
$results->aqb->query
);
expect($results->aqb->collections['write'][0])->toEqual($collection);
Expand Down

0 comments on commit e88a930

Please sign in to comment.