diff --git a/rector.php b/rector.php index dac564c2..99a3024c 100644 --- a/rector.php +++ b/rector.php @@ -17,7 +17,7 @@ return RectorConfig::configure() ->withPaths(['src']) ->withPhpSets(php81: true) - //->withPreparedSets(deadCode: true, codingStyle: true, typeDeclarations: true) + ->withPreparedSets(deadCode: true, typeDeclarations: true) ->withSkip([ NullToStrictStringFuncCallArgRector::class, ClosureToArrowFunctionRector::class, diff --git a/src/Countries/Benin.php b/src/Countries/Benin.php index 7e797920..b6a5b9a5 100644 --- a/src/Countries/Benin.php +++ b/src/Countries/Benin.php @@ -354,6 +354,6 @@ protected function prepareHolidays( $holidays[$prefix.$label.' - Jour '.$range] = $holiday->addDays($range - 1); } - return array_filter($holidays, fn ($holiday) => $holiday->year == $filterYear); + return array_filter($holidays, fn ($holiday): bool => $holiday->year == $filterYear); } } diff --git a/src/Countries/Country.php b/src/Countries/Country.php index 4fbf79b7..c2a5b627 100644 --- a/src/Countries/Country.php +++ b/src/Countries/Country.php @@ -46,7 +46,7 @@ public function get(int $year, ?string $locale = null): array } uasort($translatedHolidays, - fn (CarbonImmutable $a, CarbonImmutable $b) => $a->timestamp <=> $b->timestamp + fn (CarbonImmutable $a, CarbonImmutable $b): int => $a->timestamp <=> $b->timestamp ); return $translatedHolidays; diff --git a/src/Countries/Czechia.php b/src/Countries/Czechia.php index 402aed2d..59786ed8 100644 --- a/src/Countries/Czechia.php +++ b/src/Countries/Czechia.php @@ -43,9 +43,9 @@ protected function allHolidays(int $year): array ]; $filteredHolidays = array_map( - static fn (array $holiday) => $holiday[0], + static fn (array $holiday): string => $holiday[0], array_filter($holidays, - static fn (array $holiday) => $holiday[1] === true + static fn (array $holiday): bool => $holiday[1] === true ) ); @@ -63,9 +63,9 @@ protected function variableHolidays(int $year): array ]; return array_map( - static fn (array $variableHoliday) => $variableHoliday[0], + static fn (array $variableHoliday): \Carbon\CarbonImmutable => $variableHoliday[0], array_filter($variableHolidays, - static fn (array $variableHoliday) => $variableHoliday[1] === true + static fn (array $variableHoliday): bool => $variableHoliday[1] === true ) ); } diff --git a/src/Countries/Morocco.php b/src/Countries/Morocco.php index 2d0ed9df..2b999263 100644 --- a/src/Countries/Morocco.php +++ b/src/Countries/Morocco.php @@ -139,7 +139,7 @@ private function islamicToGregorian(int $y, int $m, int $d): array * @param float $floatNum The floating-point number to be rounded. * @return float The rounded integer value. */ - private function intPart($floatNum) + private function intPart(int|float $floatNum): float { // Check if the floating-point number is negative if ($floatNum < -0.0000001) { diff --git a/src/Countries/Norway.php b/src/Countries/Norway.php index f2115d0c..c2091958 100644 --- a/src/Countries/Norway.php +++ b/src/Countries/Norway.php @@ -27,7 +27,7 @@ protected function variableHolidays(int $year): array { $easter = $this->easter($year); - $holidays = [ + return [ 'Skjærtorsdag' => $easter->subDays(3), 'Langfredag' => $easter->subDays(2), 'Første påskedag' => $easter, @@ -36,7 +36,5 @@ protected function variableHolidays(int $year): array 'Første pinsedag' => $easter->addDays(49), 'Andre pinsedag' => $easter->addDays(50), ]; - - return $holidays; } } diff --git a/src/Countries/Switzerland.php b/src/Countries/Switzerland.php index 60b3b688..e19004a7 100644 --- a/src/Countries/Switzerland.php +++ b/src/Countries/Switzerland.php @@ -335,7 +335,7 @@ public function regionalHolidays(int $year): array $regionalHolidays = array_filter( $regionallyDifferentHolidays, - fn ($key) => in_array($key, $currentRegion), + fn ($key): bool => in_array($key, $currentRegion), ARRAY_FILTER_USE_KEY ); diff --git a/src/Countries/Taiwan.php b/src/Countries/Taiwan.php index 762c2c89..a2351e79 100644 --- a/src/Countries/Taiwan.php +++ b/src/Countries/Taiwan.php @@ -28,7 +28,7 @@ protected function allHolidays(int $year): array /** @return array */ protected function variableHolidays(int $year): array { - return array_filter(array_map(fn ($date) => $this->lunarCalendar($date, $year), [ + return array_filter(array_map(fn ($date): ?string => $this->lunarCalendar($date, $year), [ '農曆春節-正月初一' => '01-01', '農曆春節-正月初二' => '01-02', '農曆春節-正月初三' => '01-03', diff --git a/src/Holidays.php b/src/Holidays.php index 4f27a579..53617142 100755 --- a/src/Holidays.php +++ b/src/Holidays.php @@ -60,7 +60,7 @@ public function isHoliday(CarbonInterface|string $date, Country|string|null $cou $holidays = array_column($holidays, 'date'); $formattedHolidays = array_map( - fn (string $holiday) => CarbonImmutable::parse($holiday)->format('Y-m-d'), + fn (string $holiday): string => CarbonImmutable::parse($holiday)->format('Y-m-d'), $holidays );