Skip to content

Commit

Permalink
fix psalm warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
roberto-butti committed Nov 21, 2021
1 parent bb3fcc2 commit a56366e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
11 changes: 7 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY : help phpstan test coverage phpcs
.PHONY : help phpstan test coverage phpcs psalm
.DEFAULT_GOAL:=help

help: ## Show this help.
Expand All @@ -7,20 +7,23 @@ 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

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
16 changes: 13 additions & 3 deletions app/Objects/ReportExecution.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function addWarning(string $label, string $value): void
* @param string $style
* @psalm-param array<string>|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);
Expand All @@ -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>|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>|string $value
*/
public function addValueComment(string $label, $value): void
{
$this->addValue($label, $value, "comment");
}
Expand Down

0 comments on commit a56366e

Please sign in to comment.