Skip to content

Commit

Permalink
get phpstan up to date
Browse files Browse the repository at this point in the history
  • Loading branch information
Nielsvanpach committed Jan 12, 2024
1 parent 6a34389 commit d86ab1c
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 5 deletions.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
},
"scripts": {
"analyse": "vendor/bin/phpstan analyse",
"baseline": "vendor/bin/phpstan analyse --generate-baseline",
"test": "vendor/bin/pest",
"test-coverage": "vendor/bin/pest --coverage",
"format": "vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php --allow-risky=yes"
Expand Down
11 changes: 11 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
parameters:
ignoreErrors:
-
message: "#^Method Spatie\\\\Holidays\\\\Actions\\\\Belgium\\:\\:fixedHolidays\\(\\) should return array\\<string, Carbon\\\\CarbonImmutable\\> but returns array\\<string, Carbon\\\\CarbonImmutable\\|string\\|false\\>\\.$#"
count: 1
path: src/Actions/Belgium.php

-
message: "#^Call to an undefined method Pest\\\\PendingCalls\\\\TestCall\\:\\:expect\\(\\)\\.$#"
count: 1
path: tests/ArchTest.php
3 changes: 3 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
includes:
- phpstan-baseline.neon

parameters:
level: max
paths:
Expand Down
1 change: 0 additions & 1 deletion src/Actions/Belgium.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ class Belgium implements Executable
{
protected int $year;

/** @return array<string, CarbonImmutable> */
public function execute(int $year): array
{
$this->year = $year;
Expand Down
4 changes: 3 additions & 1 deletion src/Actions/Executable.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

namespace Spatie\Holidays\Actions;

use Carbon\CarbonImmutable;

interface Executable
{
/** @return array<string, string> */
/** @return array<string, CarbonImmutable> */
public function execute(int $year): array;
}
6 changes: 3 additions & 3 deletions src/Holidays.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class Holidays
{
/** @return array<string, CarbonImmutable> */
/** @var array<string, CarbonImmutable> */
protected array $holidays = [];

protected int $year;
Expand All @@ -25,7 +25,7 @@ public static function new(): static
return new static();
}

/** @return array{name: string, date: string} */
/** @return array<array{name: string, date: string}> */
public static function all(): array
{
return (new static())
Expand All @@ -43,7 +43,7 @@ public function country(string $countryCode): static
return new static(countryCode: $countryCode);
}

/** @return array<array{name: string, date: string} */
/** @return array<array{name: string, date: string}> */
public function get(): array
{
if ($this->holidays === []) {
Expand Down

0 comments on commit d86ab1c

Please sign in to comment.