diff --git a/app/Console/Controller/GitController.php b/app/Console/Controller/GitController.php index 0d6feba..bae787e 100644 --- a/app/Console/Controller/GitController.php +++ b/app/Console/Controller/GitController.php @@ -805,8 +805,8 @@ public function logCommand(FlagsParser $fs, Output $output): void * wl word length filter. * --format The git log option `--pretty` value. * can be one of oneline, short, medium, full, fuller, reference, email, raw, format: and tformat:. - * --style The style for generate for changelog. - * allow: markdown(default), simple, gh-release + * -s, --style The style for generate for changelog. + * allow: markdown(default), simple, gh-release(ghr) * --repo-url The git repo URL address. eg: https://github.com/inhere/kite * default will auto use current git origin remote url * --no-merges bool;No contains merge request logs @@ -893,7 +893,7 @@ public function changelogCommand(FlagsParser $fs, Output $output): void } $style = $fs->getOpt('style'); - if ($style === 'gh-release') { + if ($style === 'ghr' || $style === 'gh-release') { $gcl->setItemFormatter(new GithubReleaseFormatter()); } elseif ($style === 'simple') { $gcl->setItemFormatter(new SimpleFormatter()); diff --git a/app/Lib/Jump/JumpStorage.php b/app/Lib/Jump/JumpStorage.php index 3475e90..53ca47a 100644 --- a/app/Lib/Jump/JumpStorage.php +++ b/app/Lib/Jump/JumpStorage.php @@ -20,7 +20,6 @@ use function md5; use function str_replace; use function stripos; -use function strpos; use const JSON_PRETTY_PRINT; use const JSON_UNESCAPED_SLASHES; @@ -38,22 +37,22 @@ class JumpStorage implements JsonSerializable /** * @var string */ - private $datafile; + private string $datafile; /** * @var bool */ - private $dataChanged = false; + private bool $dataChanged = false; /** * @var string */ - private $prevPath = ''; + private string $prevPath = ''; /** * @var string */ - private $lastPath = ''; + private string $lastPath = ''; /** * Named jump paths. @@ -68,7 +67,7 @@ class JumpStorage implements JsonSerializable * * @var array */ - private $namedPaths = []; + private array $namedPaths = []; /** * @@ -83,12 +82,12 @@ class JumpStorage implements JsonSerializable * * @var string[] */ - private $histories = []; + private array $histories = []; /** * @var bool */ - private $windowsOS; + private bool $windowsOS; /** * Class constructor. @@ -285,7 +284,7 @@ public function matchOne(string $keywords): string } foreach ($this->histories as $path) { - if (strpos($path, $keywords) !== false) { + if (str_contains($path, $keywords)) { return $path; } } @@ -372,6 +371,7 @@ public function formatPath(string $path): string /** * @return string + * @throws \JsonException */ public function __toString(): string { @@ -380,6 +380,7 @@ public function __toString(): string /** * @return string + * @throws \JsonException */ public function toString(): string { @@ -418,11 +419,11 @@ public function genID(string $path): string * Specify data which should be serialized to JSON * * @link https://php.net/manual/en/jsonserializable.jsonserialize.php - * @return mixed data which can be serialized by json_encode, + * @return array data which can be serialized by json_encode, * which is a value of any type other than a resource. * @since 5.4 */ - public function jsonSerialize() + public function jsonSerialize(): array { return $this->toArray(); } diff --git a/app/func.php b/app/func.php index b3d9bbc..bb49c1f 100644 --- a/app/func.php +++ b/app/func.php @@ -1 +1,14 @@