Skip to content

Commit 24d17d5

Browse files
committedJan 2, 2022
chore: run php-cs-fixer for the ./
1 parent 8e36450 commit 24d17d5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+292
-55
lines changed
 

‎.php-cs-fixer.php

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
PhpCsFixer\Finder::create()
3939
->exclude('test')
4040
->exclude('runtime')
41+
->exclude('.github')
4142
->exclude('vendor')
4243
->in(__DIR__)
4344
)

‎example/cliapp.php

+15-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
<?php
1+
<?php declare(strict_types=1);
2+
/**
3+
* This file is part of toolkit/pflag.
4+
*
5+
* @link https://github.com/php-toolkit
6+
* @author https://github.com/inhere
7+
* @license MIT
8+
*/
29

310
use Toolkit\Cli\Cli;
411
use Toolkit\PFlag\CliApp;
@@ -10,18 +17,19 @@
1017
// run demo:
1118
// php example/cliapp.php
1219

13-
$app = CliApp::newWith(function (CliApp $app) {
20+
$cli = CliApp::newWith(static function (CliApp $app): void {
1421
$app->setName('myApp');
22+
$app->setDesc('my cli application. v1.0.1');
1523
})
16-
->add('test1', fn(FlagsParser $fs) => vdump($fs->getOpts()), [
24+
->add('test1', fn (FlagsParser $fs) => vdump($fs->getOpts()), [
1725
'desc' => 'the test 1 command',
1826
'options' => [
1927
'opt1' => 'opt1 for command test1',
2028
'opt2' => 'int;opt2 for command test1',
2129
],
2230
]);
2331

24-
$app->add('test2', function (FlagsParser $fs) {
32+
$cli->add('test2', function (FlagsParser $fs): void {
2533
Cli::info('options:');
2634
vdump($fs->getOpts());
2735
Cli::info('arguments:');
@@ -37,9 +45,8 @@
3745
]
3846
]);
3947

40-
$app->add('show-err', fn() => throw new RuntimeException('test show exception'));
48+
$cli->add('show-err', fn () => throw new RuntimeException('test show exception'));
4149

42-
$app->addHandler(DemoCmdHandler::class);
43-
44-
$app->run();
50+
$cli->addHandler(DemoCmdHandler::class);
4551

52+
$cli->run();

0 commit comments

Comments
 (0)
Please sign in to comment.