Skip to content

Commit 930e408

Browse files
committed
Update code-style
1 parent 76eb73d commit 930e408

25 files changed

+59
-61
lines changed

src/Concerns/Artisan.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ trait Artisan
1111
/**
1212
* Run an Artisan console command by name.
1313
*
14-
* @param string $command
15-
* @param array $parameters
14+
* @param string $command
15+
* @param array $parameters
1616
*
1717
* @return void
1818
*/

src/Concerns/Infoable.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ trait Infoable
1010
/**
1111
* Write a string as standard output.
1212
*
13-
* @param string $string
14-
* @param string|null $style
15-
* @param int|string|null $verbosity
13+
* @param string $string
14+
* @param string|null $style
15+
* @param int|string|null $verbosity
1616
*/
1717
public function line($string, $style = null, $verbosity = null)
1818
{

src/Concerns/Optionable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ protected function optionDatabase(): ?string
1212
return $this->input->getOption('database');
1313
}
1414

15-
protected function optionStep(int $default = null): ?int
15+
protected function optionStep(?int $default = null): ?int
1616
{
1717
return $this->input->getOption('step') ?: $default;
1818
}

src/Console/Make.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use DragonCode\LaravelActions\Concerns\Database;
77
use DragonCode\LaravelActions\Concerns\Infoable;
88
use DragonCode\LaravelActions\Constants\Names;
9+
use Exception;
910
use Illuminate\Database\Console\Migrations\BaseCommand;
1011
use Illuminate\Database\Migrations\MigrationCreator;
1112
use Illuminate\Support\Composer;
@@ -49,8 +50,8 @@ class Make extends BaseCommand
4950
/**
5051
* Create a new action install command instance.
5152
*
52-
* @param \Illuminate\Database\Migrations\MigrationCreator $creator
53-
* @param \Illuminate\Support\Composer $composer
53+
* @param \Illuminate\Database\Migrations\MigrationCreator $creator
54+
* @param \Illuminate\Support\Composer $composer
5455
*/
5556
public function __construct(MigrationCreator $creator, Composer $composer)
5657
{
@@ -63,7 +64,7 @@ public function __construct(MigrationCreator $creator, Composer $composer)
6364
/**
6465
* Execute the console command.
6566
*
66-
* @throws \Exception
67+
* @throws Exception
6768
*/
6869
public function handle()
6970
{
@@ -77,9 +78,9 @@ public function handle()
7778
/**
7879
* Write the action file to disk.
7980
*
80-
* @param string $name
81+
* @param string $name
8182
*
82-
* @throws \Exception
83+
* @throws Exception
8384
*/
8485
protected function writeMigration(string $name)
8586
{

src/Console/Refresh.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ public function handle()
6363
/**
6464
* Run the rollback command.
6565
*
66-
* @param string|null $database
67-
* @param int|null $step
66+
* @param string|null $database
67+
* @param int|null $step
6868
*/
6969
protected function runRollback(?string $database, ?int $step)
7070
{
@@ -78,7 +78,7 @@ protected function runRollback(?string $database, ?int $step)
7878
/**
7979
* Run the reset command.
8080
*
81-
* @param string|null $database
81+
* @param string|null $database
8282
*/
8383
protected function runReset(?string $database)
8484
{

src/Console/Reset.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class Reset extends BaseCommand
4242
/**
4343
* Create a new migration rollback command instance.
4444
*
45-
* @param \DragonCode\LaravelActions\Support\Migrator $migrator
45+
* @param \DragonCode\LaravelActions\Support\Migrator $migrator
4646
*/
4747
public function __construct(Migrator $migrator)
4848
{

src/Support/Actionable.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ abstract class Actionable extends Migration implements Contract
4242
*
4343
* @var array|string|null
4444
*/
45-
protected $environment = null;
45+
protected $environment;
4646

4747
/**
4848
* Determines in which environment it should not run.
4949
*
5050
* @var array|string|null
5151
*/
52-
protected $except_environment = null;
52+
protected $except_environment;
5353

5454
/**
5555
* Reverse the actions.
@@ -122,7 +122,7 @@ public function allow(): bool
122122
}
123123

124124
/**
125-
* Method to be called when the job completes successfully
125+
* Method to be called when the job completes successfully.
126126
*
127127
* @return void
128128
*/

src/Support/Migrator.php

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
namespace DragonCode\LaravelActions\Support;
44

55
use DragonCode\Contracts\LaravelActions\Actionable as ActionableContract;
6-
use DragonCode\LaravelActions\Concerns\Infoable;
76
use DragonCode\LaravelActions\Concerns\Anonymous;
7+
use DragonCode\LaravelActions\Concerns\Infoable;
88
use Illuminate\Database\Migrations\Migrator as BaseMigrator;
99
use Illuminate\Support\Facades\DB;
1010
use Throwable;
@@ -28,11 +28,11 @@ public function usingConnection($name, callable $callback)
2828
/**
2929
* Run "up" a migration instance.
3030
*
31-
* @param string $file
32-
* @param int $batch
33-
* @param bool $pretend
31+
* @param string $file
32+
* @param int $batch
33+
* @param bool $pretend
3434
*
35-
* @throws \Throwable
35+
* @throws Throwable
3636
*/
3737
protected function runUp($file, $batch, $pretend)
3838
{
@@ -82,11 +82,11 @@ protected function runUp($file, $batch, $pretend)
8282
/**
8383
* Run "down" a migration instance.
8484
*
85-
* @param string $file
86-
* @param object $migration
87-
* @param bool $pretend
85+
* @param string $file
86+
* @param object $migration
87+
* @param bool $pretend
8888
*
89-
* @throws \Throwable
89+
* @throws Throwable
9090
*/
9191
protected function runDown($file, $migration, $pretend)
9292
{
@@ -112,10 +112,10 @@ protected function runDown($file, $migration, $pretend)
112112
/**
113113
* Starts the execution of code, starting database transactions, if necessary.
114114
*
115-
* @param object $migration
116-
* @param string $method
115+
* @param object $migration
116+
* @param string $method
117117
*
118-
* @throws \Throwable
118+
* @throws Throwable
119119
*/
120120
protected function runMigration($migration, $method)
121121
{
@@ -135,7 +135,7 @@ protected function runMigration($migration, $method)
135135
/**
136136
* Whether it is necessary to record information about the execution in the database.
137137
*
138-
* @param \DragonCode\Contracts\LaravelActions\Actionable|object $migration
138+
* @param \DragonCode\Contracts\LaravelActions\Actionable|object $migration
139139
*
140140
* @return bool
141141
*/
@@ -147,7 +147,7 @@ protected function allowLogging(ActionableContract $migration): bool
147147
/**
148148
* Whether the action needs to be executed in the current environment.
149149
*
150-
* @param \DragonCode\Contracts\LaravelActions\Actionable|object $migration
150+
* @param \DragonCode\Contracts\LaravelActions\Actionable|object $migration
151151
*
152152
* @return bool
153153
*/
@@ -167,17 +167,13 @@ protected function allowEnvironment(ActionableContract $migration): bool
167167
return false;
168168
}
169169

170-
if (! empty($except) && in_array($environment, $except)) {
171-
return false;
172-
}
173-
174-
return true;
170+
return ! (! empty($except) && in_array($environment, $except));
175171
}
176172

177173
/**
178174
* Whether it is necessary to call database transactions at runtime.
179175
*
180-
* @param \DragonCode\LaravelActions\Support\Actionable|object $migration
176+
* @param \DragonCode\LaravelActions\Support\Actionable|object $migration
181177
*
182178
* @return bool
183179
*/
@@ -189,7 +185,7 @@ protected function enabledTransactions(ActionableContract $migration): bool
189185
/**
190186
* The number of attempts to execute a request within a transaction before throwing an error.
191187
*
192-
* @param \DragonCode\LaravelActions\Support\Actionable|object $migration
188+
* @param \DragonCode\LaravelActions\Support\Actionable|object $migration
193189
*
194190
* @return int
195191
*/
@@ -201,10 +197,11 @@ protected function transactionAttempts(ActionableContract $migration): int
201197
}
202198

203199
/**
204-
* @param \DragonCode\Contracts\LaravelActions\Actionable|object $migration
205-
* @param callable $handle
200+
* @param \DragonCode\Contracts\LaravelActions\Actionable|object $migration
201+
* @param callable $handle
202+
*
203+
* @throws Throwable
206204
*
207-
* @throws \Throwable
208205
* @return void
209206
*/
210207
protected function runMigrationHandle(ActionableContract $migration, callable $handle)
@@ -221,7 +218,7 @@ protected function runMigrationHandle(ActionableContract $migration, callable $h
221218
}
222219

223220
/**
224-
* @param \DragonCode\Contracts\LaravelActions\Actionable|object $migration
221+
* @param \DragonCode\Contracts\LaravelActions\Actionable|object $migration
225222
*
226223
* @return void
227224
*/
@@ -231,7 +228,7 @@ protected function runSuccess(ActionableContract $migration): void
231228
}
232229

233230
/**
234-
* @param \DragonCode\Contracts\LaravelActions\Actionable|object $migration
231+
* @param \DragonCode\Contracts\LaravelActions\Actionable|object $migration
235232
*
236233
* @return void
237234
*/

tests/Concerns/Files.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ protected function copyFailedTransaction(): void
5858
File::copy($source, $this->targetDirectory('2021_02_15_124852_test_failed_transactions.php'));
5959
}
6060

61-
protected function targetDirectory(string $path = null): string
61+
protected function targetDirectory(?string $path = null): string
6262
{
6363
$dir = database_path('actions');
6464

tests/fixtures/app/anonymous/actions/2020_12_07_153105_foo_bar.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use Illuminate\Support\Facades\DB;
66
use Ramsey\Uuid\Uuid;
77

8-
return new class extends Actionable {
8+
return new class () extends Actionable {
99
public function up(): void
1010
{
1111
$this->table()->insert([

0 commit comments

Comments
 (0)