Skip to content

Commit

Permalink
run code styling set
Browse files Browse the repository at this point in the history
  • Loading branch information
Nielsvanpach committed Jun 15, 2024
1 parent e8b849f commit 8cbc750
Show file tree
Hide file tree
Showing 29 changed files with 62 additions and 54 deletions.
4 changes: 3 additions & 1 deletion rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Rector\CodingStyle\Rector\Closure\StaticClosureRector;
use Rector\CodingStyle\Rector\Encapsed\EncapsedStringsToSprintfRector;
use Rector\CodingStyle\Rector\If_\NullableCompareToNullRector;
use Rector\CodingStyle\Rector\PostInc\PostIncDecToPreIncDecRector;
use Rector\Config\RectorConfig;
use Rector\Php74\Rector\Closure\ClosureToArrowFunctionRector;
use Rector\Php81\Rector\FuncCall\NullToStrictStringFuncCallArgRector;
Expand All @@ -17,7 +18,7 @@
return RectorConfig::configure()
->withPaths(['src'])
->withPhpSets(php81: true)
->withPreparedSets(deadCode: true, typeDeclarations: true)
->withPreparedSets(deadCode: true, codingStyle: true, typeDeclarations: true)
->withSkip([
NullToStrictStringFuncCallArgRector::class,
ClosureToArrowFunctionRector::class,
Expand All @@ -29,4 +30,5 @@
NullableCompareToNullRector::class,
EncapsedStringsToSprintfRector::class,
CatchExceptionNameMatchingTypeRector::class,
PostIncDecToPreIncDecRector::class,
]);
2 changes: 1 addition & 1 deletion src/Countries/Bahrain.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public function defaultLocale(): string
protected function allHolidays(int $year): array
{
return array_merge([
'New Year\'s Day' => '1-1',
"New Year's Day" => '1-1',
'Labour Day' => '5-1',
'National Day' => '12-16',
'National Day 2' => '12-17',
Expand Down
2 changes: 1 addition & 1 deletion src/Countries/Benin.php
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ protected function getIslamicHolidays(
$currentYearHolidays = is_array($holidays[$year]) ? $holidays[$year] : [$holidays[$year]];

foreach ($currentYearHolidays as $currentYearHoliday) {
$currentYearHoliday = CarbonImmutable::createFromFormat('Y-m-d', "$year-$currentYearHoliday");
$currentYearHoliday = CarbonImmutable::createFromFormat('Y-m-d', "{$year}-{$currentYearHoliday}");

$islamicHolidays = array_merge($islamicHolidays, $this->prepareHolidays(
holiday: $currentYearHoliday,
Expand Down
2 changes: 1 addition & 1 deletion src/Countries/Canada.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public function countryCode(): string
protected function allHolidays(int $year): array
{
return array_merge([
'New Year\'s Day' => '01-01',
"New Year's Day" => '01-01',
'Canada Day' => '07-01',
'Civic Holiday' => 'first monday of August',
'Labour Day' => 'first monday of September',
Expand Down
4 changes: 2 additions & 2 deletions src/Countries/Ecuador.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function defaultLocale(): string
protected function allHolidays(int $year): array
{
return array_merge([
'New Year\'s Day' => '01-01',
"New Year's Day" => '01-01',
], $this->variableHolidays($year));
}

Expand Down Expand Up @@ -76,7 +76,7 @@ protected function variableHolidays(int $year): array
'Battle of Pichincha' => $this->nearestDay($year, 5, 24),
'Independence Day' => $this->nearestDay($year, 8, 10),
'Independence Of Guayaquil' => $this->nearestDay($year, 10, 9),
'All Souls\' Day' => $this->nearestDay($year, 11, 2),
"All Souls' Day" => $this->nearestDay($year, 11, 2),
'Independence Of Cuenca' => $this->nearestDay($year, 11, 3),
'Christmas' => $this->getChristmasHoliday($year),
];
Expand Down
2 changes: 1 addition & 1 deletion src/Countries/Egypt.php
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ public function defaultLocale(): string
protected function allHolidays(int $year): array
{
return array_merge([
'New Year\'s Day' => '1-1',
"New Year's Day" => '1-1',
'Flooding of the Nile' => '8-15',
'March Equinox' => '3-20',
'June Solstice' => '6-21',
Expand Down
14 changes: 7 additions & 7 deletions src/Countries/France.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function countryCode(): string
protected function allHolidays(int $year): array
{
return array_merge([
'Jour de l\'An' => '01-01',
"Jour de l'An" => '01-01',
'Fête du Travail' => '05-01',
'Victoire 1945' => '05-08',
'Fête Nationale' => '07-14',
Expand Down Expand Up @@ -55,12 +55,12 @@ protected function regionHolidays(): array
{
return match ($this->region) {
'FR-57', 'FR-67', 'FR-68' => ['Saint-Étienne' => '12-26'],
'FR-971', 'FR-MF' => ['Abolition de l\'esclavage' => '05-27'],
'FR-972' => ['Abolition de l\'esclavage' => '05-22'],
'FR-973' => ['Abolition de l\'esclavage' => '06-10'],
'FR-974' => ['Abolition de l\'esclavage' => '12-20'],
'FR-976' => ['Abolition de l\'esclavage' => '04-27'],
'FR-BL' => ['Abolition de l\'esclavage' => '10-09'],
'FR-971', 'FR-MF' => ["Abolition de l'esclavage" => '05-27'],
'FR-972' => ["Abolition de l'esclavage" => '05-22'],
'FR-973' => ["Abolition de l'esclavage" => '06-10'],
'FR-974' => ["Abolition de l'esclavage" => '12-20'],
'FR-976' => ["Abolition de l'esclavage" => '04-27'],
'FR-BL' => ["Abolition de l'esclavage" => '10-09'],
default => [],
};
}
Expand Down
4 changes: 4 additions & 0 deletions src/Countries/Germany.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ protected function regionHolidays(int $year): array
if ($year >= 2019) {
$beHolidays['Internationaler Frauentag'] = '03-08';
}

if ($year === 2020) {
$beHolidays['Tag der Befreiung'] = '05-08';
}
Expand Down Expand Up @@ -171,6 +172,7 @@ protected function regionHolidays(int $year): array
$snHolidays['Reformationstag'] = '10-31';

}

if ($year > 1994) {
$snHolidays['Buß- und Bettag'] = $this->getRepentanceAndPrayerDay($year);

Expand All @@ -183,6 +185,7 @@ protected function regionHolidays(int $year): array
$stHolidays['Reformationstag'] = '10-31';

}

if ($year >= 1991) {
$stHolidays['Heilige Drei Könige'] = '01-06';
}
Expand All @@ -191,6 +194,7 @@ protected function regionHolidays(int $year): array
if ($year >= 1990) {
$thHolidays['Reformationstag'] = '10-31';
}

if ($year >= 2019) {
$thHolidays['Weltkindertag'] = '09-20';
}
Expand Down
4 changes: 2 additions & 2 deletions src/Countries/Ghana.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ protected function allHolidays(int $year): array
protected function observedHolidays(int $year): array
{
$holidays = [
'New Year\'s Day' => '01-01',
"New Year's Day" => '01-01',
'Constitution Day' => '01-07',
'Independence Day' => '03-06',
'May Day' => '05-01',
'Founder\'s Day' => '08-04',
"Founder's Day" => '08-04',
'Kwame Nkrumah Memorial Day' => '09-21',
'Christmas Day' => '12-25',
'Boxing Day' => '12-26',
Expand Down
2 changes: 1 addition & 1 deletion src/Countries/Haiti.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ protected function allHolidays(int $year): array
'Jour des Aieux' => '01-2',
'Fête du Travail / Fête des Travailleurs' => '05-01',
'Jour du Drapeau et de l\'Université' => '05-18',
'L\'Assomption de Marie' => '08-15',
"L'Assomption de Marie" => '08-15',
'Anniversaire de la mort de Dessalines' => '10-17',
'Toussaint' => '11-01',
'Jour des Morts' => '11-02',
Expand Down
10 changes: 5 additions & 5 deletions src/Countries/Ireland.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ public function countryCode(): string
protected function allHolidays(int $year): array
{
return array_merge([
'New Year\'s Day' => '01-01',
'Saint Patrick\'s Day' => '03-17',
"New Year's Day" => '01-01',
"Saint Patrick's Day" => '03-17',
'Christmas Day' => '12-25',
'Saint Stephen\'s Day' => '12-26',
"Saint Stephen's Day" => '12-26',
], $this->variableHolidays($year));
}

Expand All @@ -33,13 +33,13 @@ protected function variableHolidays(int $year): array
];

if ($year >= 2023) {
$stBrigidsDay = (new CarbonImmutable("$year-02-01"))->startOfDay();
$stBrigidsDay = (new CarbonImmutable("{$year}-02-01"))->startOfDay();

if (! $stBrigidsDay->isFriday()) {
$stBrigidsDay = 'first monday of February';
}

$variableHolidays['St Brigid\'s Day'] = $stBrigidsDay;
$variableHolidays["St Brigid's Day"] = $stBrigidsDay;
}

return $variableHolidays;
Expand Down
2 changes: 1 addition & 1 deletion src/Countries/Jamaica.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ protected function allHolidays(int $year): array
protected function fixedHolidays(int $year): array
{
$holidays = [
'New Year\'s Day' => '01-01',
"New Year's Day" => '01-01',
'Labour Day' => '05-23',
'Emancipation Day' => '08-01',
'Independence Day' => '08-06',
Expand Down
6 changes: 3 additions & 3 deletions src/Countries/Mexico.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ protected function allHolidays(int $year): array
/** @return array<string, CarbonImmutable> */
protected function variableHolidays(int $year): array
{
$constitutionDay = (new CarbonImmutable("first monday of february $year"))
$constitutionDay = (new CarbonImmutable("first monday of february {$year}"))
->setTimezone('America/Mexico_City');

$benitoJuarezBirth = (new CarbonImmutable("third monday of March $year"))
$benitoJuarezBirth = (new CarbonImmutable("third monday of March {$year}"))
->setTimezone('America/Mexico_City');

$revolutionDay = (new CarbonImmutable("third monday of november $year"))
$revolutionDay = (new CarbonImmutable("third monday of november {$year}"))
->setTimezone('America/Mexico_City');

$holidays = [
Expand Down
2 changes: 1 addition & 1 deletion src/Countries/Montenegro.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function defaultLocale(): string
return 'sr';
}

public function allHolidays(int $year): array
protected function allHolidays(int $year): array
{
// Montenegro has two days off for most holidays
return array_merge([
Expand Down
6 changes: 3 additions & 3 deletions src/Countries/Morocco.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function defaultLocale(): string
protected function allHolidays(int $year): array
{
return array_merge([
'New Year\'s Day' => '01-01',
"New Year's Day" => '01-01',
'Proclamation of Independence Day' => '01-11',
'Amazigh New Year (ⵉⴹ ⵏ ⵢⵉⵏⵏⴰⵢⵔ)' => '01-14',
'Labour Day' => '05-01',
Expand Down Expand Up @@ -78,6 +78,7 @@ protected function variableHolidays(int $year): array
throw InvalidYear::yearTooLow(1976);
}
}

// Store the Gregorian date of the Islamic holiday
$islamicHolidaysOnGregorian[$holidayTitle] = CarbonImmutable::createFromFormat('Y-m-d', sprintf('%s-%s-%s', $GregorianDate['year'], $GregorianDate['month'], $GregorianDate['day']));
}
Expand All @@ -98,8 +99,7 @@ protected function variableHolidays(int $year): array
*/
private function islamicToGregorian(int $y, int $m, int $d): array
{
$delta = 0;
$jd = $this->intPart((11 * $y + 3) / 30) + 354 * $y + 30 * $m - $this->intPart(($m - 1) / 2) + $d + 1948440 - 385 + $delta;
$jd = $this->intPart((11 * $y + 3) / 30) + 354 * $y + 30 * $m - $this->intPart(($m - 1) / 2) + $d + 1948440 - 385;
if ($jd > 2299160) {
$l = $jd + 68569;
$n = $this->intPart((4 * $l) / 146097);
Expand Down
6 changes: 3 additions & 3 deletions src/Countries/NewZealand.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ protected function observedHolidays(int $year): array
{
//https://www.employment.govt.nz/leave-and-holidays/public-holidays/public-holidays-and-anniversary-dates/
$holidays = [
'New Year\'s Day' => '01-01',
'Day after New Year\'s Day' => '01-02',
"New Year's Day" => '01-01',
"Day after New Year's Day" => '01-02',
'Waitangi Day' => '02-06',
'ANZAC Day' => '04-25',
'Christmas Day' => '12-25',
Expand All @@ -39,7 +39,7 @@ protected function observedHolidays(int $year): array
//https://www.employment.govt.nz/leave-and-holidays/public-holidays/public-holidays-falling-on-a-weekend/
foreach ($holidays as $name => $date) {
$observedDay = match ($name) {
'Day after New Year\'s Day' => $this->secondOfJanuary($year),
"Day after New Year's Day" => $this->secondOfJanuary($year),
'Christmas Day' => $this->observedChristmasDay($year),
'Boxing Day' => $this->observedBoxingDay($year),
default => $this->weekendToNextMonday($date, $year),
Expand Down
4 changes: 2 additions & 2 deletions src/Countries/Nigeria.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ public function countryCode(): string
protected function allHolidays(int $year): array
{
return array_merge([
'New Year\'s Day' => '01-01',
'Worker\'s Day' => '05-01',
"New Year's Day" => '01-01',
"Worker's Day" => '05-01',
'Democracy Day' => '06-12',
'Independence Day' => '10-01',
'Christmas Day' => '12-25',
Expand Down
6 changes: 3 additions & 3 deletions src/Countries/NorthernIreland.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ protected function allHolidays(int $year): array
protected function observedHolidays(int $year): array
{
$holidays = [
'New Year\'s Day' => '01-01',
'St Patrick\'s Day' => '03-17',
'Battle of the Boyne (Orangemen\'s Day)' => '07-12',
"New Year's Day" => '01-01',
"St Patrick's Day" => '03-17',
"Battle of the Boyne (Orangemen's Day)" => '07-12',
'Christmas Day' => '12-25',
'Boxing Day' => '12-26',
];
Expand Down
2 changes: 1 addition & 1 deletion src/Countries/Philippines.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function countryCode(): string
protected function allHolidays(int $year): array
{
return array_merge([
'New Year\'s Day' => '01-01',
"New Year's Day" => '01-01',
'Araw ng Kagitingan' => '04-09',
'Labor Day' => '05-01',
'Independence Day' => '06-12',
Expand Down
4 changes: 2 additions & 2 deletions src/Countries/Scotland.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ protected function allHolidays(int $year): array
protected function observedHolidays(int $year): array
{
$holidays = [
'New Year\'s Day' => '01-01',
"New Year's Day" => '01-01',
'2nd January' => '01-02',
'St Andrew\'s Day' => '11-30',
"St Andrew's Day" => '11-30',
'Christmas Day' => '12-25',
'Boxing Day' => '12-26',
];
Expand Down
6 changes: 3 additions & 3 deletions src/Countries/SouthAfrica.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ protected function allHolidays(int $year): array
// https://en.wikipedia.org/wiki/Public_holidays_in_South_Africa
// https://www.gov.za/about-sa/public-holidays
$holidays = [
'New Year\'s Day' => '01-01',
"New Year's Day" => '01-01',
'Human Rights Day' => '03-21',
'Freedom Day' => '04-27',
'Workers\' Day' => '05-01',
"Workers' Day" => '05-01',
'Youth Day' => '06-16',
'National Women\'s Day' => '08-09',
"National Women's Day" => '08-09',
'Heritage Day' => '09-24',
'Day of Reconciliation' => '12-16',
'Christmas Day' => '12-25',
Expand Down
2 changes: 1 addition & 1 deletion src/Countries/Tanzania.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function countryCode(): string
protected function allHolidays(int $year): array
{
return array_merge([
'New Year\'s Day' => '01-01',
"New Year's Day" => '01-01',
'Labor Day' => '05-01',
'Saba Saba Day' => '07-07',
'Farmers Day (Nane Nane Day)' => '08-08',
Expand Down
6 changes: 3 additions & 3 deletions src/Countries/Tunisia.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,12 +251,12 @@ protected function allHolidays(int $year): array
}

return array_merge([
'New Year\'s Day' => '01-01',
"New Year's Day" => '01-01',
'Independence Day' => '03-20',
'Martyrs\' Day' => '04-09',
"Martyrs' Day" => '04-09',
'Labour Day' => '05-01',
'Republic Day' => '07-25',
'Women\'s Day' => '08-13',
"Women's Day" => '08-13',
'Evacuation Day' => '10-15',
], $revolutionHoliday, $this->islamicHolidays($year));
}
Expand Down
1 change: 1 addition & 0 deletions src/Countries/Turkmenistan.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ protected function getHijriYear(int $year, bool $nextYear = false): int
{
$formatter = $this->getIslamicFormatter();
$formatter->setPattern('yyyy');

$dateTime = DateTime::createFromFormat('d/m/Y', '01/01/'.($nextYear ? $year + 1 : $year));

return (int) $formatter->format($dateTime);
Expand Down
4 changes: 2 additions & 2 deletions src/Countries/UnitedStates.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public function countryCode(): string
protected function allHolidays(int $year): array
{
$holidays = array_merge([
'New Year\'s Day' => '01-01',
"New Year's Day" => '01-01',
'Independence Day' => '07-04',
'Veterans Day' => '11-11',
'Christmas' => '12-25',
Expand All @@ -30,7 +30,7 @@ protected function variableHolidays(): array
{
return [
'Martin Luther King Day' => 'third monday of January',
'Presidents\' Day' => 'third monday of February',
"Presidents' Day" => 'third monday of February',
'Memorial Day' => 'last monday of May',
'Labor Day' => 'first monday of September',
'Columbus Day' => 'second monday of October',
Expand Down
Loading

0 comments on commit 8cbc750

Please sign in to comment.