From a56366eddc0731996011349c0518a431443552e7 Mon Sep 17 00:00:00 2001 From: Roberto B Date: Sun, 21 Nov 2021 11:53:03 +0100 Subject: [PATCH] fix psalm warnings --- Makefile | 11 +++++++---- app/Objects/ReportExecution.php | 16 +++++++++++++--- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 981c547..4c9062f 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY : help phpstan test coverage phpcs +.PHONY : help phpstan test coverage phpcs psalm .DEFAULT_GOAL:=help help: ## Show this help. @@ -7,6 +7,9 @@ help: ## Show this help. phpstan: ## Execute phpstan vendor/bin/phpstan analyse -c ./phpstan.neon --no-progress +psalm: ## execute psalm + vendor/bin/psalm + test: ## Execute phpunit php artisan test @@ -14,13 +17,13 @@ coverage: ## Execute the coverage test vendor/bin/phpunit --coverage-text phpcs: ## execute phpcs - phpcs --standard=PSR12 app + vendor/bin/phpcs --standard=PSR12 app phpfix: ## Fix some warnings from phpcs - phpcbf --standard=PSR12 app + vendor/bin/phpcbf --standard=PSR12 app git commit -m "Auto Fix PSR12 Style" . -allcheck: phpcs phpstan test ## it performs all check (phpcs, phpstan, tests) +allcheck: phpcs phpstan psalm test ## it performs all check (phpcs, phpstan, tests) push: allcheck ## It performs all check and then git push on the current branch git push origin HEAD diff --git a/app/Objects/ReportExecution.php b/app/Objects/ReportExecution.php index 3f5635a..6a7fc13 100644 --- a/app/Objects/ReportExecution.php +++ b/app/Objects/ReportExecution.php @@ -43,7 +43,7 @@ public function addWarning(string $label, string $value): void * @param string $style * @psalm-param array|string $value */ - public function addValue(string $label, $value, $style = ""): void + public function addValue(string $label, $value, string $style = ""): void { if (is_array($value)) { $value = implode(",", $value); @@ -54,11 +54,21 @@ public function addValue(string $label, $value, $style = ""): void $this->add($label, $value, true, self::LINE_TYPE_INFO); } - public function addValueInfo(string $label, mixed $value): void + /** + * @param string $label + * @param string|string[] $value + * @psalm-param array|string $value + */ + public function addValueInfo(string $label, $value): void { $this->addValue($label, $value, "info"); } - public function addValueComment(string $label, mixed $value): void + /** + * @param string $label + * @param string|string[] $value + * @psalm-param array|string $value + */ + public function addValueComment(string $label, $value): void { $this->addValue($label, $value, "comment"); }