Skip to content

Commit 839b53f

Browse files
committed
docs: apply the attribute to the docs
1 parent ef7fc0e commit 839b53f

31 files changed

Lines changed: 212 additions & 0 deletions

‎docs/cli/cli_commands.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,15 @@ namespace App\Commands;
3838

3939
use CodeIgniter\CLI\BaseCommand;
4040
use CodeIgniter\CLI\CLI;
41+
use Override;
4142

4243
class AppInfo extends BaseCommand
4344
{
4445
protected $group = 'Demo';
4546
protected $name = 'app:info';
4647
protected $description = 'Displays basic application information.';
4748

49+
#[Override]
4850
public function run(array $params)
4951
{
5052
// ...
@@ -85,11 +87,13 @@ namespace App\Commands;
8587

8688
use CodeIgniter\CLI\BaseCommand;
8789
use CodeIgniter\CLI\CLI;
90+
use Override;
8891

8992
class AppInfo extends BaseCommand
9093
{
9194
// ...
9295

96+
#[Override]
9397
public function run(array $params)
9498
{
9599
CLI::write('PHP Version: ' . CLI::color(PHP_VERSION, 'yellow'));

‎docs/cli/cli_library.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,13 @@ namespace App\Commands;
1919

2020
use CodeIgniter\CLI\BaseCommand;
2121
use CodeIgniter\CLI\CLI;
22+
use Override;
2223

2324
class MyCommand extends BaseCommand
2425
{
2526
// ...
2627

28+
#[Override]
2729
public function run(array $params)
2830
{
2931
// ...

‎docs/cli/cli_modern_commands.md‎

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,12 @@ namespace App\Commands;
2323

2424
use CodeIgniter\CLI\AbstractCommand;
2525
use CodeIgniter\CLI\Attributes\Command;
26+
use Override;
2627

2728
#[Command(name: 'app:greet', description: 'Prints a greeting.', group: 'App')]
2829
class AppGreet extends AbstractCommand
2930
{
31+
#[Override]
3032
protected function execute(array $arguments, array $options): int
3133
{
3234
$this->getOutput()->write('Hello!', 'green');
@@ -60,6 +62,7 @@ namespace App\Commands;
6062

6163
use CodeIgniter\CLI\AbstractCommand;
6264
use CodeIgniter\CLI\Attributes\Command;
65+
use Override;
6366

6467
#[Command(
6568
name: 'app:deploy',
@@ -69,6 +72,7 @@ use CodeIgniter\CLI\Attributes\Command;
6972
)]
7073
class AppDeploy extends AbstractCommand
7174
{
75+
#[Override]
7276
protected function execute(array $arguments, array $options): int
7377
{
7478
// Reachable as `php spark app:deploy`, `php spark app:ship`, or `php spark deploy`.
@@ -89,6 +93,7 @@ namespace App\Commands;
8993

9094
use CodeIgniter\CLI\AbstractCommand;
9195
use CodeIgniter\CLI\Attributes\Command;
96+
use Override;
9297

9398
#[Command(
9499
name: 'app:reindex',
@@ -98,6 +103,7 @@ use CodeIgniter\CLI\Attributes\Command;
98103
)]
99104
class AppReindex extends AbstractCommand
100105
{
106+
#[Override]
101107
protected function execute(array $arguments, array $options): int
102108
{
103109
// Not shown by `php spark list`, but `php spark app:reindex` still runs it.
@@ -134,6 +140,7 @@ namespace App\Commands;
134140

135141
use CodeIgniter\CLI\AbstractCommand;
136142
use CodeIgniter\CLI\Attributes\Command;
143+
use Override;
137144

138145
#[Command(
139146
name: 'app:status',
@@ -143,6 +150,7 @@ use CodeIgniter\CLI\Attributes\Command;
143150
)]
144151
class AppStatus extends AbstractCommand
145152
{
153+
#[Override]
146154
protected function execute(array $arguments, array $options): int
147155
{
148156
$this->getOutput()->write(json_encode(['status' => 'ok'], JSON_THROW_ON_ERROR));
@@ -181,10 +189,12 @@ namespace App\Commands;
181189
use CodeIgniter\CLI\AbstractCommand;
182190
use CodeIgniter\CLI\Attributes\Command;
183191
use CodeIgniter\CLI\Input\Argument;
192+
use Override;
184193

185194
#[Command(name: 'app:greet', description: 'Greets people.', group: 'App')]
186195
class AppGreet extends AbstractCommand
187196
{
197+
#[Override]
188198
protected function configure(): void
189199
{
190200
$this
@@ -208,6 +218,7 @@ class AppGreet extends AbstractCommand
208218
));
209219
}
210220

221+
#[Override]
211222
protected function execute(array $arguments, array $options): int
212223
{
213224
// ...
@@ -238,10 +249,12 @@ namespace App\Commands;
238249
use CodeIgniter\CLI\AbstractCommand;
239250
use CodeIgniter\CLI\Attributes\Command;
240251
use CodeIgniter\CLI\Input\Option;
252+
use Override;
241253

242254
#[Command(name: 'app:publish', description: 'Publishes assets.', group: 'App')]
243255
class AppPublish extends AbstractCommand
244256
{
257+
#[Override]
245258
protected function configure(): void
246259
{
247260
$this
@@ -282,6 +295,7 @@ class AppPublish extends AbstractCommand
282295
));
283296
}
284297

298+
#[Override]
285299
protected function execute(array $arguments, array $options): int
286300
{
287301
// ...
@@ -346,10 +360,12 @@ namespace App\Commands;
346360
use CodeIgniter\CLI\AbstractCommand;
347361
use CodeIgniter\CLI\Attributes\Command;
348362
use CodeIgniter\CLI\Input\Option;
363+
use Override;
349364

350365
#[Command(name: 'logs:clear', description: 'Clears logs.', group: 'Housekeeping')]
351366
class ClearLogs extends AbstractCommand
352367
{
368+
#[Override]
353369
protected function configure(): void
354370
{
355371
$this->addOption(new Option(
@@ -359,6 +375,7 @@ class ClearLogs extends AbstractCommand
359375
));
360376
}
361377

378+
#[Override]
362379
protected function interact(array &$arguments, array &$options): void
363380
{
364381
// hasUnboundOption() resolves --force, -f, and --no-force in one call,
@@ -376,6 +393,7 @@ class ClearLogs extends AbstractCommand
376393
$options['force'] = null;
377394
}
378395

396+
#[Override]
379397
protected function execute(array $arguments, array $options): int
380398
{
381399
if ($this->getValidatedOption('force') === false) {
@@ -406,10 +424,12 @@ use CodeIgniter\CLI\AbstractCommand;
406424
use CodeIgniter\CLI\Attributes\Command;
407425
use CodeIgniter\CLI\Input\Argument;
408426
use CodeIgniter\CLI\PromptsForMissingInputInterface;
427+
use Override;
409428

410429
#[Command(name: 'app:greet', description: 'Greets people.', group: 'App')]
411430
class AppGreet extends AbstractCommand implements PromptsForMissingInputInterface
412431
{
432+
#[Override]
413433
protected function configure(): void
414434
{
415435
$this->addArgument(new Argument(
@@ -419,11 +439,13 @@ class AppGreet extends AbstractCommand implements PromptsForMissingInputInterfac
419439
));
420440
}
421441

442+
#[Override]
422443
protected function getArgumentPromptLabels(): array
423444
{
424445
return ['name' => 'Who should be greeted?'];
425446
}
426447

448+
#[Override]
427449
protected function execute(array $arguments, array $options): int
428450
{
429451
$this->getOutput()->write(sprintf('Hello, %s!', $arguments['name']), 'green');
@@ -477,16 +499,19 @@ namespace App\Commands;
477499

478500
use CodeIgniter\CLI\AbstractCommand;
479501
use CodeIgniter\CLI\Attributes\Command;
502+
use Override;
480503

481504
#[Command(name: 'dev:only', description: 'A dev only command', group: 'Dev')]
482505
class DevOnly extends AbstractCommand
483506
{
507+
#[Override]
484508
protected function isAvailable(): bool
485509
{
486510
// Only allow this command in the development environment
487511
return ENVIRONMENT === 'development';
488512
}
489513

514+
#[Override]
490515
protected function execute(array $arguments, array $options): int
491516
{
492517
// ...
@@ -526,17 +551,20 @@ use CodeIgniter\CLI\AbstractCommand;
526551
use CodeIgniter\CLI\Attributes\Command;
527552
use CodeIgniter\CLI\Input\Argument;
528553
use CodeIgniter\CLI\Input\Option;
554+
use Override;
529555

530556
#[Command(name: 'app:demo', description: 'Demonstrates accessors.', group: 'App')]
531557
class AppDemo extends AbstractCommand
532558
{
559+
#[Override]
533560
protected function configure(): void
534561
{
535562
$this
536563
->addArgument(new Argument(name: 'name', required: true))
537564
->addOption(new Option(name: 'loud', negatable: true, default: false));
538565
}
539566

567+
#[Override]
540568
protected function execute(array $arguments, array $options): int
541569
{
542570
// Directly from the parameters:
@@ -572,10 +600,12 @@ namespace App\Commands;
572600
use CodeIgniter\CLI\AbstractCommand;
573601
use CodeIgniter\CLI\Attributes\Command;
574602
use CodeIgniter\CLI\Table;
603+
use Override;
575604

576605
#[Command(name: 'app:report', description: 'Prints a report.', group: 'App')]
577606
class AppReport extends AbstractCommand
578607
{
608+
#[Override]
579609
protected function execute(array $arguments, array $options): int
580610
{
581611
$output = $this->getOutput();
@@ -621,10 +651,12 @@ use CodeIgniter\CLI\AbstractCommand;
621651
use CodeIgniter\CLI\Attributes\Command;
622652
use CodeIgniter\CLI\Table;
623653
use CodeIgniter\CLI\Verbosity;
654+
use Override;
624655

625656
#[Command(name: 'app:sync', description: 'Synchronizes the records.', group: 'App')]
626657
class AppSync extends AbstractCommand
627658
{
659+
#[Override]
628660
protected function execute(array $arguments, array $options): int
629661
{
630662
$output = $this->getOutput();
@@ -708,10 +740,12 @@ namespace App\Commands;
708740
use CodeIgniter\CLI\AbstractCommand;
709741
use CodeIgniter\CLI\Attributes\Command;
710742
use CodeIgniter\CLI\Input\Argument;
743+
use Override;
711744

712745
#[Command(name: 'app:greet', description: 'Greets people.', group: 'App')]
713746
class AppGreet extends AbstractCommand
714747
{
748+
#[Override]
715749
protected function configure(): void
716750
{
717751
$this
@@ -722,6 +756,7 @@ class AppGreet extends AbstractCommand
722756
->addUsage('app:greet "Bob the Builder"');
723757
}
724758

759+
#[Override]
725760
protected function execute(array $arguments, array $options): int
726761
{
727762
// ...
@@ -797,6 +832,7 @@ namespace App\Commands;
797832

798833
use CodeIgniter\CLI\BaseCommand;
799834
use CodeIgniter\CLI\CLI;
835+
use Override;
800836
use Throwable;
801837

802838
class Publish extends BaseCommand
@@ -811,6 +847,7 @@ class Publish extends BaseCommand
811847
'--dry-run' => 'Print the plan without writing anything.',
812848
];
813849

850+
#[Override]
814851
public function run(array $params)
815852
{
816853
try {
@@ -853,11 +890,13 @@ use CodeIgniter\CLI\AbstractCommand;
853890
use CodeIgniter\CLI\Attributes\Command;
854891
use CodeIgniter\CLI\Input\Argument;
855892
use CodeIgniter\CLI\Input\Option;
893+
use Override;
856894
use Throwable;
857895

858896
#[Command(name: 'app:publish', description: 'Publishes something.', group: 'App')]
859897
class Publish extends AbstractCommand
860898
{
899+
#[Override]
861900
protected function configure(): void
862901
{
863902
$this
@@ -866,13 +905,15 @@ class Publish extends AbstractCommand
866905
->addOption(new Option(name: 'dry-run', description: 'Print the plan without writing anything.'));
867906
}
868907

908+
#[Override]
869909
protected function interact(array &$arguments, array &$options): void
870910
{
871911
if ($arguments === []) {
872912
$arguments[] = $this->getPrompt()->ask('What should I publish?', null, 'required');
873913
}
874914
}
875915

916+
#[Override]
876917
protected function execute(array $arguments, array $options): int
877918
{
878919
try {

0 commit comments

Comments
 (0)