Skip to content

Commit 519898a

Browse files
marktopperStyleCIBot
authored andcommitted
Apply fixes from StyleCI
1 parent 4c4ee8c commit 519898a

File tree

8 files changed

+63
-63
lines changed

8 files changed

+63
-63
lines changed

src/Hooks.php

+20-20
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ public function uninstall($name, $delete = false, $unmigrate = true, $unseed = t
319319
*
320320
* @return bool
321321
*/
322-
public function update($name, $version = null, $migrate = true, $seed = true, $publish = true, $forcePublishing)
322+
public function update($name, $version, $migrate, $seed, $publish, $forcePublishing)
323323
{
324324
// Check if hook exists
325325
if (!$this->downloaded($name)) {
@@ -495,10 +495,10 @@ public function make($name)
495495
protected function makeStubFiles($name)
496496
{
497497
$replaces = [
498-
'kebab-case' => $name,
499-
'snake_case' => snake_case(str_replace('-', '_', $name)),
500-
'camelCase' => camel_case(str_replace('-', '_', $name)),
501-
'StudlyCase' => studly_case(str_replace('-', '_', $name)),
498+
'kebab-case' => $name,
499+
'snake_case' => snake_case(str_replace('-', '_', $name)),
500+
'camelCase' => camel_case(str_replace('-', '_', $name)),
501+
'StudlyCase' => studly_case(str_replace('-', '_', $name)),
502502
'MIGRATION_DATE_TIME' => $this->migrationDateTimeString(),
503503
];
504504

@@ -891,7 +891,7 @@ public function checkForUpdates()
891891
/**
892892
* Run migrations found for a specific hook.
893893
*
894-
* @param \Larapack\Hooks\Hook $hook
894+
* @param \Larapack\Hooks\Hook $hook
895895
*/
896896
protected function migrateHook(Hook $hook)
897897
{
@@ -903,7 +903,7 @@ protected function migrateHook(Hook $hook)
903903
/**
904904
* Rollback migrations found for a specific hook.
905905
*
906-
* @param \Larapack\Hooks\Hook $hook
906+
* @param \Larapack\Hooks\Hook $hook
907907
*/
908908
protected function unmigrateHook(Hook $hook)
909909
{
@@ -915,7 +915,7 @@ protected function unmigrateHook(Hook $hook)
915915
/**
916916
* Run seeders found for a specific hook.
917917
*
918-
* @param \Larapack\Hooks\Hook $hook
918+
* @param \Larapack\Hooks\Hook $hook
919919
*/
920920
protected function seedHook(Hook $hook)
921921
{
@@ -928,7 +928,7 @@ protected function seedHook(Hook $hook)
928928
/**
929929
* Run unseeders found for a specific hook.
930930
*
931-
* @param \Larapack\Hooks\Hook $hook
931+
* @param \Larapack\Hooks\Hook $hook
932932
*/
933933
protected function unseedHook(Hook $hook)
934934
{
@@ -941,7 +941,7 @@ protected function unseedHook(Hook $hook)
941941
/**
942942
* Publish assets found for a specific hook.
943943
*
944-
* @param \Larapack\Hooks\Hook $hook
944+
* @param \Larapack\Hooks\Hook $hook
945945
*/
946946
protected function publishHook(Hook $hook, $force = false)
947947
{
@@ -983,7 +983,7 @@ protected function publishHook(Hook $hook, $force = false)
983983

984984
$newFiles->merge($updatedFiles)
985985
->each(function ($filename) use ($realLocation, $publishPath, $filesystem) {
986-
$directory = substr($publishPath.'/'.$filename, 0, - strlen(basename($filename)));
986+
$directory = substr($publishPath.'/'.$filename, 0, -strlen(basename($filename)));
987987

988988
if (!$filesystem->isDirectory($directory)) {
989989
$filesystem->makeDirectory($directory, 0755, true, true);
@@ -1001,7 +1001,7 @@ protected function publishHook(Hook $hook, $force = false)
10011001
/**
10021002
* Unpublish assets found for a specific hook.
10031003
*
1004-
* @param \Larapack\Hooks\Hook $hook
1004+
* @param \Larapack\Hooks\Hook $hook
10051005
*/
10061006
protected function unpublishHook(Hook $hook)
10071007
{
@@ -1033,8 +1033,8 @@ protected function unpublishHook(Hook $hook)
10331033
/**
10341034
* Run seeder files.
10351035
*
1036-
* @param array $folders
1037-
* @param string $basePath
1036+
* @param array $folders
1037+
* @param string $basePath
10381038
*/
10391039
protected function runSeeders($folders, $basePath)
10401040
{
@@ -1046,18 +1046,18 @@ protected function runSeeders($folders, $basePath)
10461046
return $file->getExtension() == 'php';
10471047
})->each(function ($file) {
10481048
$class = substr($file->getFilename(), 0, -4);
1049-
require_once($file->getRealPath());
1049+
require_once $file->getRealPath();
10501050

1051-
(new $class)->run();
1051+
(new $class())->run();
10521052
});
10531053
});
10541054
}
10551055

10561056
/**
10571057
* Get collection of realpath paths.
10581058
*
1059-
* @param array $paths
1060-
* @param string $basePath
1059+
* @param array $paths
1060+
* @param string $basePath
10611061
*
10621062
* @return \Illuminate\Support\Collection
10631063
*/
@@ -1071,9 +1071,9 @@ protected function realPath(array $paths, $basePath = '')
10711071
}
10721072

10731073
/**
1074-
* Make temponary backup of hook
1074+
* Make temponary backup of hook.
10751075
*
1076-
* @param \Larapack\Hooks\Hook $hook
1076+
* @param \Larapack\Hooks\Hook $hook
10771077
*
10781078
* @return void
10791079
*/

stub/resources/database/migrations/MIGRATION_DATE_TIME_create_snake_case_table.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?php
22

3-
use Illuminate\Support\Facades\Schema;
4-
use Illuminate\Database\Schema\Blueprint;
53
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
66

77
class CreateStudlyCaseTable extends Migration
88
{
@@ -31,4 +31,4 @@ public function down()
3131
{
3232
Schema::dropIfExists('snake_case');
3333
}
34-
}
34+
}

stub/resources/database/seeders/StudlyCaseTableSeeder.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ public function run()
2323
['name' => 'baz'],
2424
]);
2525
}
26-
}
26+
}

stub/resources/database/unseeders/StudlyCaseTableUnseeder.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ class StudlyCaseTableUnseeder extends Seeder
1313
*/
1414
public function run()
1515
{
16-
// Skip if table does not exists.
17-
if (!Schema::hasTable('snake_case')) {
18-
return;
19-
}
16+
// Skip if table does not exists.
17+
if (!Schema::hasTable('snake_case')) {
18+
return;
19+
}
2020

2121
DB::table('snake_case')
22-
->whereIn('name', ['foo', 'bar', 'baz'])
23-
->delete();
22+
->whereIn('name', ['foo', 'bar', 'baz'])
23+
->delete();
2424
}
2525
}

tests/HooksTest.php

+23-23
Original file line numberDiff line numberDiff line change
@@ -675,10 +675,10 @@ public function test_installing_without_migrating_hook()
675675

676676
// Install hook
677677
$this->artisan('hook:install', [
678-
'name' => 'migrating-hook',
679-
'version' => 'v1.0.0',
678+
'name' => 'migrating-hook',
679+
'version' => 'v1.0.0',
680680
'--without-migrating' => true,
681-
'--without-seeding' => true,
681+
'--without-seeding' => true,
682682
]);
683683

684684
$this->assertFalse(Schema::hasTable('tests'));
@@ -728,7 +728,7 @@ public function test_uninstalling_without_unmigrating_hook()
728728

729729
// Uninstall hook
730730
$this->artisan('hook:uninstall', [
731-
'name' => 'migrating-hook',
731+
'name' => 'migrating-hook',
732732
'--without-unmigrating' => true,
733733
]);
734734

@@ -793,10 +793,10 @@ public function test_updating_without_remigrating_hook()
793793

794794
// Install hook
795795
$this->artisan('hook:update', [
796-
'name' => 'migrating-hook',
797-
'version' => 'v2.0.0',
796+
'name' => 'migrating-hook',
797+
'version' => 'v2.0.0',
798798
'--without-migrating' => true,
799-
'--without-seeding' => true,
799+
'--without-seeding' => true,
800800
]);
801801

802802
$this->assertTrue(Schema::hasTable('tests'));
@@ -829,8 +829,8 @@ public function test_installing_without_seeding_hook()
829829

830830
// Install hook
831831
$this->artisan('hook:install', [
832-
'name' => 'migrating-hook',
833-
'version' => 'v1.0.0',
832+
'name' => 'migrating-hook',
833+
'version' => 'v1.0.0',
834834
'--without-seeding' => true,
835835
]);
836836

@@ -855,7 +855,7 @@ public function test_unseeding_hook()
855855

856856
// Uninstall hook
857857
$this->artisan('hook:uninstall', [
858-
'name' => 'migrating-hook',
858+
'name' => 'migrating-hook',
859859
'--without-unmigrating' => true,
860860
]);
861861

@@ -880,9 +880,9 @@ public function test_uninstalling_without_unseeding()
880880

881881
// Uninstall hook
882882
$this->artisan('hook:uninstall', [
883-
'name' => 'migrating-hook',
883+
'name' => 'migrating-hook',
884884
'--without-unmigrating' => true,
885-
'--without-unseeding' => true,
885+
'--without-unseeding' => true,
886886
]);
887887

888888
$this->assertTrue(Schema::hasTable('tests'));
@@ -933,8 +933,8 @@ public function test_updating_without_reseeding()
933933

934934
// Update hook
935935
$this->artisan('hook:update', [
936-
'name' => 'migrating-hook',
937-
'version' => 'v2.0.0',
936+
'name' => 'migrating-hook',
937+
'version' => 'v2.0.0',
938938
'--without-seeding' => true,
939939
]);
940940

@@ -971,8 +971,8 @@ public function test_installing_without_publishing_assets()
971971

972972
// Install hook
973973
$this->artisan('hook:install', [
974-
'name' => 'migrating-hook',
975-
'version' => 'v1.0.0',
974+
'name' => 'migrating-hook',
975+
'version' => 'v1.0.0',
976976
'--without-publishing' => true,
977977
]);
978978

@@ -1060,7 +1060,7 @@ public function test_uninstalling_without_unpublishing_assets()
10601060

10611061
// Uninstall hook
10621062
$this->artisan('hook:uninstall', [
1063-
'name' => 'migrating-hook',
1063+
'name' => 'migrating-hook',
10641064
'--without-unpublishing' => true,
10651065
]);
10661066

@@ -1091,7 +1091,7 @@ public function test_republishing_assets_on_update()
10911091

10921092
// Update hook
10931093
$this->artisan('hook:update', [
1094-
'name' => 'migrating-hook',
1094+
'name' => 'migrating-hook',
10951095
'version' => 'v2.0.0',
10961096
]);
10971097

@@ -1125,8 +1125,8 @@ public function test_updating_without_republishing_assets()
11251125

11261126
// Update hook
11271127
$this->artisan('hook:update', [
1128-
'name' => 'migrating-hook',
1129-
'version' => 'v2.0.0',
1128+
'name' => 'migrating-hook',
1129+
'version' => 'v2.0.0',
11301130
'--without-publishing' => true,
11311131
]);
11321132

@@ -1162,7 +1162,7 @@ public function test_republishing_assets_on_update_with_custom_changed_files()
11621162

11631163
// Update hook
11641164
$this->artisan('hook:update', [
1165-
'name' => 'migrating-hook',
1165+
'name' => 'migrating-hook',
11661166
'version' => 'v2.0.0',
11671167
]);
11681168

@@ -1201,8 +1201,8 @@ public function test_force_republishing_assets_on_update_with_custom_changed_fil
12011201

12021202
// Update hook
12031203
$this->artisan('hook:update', [
1204-
'name' => 'migrating-hook',
1205-
'version' => 'v2.0.0',
1204+
'name' => 'migrating-hook',
1205+
'version' => 'v2.0.0',
12061206
'--force-publish' => true,
12071207
]);
12081208

tests/fixtures/resources/database/migrations/2018_01_20_120000_create_local_test_hook_table.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?php
22

3-
use Illuminate\Support\Facades\Schema;
4-
use Illuminate\Database\Schema\Blueprint;
53
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
66

77
class CreateLocalTestHookTable extends Migration
88
{
@@ -31,4 +31,4 @@ public function down()
3131
{
3232
Schema::dropIfExists('local_test_hook');
3333
}
34-
}
34+
}

tests/fixtures/resources/database/seeders/LocalTestHookTableSeeder.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ public function run()
2323
['name' => 'baz'],
2424
]);
2525
}
26-
}
26+
}

tests/fixtures/resources/database/unseeders/LocalTestHookTableUnseeder.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ class LocalTestHookTableUnseeder extends Seeder
1313
*/
1414
public function run()
1515
{
16-
// Skip if table does not exists.
17-
if (!Schema::hasTable('local_test_hook')) {
18-
return;
19-
}
16+
// Skip if table does not exists.
17+
if (!Schema::hasTable('local_test_hook')) {
18+
return;
19+
}
2020

2121
DB::table('local_test_hook')
22-
->whereIn('name', ['foo', 'bar', 'baz'])
23-
->delete();
22+
->whereIn('name', ['foo', 'bar', 'baz'])
23+
->delete();
2424
}
2525
}

0 commit comments

Comments
 (0)