Skip to content

Commit

Permalink
fixes for phpstan
Browse files Browse the repository at this point in the history
  • Loading branch information
Nielsvanpach committed Jan 18, 2024
1 parent 4951179 commit 09e703e
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 19 deletions.
17 changes: 6 additions & 11 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
parameters:
ignoreErrors:
-
message: "#^Method Spatie\\\\Holidays\\\\Countries\\\\Belgium\\:\\:allHolidays\\(\\) should return array\\<string, Carbon\\\\CarbonImmutable\\> but returns array\\<string, Carbon\\\\CarbonImmutable\\|string\\>\\.$#"
count: 1
path: src/Countries/Belgium.php

-
message: "#^Argument of an invalid type array\\<int, string\\>\\|false supplied for foreach, only iterables are supported\\.$#"
count: 1
path: src/Countries/Country.php

-
message: "#^Method Spatie\\\\Holidays\\\\Countries\\\\Country\\:\\:get\\(\\) should return array\\<string, Carbon\\\\CarbonImmutable\\> but returns array\\<string, Carbon\\\\CarbonImmutable\\|false\\>\\.$#"
message: "#^Method Spatie\\\\Holidays\\\\Countries\\\\Country\\:\\:get\\(\\) should return array\\<string, Carbon\\\\CarbonImmutable\\|string\\> but returns array\\<string, Carbon\\\\CarbonImmutable\\|false\\>\\.$#"
count: 1
path: src/Countries/Country.php

Expand All @@ -20,11 +15,6 @@ parameters:
count: 1
path: src/Countries/Country.php

-
message: "#^Method Spatie\\\\Holidays\\\\Countries\\\\Hungary\\:\\:allHolidays\\(\\) should return array\\<string, Carbon\\\\CarbonImmutable\\> but returns array\\<string, Carbon\\\\CarbonImmutable\\|string\\>\\.$#"
count: 1
path: src/Countries/Hungary.php

-
message: "#^Cannot call method isSunday\\(\\) on Carbon\\\\CarbonImmutable\\|false\\.$#"
count: 1
Expand All @@ -44,3 +34,8 @@ parameters:
message: "#^Parameter \\#1 \\$callback of function array_map expects \\(callable\\(Carbon\\\\CarbonImmutable\\)\\: mixed\\)\\|null, Closure\\(string\\)\\: non\\-falsy\\-string given\\.$#"
count: 1
path: src/Holidays.php

-
message: "#^Property Spatie\\\\Holidays\\\\Holidays\\:\\:\\$holidays \\(array\\<string, Carbon\\\\CarbonImmutable\\>\\) does not accept array\\<string, Carbon\\\\CarbonImmutable\\|string\\>\\.$#"
count: 1
path: src/Holidays.php
1 change: 0 additions & 1 deletion src/Countries/Andorra.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ public function countryCode(): string
return 'ad';
}

/** @return array<string, CarbonImmutable> */
protected function allHolidays(int $year): array
{
return array_merge([
Expand Down
3 changes: 1 addition & 2 deletions src/Countries/Austria.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ public function countryCode(): string
return 'at';
}

/** @return array<string, CarbonImmutable> */
protected function allHolidays(int $year): array
{
return array_merge([
Expand All @@ -39,7 +38,7 @@ protected function variableHolidays(int $year): array
->setTimezone('Europe/Vienna');

return [
'Ostermontag' => $easter->addDay(1),
'Ostermontag' => $easter->addDay(),
'Christi Himmelfahrt' => $easter->addDays(39),
'Pfingstmontag' => $easter->addDays(50),
'Fronleichnam' => $easter->addDays(60),
Expand Down
1 change: 0 additions & 1 deletion src/Countries/Belgium.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ public function countryCode(): string
return 'be';
}

/** @return array<string, CarbonImmutable> */
protected function allHolidays(int $year): array
{
return array_merge([
Expand Down
1 change: 0 additions & 1 deletion src/Countries/Brazil.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ public function countryCode(): string
return 'br';
}

/** @return array<string, CarbonImmutable> */
protected function allHolidays(int $year): array
{
return array_merge([
Expand Down
2 changes: 1 addition & 1 deletion src/Countries/Country.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ abstract public function countryCode(): string;
/** @return array<string, string|CarbonImmutable> */
abstract protected function allHolidays(int $year): array;

/** @return array<string, CarbonImmutable> */
/** @return array<string, CarbonImmutable|string> */
public function get(int $year): array
{
$this->ensureYearCanBeCalculated($year);
Expand Down
1 change: 0 additions & 1 deletion src/Countries/Hungary.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ public function countryCode(): string
return 'hu';
}

/** @return array<string, CarbonImmutable> */
protected function allHolidays(int $year): array
{
return array_merge([
Expand Down
1 change: 0 additions & 1 deletion src/Countries/Netherlands.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ public function countryCode(): string
return 'nl';
}

/** @return array<string, string|CarbonImmutable> */
protected function allHolidays(int $year): array
{
return array_merge([
Expand Down

0 comments on commit 09e703e

Please sign in to comment.