Skip to content

Commit c37a349

Browse files
committed
update some info, remove some class
1 parent 671fb7f commit c37a349

File tree

7 files changed

+22
-229
lines changed

7 files changed

+22
-229
lines changed

src/BuiltIn/DevServerCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class DevServerCommand extends Command
2222

2323
public static function aliases(): array
2424
{
25-
return ['devServer', 'dev-server', 'dev-serve'];
25+
return ['devServer', 'dev-server', 'dev-serve', 'dev:serve'];
2626
}
2727

2828
/**

src/BuiltIn/PharController.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ protected function configCompiler(string $dir): PharCompiler
129129
// use config file
130130
$configFile = $this->input->getSameOpt(['c', 'config']) ?: $dir . '/phar.build.inc';
131131

132-
if ($configFile && is_file($configFile)) {
132+
if ($configFile && \is_file($configFile)) {
133133
require $configFile;
134134

135135
return $compiler->in($dir);
@@ -166,16 +166,16 @@ public function unpackCommand($in, $out): int
166166
}
167167

168168
$basePath = $in->getPwd();
169-
$file = realpath($basePath . '/' . $path);
169+
$file = \realpath($basePath . '/' . $path);
170170

171-
if (!file_exists($file)) {
171+
if (!\file_exists($file)) {
172172
return $out->error("The phar file not exists. File: $file");
173173
}
174174

175175
$dir = $in->getSameOpt(['d', 'dir']) ?: $basePath;
176176
$overwrite = $in->getBoolOpt('overwrite');
177177

178-
if (!is_dir($dir)) {
178+
if (!\is_dir($dir)) {
179179
Helper::mkdir($dir);
180180
}
181181

src/Component/ArrBuffer.php

Lines changed: 0 additions & 115 deletions
This file was deleted.

src/Component/Formatter/Panel.php

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

99
namespace Inhere\Console\Component\Formatter;
1010

11-
use Inhere\Console\Component\StrBuffer;
11+
use Toolkit\StrUtil\StrBuffer;
1212
use Inhere\Console\Util\FormatUtil;
1313

1414
/**

src/Component/PharCompiler.php

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,7 @@ public function setModifies($modifies): self
326326
* @throws \UnexpectedValueException
327327
* @throws \BadMethodCallException
328328
* @throws \RuntimeException
329+
* @throws \Exception
329330
*/
330331
public function pack(string $pharFile, $refresh = true): string
331332
{
@@ -461,7 +462,6 @@ private function packFile(\Phar $phar, \SplFileInfo $file)
461462
// skip error
462463
if (!\file_exists($file)) {
463464
$this->reportError("File $file is not exists!");
464-
465465
return;
466466
}
467467

@@ -613,7 +613,6 @@ private function createIteratorFilter(): \Closure
613613
return true;
614614
}
615615
}
616-
617616
return false;
618617
}
619618

@@ -636,18 +635,18 @@ private function stripWhitespace(string $source): string
636635
}
637636

638637
$output = '';
639-
foreach (token_get_all($source) as $token) {
638+
foreach (\token_get_all($source) as $token) {
640639
if (\is_string($token)) {
641640
$output .= $token;
642-
} elseif (\in_array($token[0], [T_COMMENT, T_DOC_COMMENT], true)) {
643-
$output .= str_repeat("\n", substr_count($token[1], "\n"));
644-
} elseif (T_WHITESPACE === $token[0]) {
641+
} elseif (\in_array($token[0], [\T_COMMENT, \T_DOC_COMMENT], true)) {
642+
$output .= \str_repeat("\n", \substr_count($token[1], "\n"));
643+
} elseif (\T_WHITESPACE === $token[0]) {
645644
// reduce wide spaces
646-
$whitespace = preg_replace('{[ \t]+}', ' ', $token[1]);
645+
$whitespace = \preg_replace('{[ \t]+}', ' ', $token[1]);
647646
// normalize newlines to \n
648-
$whitespace = preg_replace('{(?:\r\n|\r|\n)}', "\n", $whitespace);
647+
$whitespace = \preg_replace('{(?:\r\n|\r|\n)}', "\n", $whitespace);
649648
// trim leading spaces
650-
$whitespace = preg_replace('{\n +}', "\n", $whitespace);
649+
$whitespace = \preg_replace('{\n +}', "\n", $whitespace);
651650
$output .= $whitespace;
652651
} else {
653652
$output .= $token[1];
@@ -677,7 +676,7 @@ private function collectInformation()
677676
);
678677
}
679678

680-
$this->version = trim($ret);
679+
$this->version = \trim($ret);
681680

682681
list($code, $ret,) = Sys::run('git log -n1 --pretty=%ci HEAD', $basePath);
683682

@@ -687,18 +686,18 @@ private function collectInformation()
687686
);
688687
}
689688

690-
$this->versionDate = new \DateTime(trim($ret));
689+
$this->versionDate = new \DateTime(\trim($ret));
691690
$this->versionDate->setTimezone(new \DateTimeZone('UTC'));
692691

693692
// 获取到最新的 tag
694693
list($code, $ret,) = Sys::run('git describe --tags --exact-match HEAD', $basePath);
695694
if ($code === 0) {
696-
$this->version = trim($ret);
695+
$this->version = \trim($ret);
697696
} else {
698697
list($code1, $ret,) = Sys::run('git branch', $basePath);
699698

700699
if ($code1 === 0) {
701-
$this->branchAliasVersion = \explode("\n", trim($ret, "* \n"), 2)[0];
700+
$this->branchAliasVersion = \explode("\n", \trim($ret, "* \n"), 2)[0];
702701
}
703702
}
704703
}
@@ -712,10 +711,10 @@ private function getRelativeFilePath($file): string
712711
$realPath = $file->getRealPath();
713712
$pathPrefix = $this->basePath . DIRECTORY_SEPARATOR;
714713

715-
$pos = strpos($realPath, $pathPrefix);
716-
$relativePath = $pos !== false ? substr_replace($realPath, '', $pos, \strlen($pathPrefix)) : $realPath;
714+
$pos = \strpos($realPath, $pathPrefix);
715+
$relativePath = $pos !== false ? \substr_replace($realPath, '', $pos, \strlen($pathPrefix)) : $realPath;
717716

718-
return str_replace('\\', '/', $relativePath);
717+
return \str_replace('\\', '/', $relativePath);
719718
}
720719

721720
/**
@@ -884,7 +883,6 @@ public function getBranchAliasVersion()
884883
public function setBranchAliasVersion(string $branchAliasVersion): PharCompiler
885884
{
886885
$this->branchAliasVersion = $branchAliasVersion;
887-
888886
return $this;
889887
}
890888

src/Component/StrBuffer.php

Lines changed: 0 additions & 90 deletions
This file was deleted.

src/Util/Show.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88

99
namespace Inhere\Console\Util;
1010

11-
use Inhere\Console\Component\StrBuffer;
1211
use Inhere\Console\Component\Style\Style;
1312
use Toolkit\Cli\Cli;
1413
use Toolkit\StrUtil\Str;
14+
use Toolkit\StrUtil\StrBuffer;
1515
use Toolkit\Sys\Sys;
1616

1717
/**

0 commit comments

Comments
 (0)