Skip to content

Commit

Permalink
PHP CS Fixer - ordered_types (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
SmetDenis authored Oct 14, 2023
1 parent 64c7512 commit 14e501c
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ vendor
phpunit.xml
composer.lock
*.cache
DemoTest.php
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions src/CliCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 = '<yellow-r>Question:</yellow-r> ' . \trim($question);

Expand Down
4 changes: 2 additions & 2 deletions src/OutputMods/AbstractOutputMode.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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));

Expand Down
2 changes: 1 addition & 1 deletion src/ProgressBars/ProgressBar.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/ProgressBars/ProgressBarLight.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
4 changes: 2 additions & 2 deletions src/ProgressBars/ProgressBarSymfony.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,15 +212,15 @@ 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);
$this->progressBar->setMessage($stepIndex . ': ', 'jbzoo_current_index');
}
}

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');
Expand Down

0 comments on commit 14e501c

Please sign in to comment.