Skip to content

Commit 0898e8b

Browse files
committed
add some new class. udpate some info
1 parent 9bc1e5f commit 0898e8b

File tree

8 files changed

+219
-44
lines changed

8 files changed

+219
-44
lines changed

examples/Controller/HomeController.php

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ protected static function commandAliases(): array
4141
];
4242
}
4343

44-
protected function init()
44+
protected function init(): void
4545
{
4646
parent::init();
4747

@@ -73,15 +73,15 @@ protected function afterExecute(): void
7373
* @example example text one
7474
* the second line example
7575
*/
76-
public function testCommand()
76+
public function testCommand(): void
7777
{
7878
$this->write('hello, welcome!! this is ' . __METHOD__);
7979
}
8080

8181
/**
8282
* this is a disabled command. please see 'disabledCommands()'
8383
*/
84-
public function disabledCommand()
84+
public function disabledCommand(): void
8585
{
8686
$this->write('hello, welcome!! this is ' . __METHOD__);
8787
}
@@ -90,7 +90,7 @@ public function disabledCommand()
9090
* command `defArgCommand` config
9191
* @throws \LogicException
9292
*/
93-
protected function defArgConfigure()
93+
protected function defArgConfigure(): void
9494
{
9595
$this->createDefinition()
9696
->setDescription('the command arg/opt config use defined configure, it like symfony console: argument define by position')
@@ -102,7 +102,7 @@ protected function defArgConfigure()
102102
/**
103103
* the command arg/opt config use defined configure, it like symfony console: argument define by position
104104
*/
105-
public function defArgCommand()
105+
public function defArgCommand(): void
106106
{
107107
$this->output->dump($this->input->getArgs(), $this->input->getOpts(), $this->input->getBoolOpt('y'));
108108
}
@@ -111,23 +111,23 @@ public function defArgCommand()
111111
* a command for test throw exception
112112
* @throws \RuntimeException
113113
*/
114-
public function exCommand()
114+
public function exCommand(): void
115115
{
116116
throw new \RuntimeException('oo, this is a runtime exception!');
117117
}
118118

119119
/**
120120
* a command for test trigger error
121121
*/
122-
public function errorCommand()
122+
public function errorCommand(): void
123123
{
124124
\trigger_error('oo, this is a runtime error!', E_USER_ERROR);
125125
}
126126

127127
/**
128128
* will run other command in the command.
129129
*/
130-
public function subRunCommand()
130+
public function subRunCommand(): void
131131
{
132132
$this->writeln('hello this is: ' . __METHOD__);
133133

@@ -137,15 +137,15 @@ public function subRunCommand()
137137
/**
138138
* dump current env information
139139
*/
140-
public function dumpEnvCommand()
140+
public function dumpEnvCommand(): void
141141
{
142142
$this->output->aList($_SERVER, '$_SERVER data');
143143
}
144144

145145
/**
146146
* check color support for current env.
147147
*/
148-
public function colorCheckCommand()
148+
public function colorCheckCommand(): void
149149
{
150150
// $char= '❤';
151151
// $ret = ProcessUtil::run('echo ❤');
@@ -214,7 +214,7 @@ public function counterCommand(): int
214214
/**
215215
* dynamic spinner message, by Show::spinner()
216216
*/
217-
public function spinnerCommand()
217+
public function spinnerCommand(): void
218218
{
219219
$total = 5000;
220220

@@ -229,7 +229,7 @@ public function spinnerCommand()
229229
/**
230230
* dynamic notice message show: pending
231231
*/
232-
public function pendingCommand()
232+
public function pendingCommand(): void
233233
{
234234
$total = 8000;
235235

@@ -244,7 +244,7 @@ public function pendingCommand()
244244
/**
245245
* dynamic notice message show: pointing
246246
*/
247-
public function pointingCommand()
247+
public function pointingCommand(): void
248248
{
249249
$total = 100;
250250

@@ -259,7 +259,7 @@ public function pointingCommand()
259259
/**
260260
* dynamic text message example, by Show::dynamicText
261261
*/
262-
public function dynamicTextCommand()
262+
public function dynamicTextCommand(): void
263263
{
264264
$dt = Show::dynamicText('Complete', 'Download file: xyz.zip ... ');
265265
$dt->send('Start');
@@ -317,7 +317,7 @@ public function progressCommand($input): int
317317
* a progress bar example show, by class ProgressBar
318318
* @throws \LogicException
319319
*/
320-
public function progressBarCommand()
320+
public function progressBarCommand(): void
321321
{
322322
$i = 0;
323323
$total = 120;
@@ -336,7 +336,7 @@ public function progressBarCommand()
336336
/**
337337
* output format message: list
338338
*/
339-
public function listCommand()
339+
public function listCommand(): void
340340
{
341341
$list = [
342342
'The is a list line 0',
@@ -360,7 +360,7 @@ public function listCommand()
360360
/**
361361
* output format message: multiList
362362
*/
363-
public function multiListCommand()
363+
public function multiListCommand(): void
364364
{
365365
Show::multiList([
366366
'list0' => [
@@ -387,7 +387,7 @@ public function multiListCommand()
387387
/**
388388
* output format message: table
389389
*/
390-
public function tableCommand()
390+
public function tableCommand(): void
391391
{
392392
$data = [
393393
[
@@ -443,7 +443,7 @@ public function tableCommand()
443443
/**
444444
* output format message: padding
445445
*/
446-
public function paddingCommand()
446+
public function paddingCommand(): void
447447
{
448448
$data = [
449449
'Eggs' => '$1.99',
@@ -461,7 +461,7 @@ public function paddingCommand()
461461
* home:useArg status=2 name=john arg0 -s=test --page=23 -d -rf --debug --test=false -a v1 --ab -c -g --cd val -h '' -i stat=online
462462
* home:useArg status=2 name=john name=tom name=jack arg0 -s=test --page=23 --id=23 --id=154 --id=456 -d -rf --debug --test=false
463463
*/
464-
public function useArgCommand()
464+
public function useArgCommand(): void
465465
{
466466
$this->write('input arguments:');
467467
$this->output->dump($this->input->getArgs());
@@ -479,7 +479,7 @@ public function useArgCommand()
479479
/**
480480
* output current env info
481481
*/
482-
public function envCommand()
482+
public function envCommand(): void
483483
{
484484
$info = [
485485
'phpVersion' => PHP_VERSION,
@@ -497,7 +497,7 @@ public function envCommand()
497497
* @usage {command} url=url saveTo=[saveAs] type=[bar|text]
498498
* @example {command} url=https://github.com/inhere/php-console/archive/master.zip type=bar
499499
*/
500-
public function downCommand()
500+
public function downCommand(): int
501501
{
502502
$url = $this->input->getArg('url');
503503

examples/Controller/InteractController.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ protected static function commandAliases(): array
4343
/**
4444
* This is a demo for use <magenta>Interact::confirm</magenta> method
4545
*/
46-
public function confirmCommand()
46+
public function confirmCommand(): void
4747
{
4848
// can also: $this->confirm();
4949
$a = Interact::confirm('continue');
@@ -54,7 +54,7 @@ public function confirmCommand()
5454
/**
5555
* This is a demo for use <magenta>Interact::select()</magenta> method
5656
*/
57-
public function selectCommand()
57+
public function selectCommand(): void
5858
{
5959
$opts = ['john', 'simon', 'rose'];
6060
// can also: $this->select();
@@ -66,7 +66,7 @@ public function selectCommand()
6666
/**
6767
* This is a demo for use <magenta>Interact::multiSelect()</magenta> method
6868
*/
69-
public function multiSelectCommand()
69+
public function multiSelectCommand(): void
7070
{
7171
$opts = ['john', 'simon', 'rose', 'tom'];
7272

@@ -79,7 +79,7 @@ public function multiSelectCommand()
7979
/**
8080
* This is a demo for use <magenta>Interact::ask()</magenta> method
8181
*/
82-
public function askCommand()
82+
public function askCommand(): void
8383
{
8484
$a = Interact::ask('you name is: ', null, function ($val, &$err) {
8585
if (!preg_match('/^\w{2,}$/', $val)) {
@@ -100,7 +100,7 @@ public function askCommand()
100100
* --nv Not use validator.
101101
* --limit limit times.(default: 3)
102102
*/
103-
public function limitedAskCommand()
103+
public function limitedAskCommand(): void
104104
{
105105
$times = (int)$this->input->getOpt('limit', 3);
106106

@@ -124,7 +124,7 @@ public function limitedAskCommand()
124124
* This is a demo for input password. use: <magenta>Interact::askPassword()</magenta>
125125
* @usage {fullCommand}
126126
*/
127-
public function passwordCommand()
127+
public function passwordCommand(): void
128128
{
129129
$pwd = $this->askPassword();
130130

@@ -134,7 +134,7 @@ public function passwordCommand()
134134
/**
135135
* This is a demo for show cursor move on the Terminal screen
136136
*/
137-
public function cursorCommand()
137+
public function cursorCommand(): void
138138
{
139139
$this->write('hello, this in ' . __METHOD__);
140140
$this->write('this is a message text.', false);

examples/Controller/ProcessController.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ protected static function commandAliases(): array
3636
/**
3737
* simple process example for child-process
3838
*/
39-
public function runScriptCommand()
39+
public function runScriptCommand(): void
4040
{
4141
/*$script = '<?php echo "foo"; ?>';*/
4242
$script = '<?php print_r($_SERVER); ?>';
@@ -79,7 +79,7 @@ public function runScriptCommand()
7979
/**
8080
* simple process example for child-process
8181
*/
82-
public function childProcessCommand()
82+
public function childProcessCommand(): void
8383
{
8484
$ret = ProcessUtil::create(function ($pid) {
8585
echo "print in process $pid";
@@ -96,7 +96,7 @@ public function childProcessCommand()
9696
* simple process example for daemon run
9797
* @throws \RuntimeException
9898
*/
99-
public function daemonRunCommand()
99+
public function daemonRunCommand(): void
100100
{
101101
$ret = ProcessUtil::daemonRun(function ($pid){
102102
$this->output->info("will running background by new process: $pid");
@@ -110,7 +110,7 @@ public function daemonRunCommand()
110110
/**
111111
* simple process example for run In Background
112112
*/
113-
public function runInBackgroundCommand()
113+
public function runInBackgroundCommand(): void
114114
{
115115
$script = '<?php print_r($_SERVER); ?>';
116116
$ret = Sys::execInBackground("php $script");
@@ -125,7 +125,7 @@ public function runInBackgroundCommand()
125125
* @options
126126
*
127127
*/
128-
public function multiProcessCommand()
128+
public function multiProcessCommand(): void
129129
{
130130

131131
}

examples/Controller/ShowController.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ protected function commonOptions(): array
4747
/**
4848
* output format message: title
4949
*/
50-
public function titleCommand()
50+
public function titleCommand(): int
5151
{
5252
$this->output->title('title show');
5353

@@ -89,7 +89,7 @@ public function sectionCommand(): int
8989
/**
9090
* output format message: panel
9191
*/
92-
public function panelCommand()
92+
public function panelCommand(): void
9393
{
9494
$data = [
9595
'application version' => '1.2.0',
@@ -205,7 +205,7 @@ public function emojiCommand(): int
205205
* --ln Display with line number
206206
* @param Input $in
207207
*/
208-
public function highlightCommand($in)
208+
public function highlightCommand($in): void
209209
{
210210
// $file = $this->app->getRootPath() . '/examples/routes.php';
211211
$file = $this->app->getRootPath() . '/src/Utils/Show.php';
@@ -219,7 +219,7 @@ public function highlightCommand($in)
219219
/**
220220
* output format message: helpPanel
221221
*/
222-
public function helpPanelCommand()
222+
public function helpPanelCommand(): void
223223
{
224224
Show::helpPanel([
225225
Show::HELP_DES => 'a help panel description text. (help panel show)',
@@ -240,7 +240,7 @@ public function helpPanelCommand()
240240
/**
241241
* output format message: tree
242242
*/
243-
public function treeCommand()
243+
public function treeCommand(): void
244244
{
245245
Show::tree([
246246
123,
@@ -268,7 +268,7 @@ public function treeCommand()
268268
/**
269269
* output format message: dump
270270
*/
271-
public function jsonCommand()
271+
public function jsonCommand(): void
272272
{
273273
$data = [
274274
[

0 commit comments

Comments
 (0)