From 14e501c937a5cfd5feb6b354a72c74f985f81630 Mon Sep 17 00:00:00 2001 From: Denis Smetannikov Date: Sat, 14 Oct 2023 23:11:18 +0300 Subject: [PATCH] PHP CS Fixer - `ordered_types` (#22) --- .gitignore | 1 + Makefile | 7 +++++++ src/CliCommand.php | 6 +++--- src/OutputMods/AbstractOutputMode.php | 4 ++-- src/ProgressBars/ProgressBar.php | 2 +- src/ProgressBars/ProgressBarLight.php | 2 +- src/ProgressBars/ProgressBarSymfony.php | 4 ++-- 7 files changed, 17 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index cd4f025..f4b63e5 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,4 @@ vendor phpunit.xml composer.lock *.cache +DemoTest.php diff --git a/Makefile b/Makefile index d1139a2..ee32dd5 100644 --- a/Makefile +++ b/Makefile @@ -26,3 +26,10 @@ test-all: ##@Project Run all project tests at once @make test @make codestyle @make codestyle PATH_SRC=./demo + + +test-logstash: ##@Project Run Logstash manual tests (direct) + rm -f $(PATH_BUILD)/logstash.log + $(PHP_BIN) $(PATH_ROOT)/demo/my-app test --output-mode=logstash >> $(PATH_BUILD)/logstash.log 2>&1 + cat $(PATH_BUILD)/logstash.log | jq + cat $(PATH_BUILD)/logstash.log | nc -c localhost 50000 diff --git a/src/CliCommand.php b/src/CliCommand.php index 06b4c80..ce8193f 100644 --- a/src/CliCommand.php +++ b/src/CliCommand.php @@ -44,7 +44,7 @@ abstract class CliCommand extends Command abstract protected function executeAction(): int; public function progressBar( - iterable|int $listOrMax, + int|iterable $listOrMax, \Closure $callback, string $title = '', bool $throwBatchException = true, @@ -305,7 +305,7 @@ protected function getOptDatetime( * @SuppressWarnings(PHPMD.CamelCaseMethodName) */ protected function _( - iterable|string|int|float|bool|null $messages = '', + null|bool|float|int|iterable|string $messages = '', string $verboseLevel = '', array $context = [], ): void { @@ -402,7 +402,7 @@ protected function confirmation(string $question = 'Are you sure?', bool $defaul /** * @param string[] $options */ - protected function askOption(string $question, array $options, int|float|string|null $default = null): string + protected function askOption(string $question, array $options, null|float|int|string $default = null): string { $question = 'Question: ' . \trim($question); diff --git a/src/OutputMods/AbstractOutputMode.php b/src/OutputMods/AbstractOutputMode.php index 4c7f411..e88f0a1 100644 --- a/src/OutputMods/AbstractOutputMode.php +++ b/src/OutputMods/AbstractOutputMode.php @@ -103,7 +103,7 @@ public function getErrOutput(): OutputInterface * @SuppressWarnings(PHPMD.CamelCaseMethodName) */ public function _( - iterable|float|int|bool|string|null $messages = '', + null|bool|float|int|iterable|string $messages = '', string $verboseLevel = OutLvl::DEFAULT, array $context = [], ): void { @@ -257,7 +257,7 @@ protected function getProfileInfo(): array return $result; } - protected function prepareMessages(iterable|float|int|bool|string|null $messages, string $verboseLevel): ?string + protected function prepareMessages(null|bool|float|int|iterable|string $messages, string $verboseLevel): ?string { $verboseLevel = \strtolower(\trim($verboseLevel)); diff --git a/src/ProgressBars/ProgressBar.php b/src/ProgressBars/ProgressBar.php index eaee54c..c391eb1 100644 --- a/src/ProgressBars/ProgressBar.php +++ b/src/ProgressBars/ProgressBar.php @@ -24,7 +24,7 @@ class ProgressBar extends ProgressBarSymfony { public static function run( - iterable|int $listOrMax, + int|iterable $listOrMax, \Closure $callback, string $title = '', bool $throwBatchException = true, diff --git a/src/ProgressBars/ProgressBarLight.php b/src/ProgressBars/ProgressBarLight.php index 666a0a8..86b1773 100644 --- a/src/ProgressBars/ProgressBarLight.php +++ b/src/ProgressBars/ProgressBarLight.php @@ -80,7 +80,7 @@ private function init(): bool return true; } - private function handleOneStep(mixed $stepValue, int|float|string $stepIndex, int $currentIndex): array + private function handleOneStep(mixed $stepValue, float|int|string $stepIndex, int $currentIndex): array { if ($this->callback === null) { throw new Exception('Callback function is not defined'); diff --git a/src/ProgressBars/ProgressBarSymfony.php b/src/ProgressBars/ProgressBarSymfony.php index 5914d92..9f76fbe 100644 --- a/src/ProgressBars/ProgressBarSymfony.php +++ b/src/ProgressBars/ProgressBarSymfony.php @@ -212,7 +212,7 @@ private function init(): bool return true; } - private function setStep(int|float|string $stepIndex, int $currentIndex): void + private function setStep(float|int|string $stepIndex, int $currentIndex): void { if ($this->progressBar !== null) { $this->progressBar->setProgress($currentIndex); @@ -220,7 +220,7 @@ private function setStep(int|float|string $stepIndex, int $currentIndex): void } } - private function handleOneStep(mixed $stepValue, int|float|string $stepIndex, int $currentIndex): array + private function handleOneStep(mixed $stepValue, float|int|string $stepIndex, int $currentIndex): array { if ($this->callback === null) { throw new Exception('Callback function is not defined');