Skip to content

Commit 4e959fc

Browse files
committed
run code inspection check, fix some errors
1 parent da86222 commit 4e959fc

File tree

11 files changed

+39
-11
lines changed

11 files changed

+39
-11
lines changed

README_en.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# console application lib
22

3-
[![License](https://img.shields.io/packagist/l/inhere/console.svg?style=flat-square)](LICENSE-2.0.txt)
3+
[![License](https://img.shields.io/packagist/l/inhere/console.svg?style=flat-square)](LICENSE)
44
[![Php Version](https://img.shields.io/badge/php-%3E=7.0-brightgreen.svg?maxAge=2592000)](https://packagist.org/packages/inhere/console)
55
[![Latest Stable Version](http://img.shields.io/packagist/v/inhere/console.svg)](https://packagist.org/packages/inhere/console)
66

examples/demo/cli-spinner.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public static function prompt($prompt, $masked=false, $limit=100)
6464
if ($masked) {
6565
`stty -echo`; // disable shell echo
6666
}
67-
$buffer = "";
67+
$buffer = '';
6868
$char = "";
6969
$f = fopen('php://stdin', 'r');
7070
while (strlen($buffer) < $limit) {

examples/demo/sf2_color.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public function setOption($option)
127127
implode(', ', array_keys(static::$availableOptions))
128128
));
129129
}
130-
if (!in_array(static::$availableOptions[$option], $this->options)) {
130+
if (!in_array(static::$availableOptions[$option], $this->options, true)) {
131131
$this->options[] = static::$availableOptions[$option];
132132
}
133133
}
@@ -147,7 +147,7 @@ public function unsetOption($option)
147147
implode(', ', array_keys(static::$availableOptions))
148148
));
149149
}
150-
$pos = array_search(static::$availableOptions[$option], $this->options);
150+
$pos = array_search(static::$availableOptions[$option], $this->options, true);
151151
if (false !== $pos) {
152152
unset($this->options[$pos]);
153153
}

src/AbstractCommand.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
use Inhere\Console\Util\FormatUtil;
2020
use Inhere\Console\Util\Helper;
2121
use Swoole\Coroutine;
22-
use Swoole\Event;
2322

2423
/**
2524
* Class AbstractCommand

src/Component/ConsoleRenderer.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,20 @@ public function dump(): void
3333
{
3434

3535
}
36+
37+
/**
38+
* @return FormatterInterface
39+
*/
40+
public function getFormatter(): FormatterInterface
41+
{
42+
return $this->formatter;
43+
}
44+
45+
/**
46+
* @param FormatterInterface $formatter
47+
*/
48+
public function setFormatter(FormatterInterface $formatter): void
49+
{
50+
$this->formatter = $formatter;
51+
}
3652
}

src/Component/PharCompiler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ private function createIteratorFilter(): \Closure
593593
$name = $file->getFilename();
594594

595595
// Skip hidden files and directories.
596-
if ($name[0] === '.') {
596+
if (\strpos($name, '.') === 0) {
597597
return false;
598598
}
599599

src/Component/Symbol/ArtFont.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class ArtFont
2727
private static $internalFonts = ['404', '500', 'error', 'no', 'ok', 'success', 'yes'];
2828

2929
/**
30-
* @var array<name:path>
30+
* @var array <name:path>
3131
*/
3232
private $groups = [];
3333

src/Controller.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
namespace Inhere\Console;
1010

11-
use Inhere\Console\AbstractCommand;
1211
use Inhere\Console\Face\ControllerInterface;
1312
use Inhere\Console\IO\Input;
1413
use Inhere\Console\IO\Output;

src/IO/Input/InputArguments.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,20 @@ public function add(string $name, int $mode = null, string $type = null, string
3232
{
3333

3434
}
35-
}
35+
36+
/**
37+
* @return array
38+
*/
39+
public function getArguments(): array
40+
{
41+
return $this->arguments;
42+
}
43+
44+
/**
45+
* @param array $arguments
46+
*/
47+
public function setArguments(array $arguments): void
48+
{
49+
$this->arguments = $arguments;
50+
}
51+
}

test/CommandTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
use Inhere\Console\IO\Input;
66
use Inhere\Console\IO\Output;
77
use PHPUnit\Framework\TestCase;
8-
use Inhere\Console\Command;
98

109
/**
1110
* Class CommandTest

0 commit comments

Comments
 (0)