Skip to content

Commit 0c5499e

Browse files
committed
refactor: fix use of concatenation with mixed types
Signed-off-by: Sacha Telgenhof <[email protected]>
1 parent 625e87d commit 0c5499e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+88
-88
lines changed

src/Yasumi/Provider/Australia/AustralianCapitalTerritory.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ protected function calculateQueensBirthday(): void
144144
$this->addHoliday(new Holiday(
145145
'queensBirthday',
146146
[],
147-
new \DateTime('second monday of june ' . $this->year, DateTimeZoneFactory::getDateTimeZone($this->timezone)),
147+
new \DateTime("second monday of june {$this->year}", DateTimeZoneFactory::getDateTimeZone($this->timezone)),
148148
$this->locale,
149149
Holiday::TYPE_OFFICIAL
150150
));
@@ -192,10 +192,10 @@ protected function calculateReconciliationDay(): void
192192
return;
193193
}
194194

195-
$date = new \DateTime($this->year . '-05-27', DateTimeZoneFactory::getDateTimeZone($this->timezone));
195+
$date = new \DateTime("{$this->year}-05-27", DateTimeZoneFactory::getDateTimeZone($this->timezone));
196196
$day = (int) $date->format('w');
197197
if (1 !== $day) {
198-
$date = $date->add(0 === $day ? new \DateInterval('P1D') : new \DateInterval('P' . (8 - $day) . 'D'));
198+
$date = $date->add(0 === $day ? new \DateInterval('P1D') : new \DateInterval(sprintf('P%dD', 8 - $day)));
199199
}
200200
$this->addHoliday(new Holiday('reconciliationDay', ['en' => 'Reconciliation Day'], $date, $this->locale));
201201
}

src/Yasumi/Provider/Australia/NewSouthWales.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ protected function calculateQueensBirthday(): void
111111
$this->addHoliday(new Holiday(
112112
'queensBirthday',
113113
[],
114-
new \DateTime('second monday of june ' . $this->year, DateTimeZoneFactory::getDateTimeZone($this->timezone)),
114+
new \DateTime("second monday of june {$this->year}", DateTimeZoneFactory::getDateTimeZone($this->timezone)),
115115
$this->locale,
116116
Holiday::TYPE_OFFICIAL
117117
));
@@ -140,7 +140,7 @@ protected function calculateBankHoliday(): void
140140
$this->addHoliday(new Holiday(
141141
'bankHoliday',
142142
['en' => 'Bank Holiday'],
143-
new \DateTime('first monday of august ' . $this->year, DateTimeZoneFactory::getDateTimeZone($this->timezone)),
143+
new \DateTime("first monday of august {$this->year}", DateTimeZoneFactory::getDateTimeZone($this->timezone)),
144144
$this->locale,
145145
Holiday::TYPE_BANK
146146
));

src/Yasumi/Provider/Australia/NorthernTerritory.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ protected function calculateQueensBirthday(): void
110110
$this->addHoliday(new Holiday(
111111
'queensBirthday',
112112
[],
113-
new \DateTime('second monday of june ' . $this->year, DateTimeZoneFactory::getDateTimeZone($this->timezone)),
113+
new \DateTime("second monday of june {$this->year}", DateTimeZoneFactory::getDateTimeZone($this->timezone)),
114114
$this->locale,
115115
Holiday::TYPE_OFFICIAL
116116
));
@@ -141,7 +141,7 @@ protected function calculatePicnicDay(): void
141141
$this->addHoliday(new Holiday(
142142
'picnicDay',
143143
['en' => 'Picnic Day'],
144-
new \DateTime('first monday of august ' . $this->year, DateTimeZoneFactory::getDateTimeZone($this->timezone)),
144+
new \DateTime("first monday of august {$this->year}", DateTimeZoneFactory::getDateTimeZone($this->timezone)),
145145
$this->locale,
146146
Holiday::TYPE_OFFICIAL
147147
));

src/Yasumi/Provider/Australia/Queensland.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ public function initialize(): void
6767
*/
6868
protected function calculateQueensBirthday(): void
6969
{
70-
$birthDay = 'first monday of october ' . $this->year;
70+
$birthDay = "first monday of october {$this->year}";
7171

7272
if ($this->year < 2012 || 2013 === $this->year || 2014 === $this->year || 2015 === $this->year) {
73-
$birthDay = 'second monday of june ' . $this->year;
73+
$birthDay = "second monday of june {$this->year}";
7474
}
7575

7676
$this->addHoliday(new Holiday(

src/Yasumi/Provider/Australia/Queensland/Brisbane.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function initialize(): void
6969
*/
7070
protected function calculatePeoplesDay(): void
7171
{
72-
$date = new \DateTime('first friday of august ' . $this->year, DateTimeZoneFactory::getDateTimeZone($this->timezone));
72+
$date = new \DateTime("first friday of august {$this->year}", DateTimeZoneFactory::getDateTimeZone($this->timezone));
7373
if ($date->format('d') < 5) {
7474
$date = $date->add(new \DateInterval('P7D'));
7575
}

src/Yasumi/Provider/Australia/SouthAustralia.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ protected function calculateQueensBirthday(): void
118118
$this->addHoliday(new Holiday(
119119
'queensBirthday',
120120
[],
121-
new \DateTime('second monday of june ' . $this->year, DateTimeZoneFactory::getDateTimeZone($this->timezone)),
121+
new \DateTime("second monday of june {$this->year}", DateTimeZoneFactory::getDateTimeZone($this->timezone)),
122122
$this->locale,
123123
Holiday::TYPE_OFFICIAL
124124
));
@@ -147,10 +147,10 @@ protected function calculateLabourDay(): void
147147
protected function calculateAdelaideCupDay(): void
148148
{
149149
if ($this->year >= 1973) {
150-
$cupDay = 'second monday of march ' . $this->year;
150+
$cupDay = "second monday of march {$this->year}";
151151

152152
if ($this->year < 2006) {
153-
$cupDay = 'third monday of may ' . $this->year;
153+
$cupDay = "third monday of may {$this->year}";
154154
}
155155

156156
$this->addHoliday(new Holiday(

src/Yasumi/Provider/Australia/Tasmania.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ protected function calculateQueensBirthday(): void
8383
$this->addHoliday(new Holiday(
8484
'queensBirthday',
8585
[],
86-
new \DateTime('second monday of june ' . $this->year, DateTimeZoneFactory::getDateTimeZone($this->timezone)),
86+
new \DateTime("second monday of june {$this->year}", DateTimeZoneFactory::getDateTimeZone($this->timezone)),
8787
$this->locale,
8888
Holiday::TYPE_OFFICIAL
8989
));
@@ -102,7 +102,7 @@ protected function calculateRecreationDay(): void
102102
$this->addHoliday(new Holiday(
103103
'recreationDay',
104104
['en' => 'Recreation Day'],
105-
new \DateTime('first monday of november ' . $this->year, DateTimeZoneFactory::getDateTimeZone($this->timezone)),
105+
new \DateTime("first monday of november {$this->year}", DateTimeZoneFactory::getDateTimeZone($this->timezone)),
106106
$this->locale,
107107
Holiday::TYPE_OFFICIAL
108108
));

src/Yasumi/Provider/Australia/Tasmania/CentralNorth.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function initialize(): void
5555
*/
5656
protected function calculateDevonportShow(): void
5757
{
58-
$date = new \DateTime($this->year . '-12-02', DateTimeZoneFactory::getDateTimeZone($this->timezone));
58+
$date = new \DateTime("{$this->year}-12-02", DateTimeZoneFactory::getDateTimeZone($this->timezone));
5959
$date = $date->modify('previous friday');
6060

6161
if (! $date instanceof \DateTime) {

src/Yasumi/Provider/Australia/Tasmania/FlindersIsland.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function initialize(): void
5555
*/
5656
protected function calculateFlindersIslandShow(): void
5757
{
58-
$date = new \DateTime('third saturday of october ' . $this->year, DateTimeZoneFactory::getDateTimeZone($this->timezone));
58+
$date = new \DateTime("third saturday of october {$this->year}", DateTimeZoneFactory::getDateTimeZone($this->timezone));
5959
$date = $date->sub(new \DateInterval('P1D'));
6060
$this->addHoliday(new Holiday('flindersIslandShow', ['en' => 'Flinders Island Show'], $date, $this->locale));
6161
}

src/Yasumi/Provider/Australia/Tasmania/KingIsland.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ protected function calculateKingIslandShow(): void
5858
$this->addHoliday(new Holiday(
5959
'kingIslandShow',
6060
['en' => 'King Island Show'],
61-
new \DateTime('first tuesday of march ' . $this->year, DateTimeZoneFactory::getDateTimeZone($this->timezone)),
61+
new \DateTime("first tuesday of march {$this->year}", DateTimeZoneFactory::getDateTimeZone($this->timezone)),
6262
$this->locale,
6363
Holiday::TYPE_OFFICIAL
6464
));

src/Yasumi/Provider/Australia/Tasmania/Northeast.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function initialize(): void
5555
*/
5656
protected function calculateLauncestonShow(): void
5757
{
58-
$date = new \DateTime('second saturday of october ' . $this->year, DateTimeZoneFactory::getDateTimeZone($this->timezone));
58+
$date = new \DateTime("second saturday of october {$this->year}", DateTimeZoneFactory::getDateTimeZone($this->timezone));
5959
$date = $date->sub(new \DateInterval('P2D'));
6060
$this->addHoliday(new Holiday('launcestonShow', ['en' => 'Royal Launceston Show'], $date, $this->locale));
6161
}

src/Yasumi/Provider/Australia/Tasmania/Northwest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function initialize(): void
5555
*/
5656
protected function calculateBurnieShow(): void
5757
{
58-
$date = new \DateTime('first saturday of october ' . $this->year, DateTimeZoneFactory::getDateTimeZone($this->timezone));
58+
$date = new \DateTime("first saturday of october {$this->year}", DateTimeZoneFactory::getDateTimeZone($this->timezone));
5959
$date = $date->sub(new \DateInterval('P1D'));
6060
$this->addHoliday(new Holiday('burnieShow', ['en' => 'Burnie Show'], $date, $this->locale));
6161
}

src/Yasumi/Provider/Australia/Tasmania/Northwest/CircularHead.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function initialize(): void
5555
*/
5656
protected function calculateAGFEST(): void
5757
{
58-
$date = new \DateTime('first thursday of may ' . $this->year, DateTimeZoneFactory::getDateTimeZone($this->timezone));
58+
$date = new \DateTime("first thursday of may {$this->year}", DateTimeZoneFactory::getDateTimeZone($this->timezone));
5959
$date = $date->add(new \DateInterval('P1D'));
6060
$this->addHoliday(new Holiday('agfest', ['en' => 'AGFEST'], $date, $this->locale));
6161
}

src/Yasumi/Provider/Australia/Tasmania/South.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function initialize(): void
5555
*/
5656
protected function calculateHobartShow(): void
5757
{
58-
$date = new \DateTime('fourth saturday of october ' . $this->year, DateTimeZoneFactory::getDateTimeZone($this->timezone));
58+
$date = new \DateTime("fourth saturday of october {$this->year}", DateTimeZoneFactory::getDateTimeZone($this->timezone));
5959
$date = $date->sub(new \DateInterval('P2D'));
6060
$this->addHoliday(new Holiday('hobartShow', ['en' => 'Royal Hobart Show'], $date, $this->locale));
6161
}

src/Yasumi/Provider/Australia/Tasmania/South/Southeast.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ protected function calculateHobartRegatta(): void
6161
$this->addHoliday(new Holiday(
6262
'hobartRegatta',
6363
['en' => 'Royal Hobart Regatta'],
64-
new \DateTime('second monday of february ' . $this->year, DateTimeZoneFactory::getDateTimeZone($this->timezone)),
64+
new \DateTime("second monday of february {$this->year}", DateTimeZoneFactory::getDateTimeZone($this->timezone)),
6565
$this->locale,
6666
Holiday::TYPE_OFFICIAL
6767
));

src/Yasumi/Provider/Australia/Victoria.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ protected function calculateQueensBirthday(): void
156156
$this->addHoliday(new Holiday(
157157
'queensBirthday',
158158
[],
159-
new \DateTime('second monday of june ' . $this->year, DateTimeZoneFactory::getDateTimeZone($this->timezone)),
159+
new \DateTime("second monday of june {$this->year}", DateTimeZoneFactory::getDateTimeZone($this->timezone)),
160160
$this->locale,
161161
Holiday::TYPE_OFFICIAL
162162
));
@@ -169,7 +169,7 @@ protected function calculateQueensBirthday(): void
169169
*/
170170
protected function calculateMelbourneCupDay(): void
171171
{
172-
$date = new \DateTime('first Tuesday of November' . " {$this->year}", DateTimeZoneFactory::getDateTimeZone($this->timezone));
172+
$date = new \DateTime("first Tuesday of November {$this->year}", DateTimeZoneFactory::getDateTimeZone($this->timezone));
173173

174174
$this->addHoliday(new Holiday('melbourneCup', ['en' => 'Melbourne Cup'], $date, $this->locale));
175175
}

src/Yasumi/Provider/Australia/WesternAustralia.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function initialize(): void
6868
*/
6969
protected function calculateQueensBirthday(): void
7070
{
71-
$birthDay = 'last monday of september ' . $this->year;
71+
$birthDay = "last monday of september {$this->year}";
7272
if (2011 === $this->year) {
7373
$birthDay = '2011-10-28';
7474
}
@@ -111,7 +111,7 @@ protected function calculateWesternAustraliaDay(): void
111111
$this->addHoliday(new Holiday(
112112
'westernAustraliaDay',
113113
['en' => 'Western Australia Day'],
114-
new \DateTime('first monday of june ' . $this->year, DateTimeZoneFactory::getDateTimeZone($this->timezone)),
114+
new \DateTime("first monday of june {$this->year}", DateTimeZoneFactory::getDateTimeZone($this->timezone)),
115115
$this->locale,
116116
Holiday::TYPE_OFFICIAL
117117
));

src/Yasumi/Provider/Austria.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ protected function calculateStLeopoldsDay(): void
9999
$this->addHoliday(new Holiday(
100100
'stLeopoldsDay',
101101
[],
102-
new \DateTime($this->year . '-11-15', new \DateTimeZone($this->timezone)),
102+
new \DateTime("{$this->year}-11-15", new \DateTimeZone($this->timezone)),
103103
$this->locale
104104
));
105105
}
@@ -127,7 +127,7 @@ protected function calculateNationalDay(): void
127127
$this->addHoliday(new Holiday(
128128
'nationalDay',
129129
['de' => 'Nationalfeiertag'],
130-
new \DateTime($this->year . '-10-26', new \DateTimeZone($this->timezone)),
130+
new \DateTime("{$this->year}-10-26", new \DateTimeZone($this->timezone)),
131131
$this->locale
132132
));
133133
}

src/Yasumi/Provider/Austria/Carinthia.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ protected function calculatePlebisciteDay(): void
7373
$this->addHoliday(new Holiday(
7474
'plebisciteDay',
7575
[],
76-
new \DateTime($this->year . '-10-10', new \DateTimeZone($this->timezone)),
76+
new \DateTime("{$this->year}-10-10", new \DateTimeZone($this->timezone)),
7777
$this->locale
7878
));
7979
}

src/Yasumi/Provider/Austria/Salzburg.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ protected function calculateStRupertsDay(): void
7474
$this->addHoliday(new Holiday(
7575
'stRupertsDay',
7676
[],
77-
new \DateTime($this->year . '-9-24', new \DateTimeZone($this->timezone)),
77+
new \DateTime("{$this->year}-9-24", new \DateTimeZone($this->timezone)),
7878
$this->locale
7979
));
8080
}

src/Yasumi/Provider/Austria/UpperAustria.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ protected function calculateStFloriansDay(): void
7575
$this->addHoliday(new Holiday(
7676
'stFloriansDay',
7777
[],
78-
new \DateTime($this->year . '-5-4', new \DateTimeZone($this->timezone)),
78+
new \DateTime("{$this->year}-5-4", new \DateTimeZone($this->timezone)),
7979
$this->locale
8080
));
8181
}

src/Yasumi/Provider/Canada.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,9 @@ protected function calculateCanadaDay(): void
178178
if ($this->year < 1983) {
179179
return;
180180
}
181-
$date = new \DateTime($this->year . '-07-01', DateTimeZoneFactory::getDateTimeZone($this->timezone));
181+
$date = new \DateTime("{$this->year}-07-01", DateTimeZoneFactory::getDateTimeZone($this->timezone));
182182
if (7 === (int) $date->format('N')) {
183-
$date = new \DateTime($this->year . '-07-02', DateTimeZoneFactory::getDateTimeZone($this->timezone));
183+
$date = new \DateTime("{$this->year}-07-02", DateTimeZoneFactory::getDateTimeZone($this->timezone));
184184
}
185185
$this->addHoliday(new Holiday(
186186
'canadaDay',

src/Yasumi/Provider/Canada/NewfoundlandAndLabrador.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ protected function calculateStPatricksDay(): void
8080
$holiday = new Holiday(
8181
'stPatricksDay',
8282
['en' => 'St. Patrick’s Day'],
83-
new \DateTime($this->year . '-3-17', DateTimeZoneFactory::getDateTimeZone($this->timezone)),
83+
new \DateTime("{$this->year}-3-17", DateTimeZoneFactory::getDateTimeZone($this->timezone)),
8484
$this->locale,
8585
Holiday::TYPE_BANK
8686
);
@@ -124,7 +124,7 @@ protected function calculateOrangemensDay(): void
124124
$holiday = new Holiday(
125125
'orangemensDay',
126126
[],
127-
new \DateTime($this->year . '-7-12', DateTimeZoneFactory::getDateTimeZone($this->timezone)),
127+
new \DateTime("{$this->year}-7-12", DateTimeZoneFactory::getDateTimeZone($this->timezone)),
128128
$this->locale,
129129
Holiday::TYPE_BANK
130130
);

src/Yasumi/Provider/ChristianHolidays.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ protected function calculateEaster(int $year, string $timezone): \DateTimeInterf
384384
}
385385

386386
$easter = new \DateTime("{$year}-3-21", DateTimeZoneFactory::getDateTimeZone($timezone));
387-
$easter->add(new \DateInterval('P' . $easterDays . 'D'));
387+
$easter->add(new \DateInterval(sprintf('P%dD', $easterDays)));
388388

389389
return $easter;
390390
}

src/Yasumi/Provider/CzechRepublic.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ protected function calculateRenewalOfCzechIndependenceDay(): void
9090
'cs' => 'Den obnovy samostatného českého státu',
9191
'en' => 'Day of renewal of the independent Czech state',
9292
],
93-
new \DateTime($this->year . '-01-01', new \DateTimeZone($this->timezone)),
93+
new \DateTime("{$this->year}-01-01", new \DateTimeZone($this->timezone)),
9494
$this->locale
9595
));
9696
}
@@ -123,7 +123,7 @@ protected function calculateSaintsCyrilAndMethodiusDay(): void
123123
'cs' => 'Den slovanských věrozvěstů Cyrila a Metoděje',
124124
'en' => 'Saints Cyril and Methodius Day',
125125
],
126-
new \DateTime($this->year . '-07-5', new \DateTimeZone($this->timezone)),
126+
new \DateTime("{$this->year}-07-5", new \DateTimeZone($this->timezone)),
127127
$this->locale
128128
));
129129
}
@@ -147,7 +147,7 @@ protected function calculateJanHusDay(): void
147147
$this->addHoliday(new Holiday(
148148
'janHusDay',
149149
['cs' => 'Den upálení mistra Jana Husa', 'en' => 'Jan Hus Day'],
150-
new \DateTime($this->year . '-07-6', new \DateTimeZone($this->timezone)),
150+
new \DateTime("{$this->year}-07-6", new \DateTimeZone($this->timezone)),
151151
$this->locale
152152
));
153153
}
@@ -177,7 +177,7 @@ protected function calculateCzechStatehoodDay(): void
177177
'cs' => 'Den české státnosti',
178178
'en' => 'St. Wenceslas Day (Czech Statehood Day)',
179179
],
180-
new \DateTime($this->year . '-09-28', new \DateTimeZone($this->timezone)),
180+
new \DateTime("{$this->year}-09-28", new \DateTimeZone($this->timezone)),
181181
$this->locale
182182
));
183183
}
@@ -196,7 +196,7 @@ protected function calculateIndependentCzechoslovakStateDay(): void
196196
$this->addHoliday(new Holiday('independentCzechoslovakStateDay', [
197197
'cs' => 'Den vzniku samostatného československého státu',
198198
'en' => 'Independent Czechoslovak State Day',
199-
], new \DateTime($this->year . '-10-28', new \DateTimeZone($this->timezone)), $this->locale));
199+
], new \DateTime("{$this->year}-10-28", new \DateTimeZone($this->timezone)), $this->locale));
200200
}
201201

202202
/**
@@ -216,7 +216,7 @@ protected function calculateStruggleForFreedomAndDemocracyDay(): void
216216
'cs' => 'Den boje za svobodu a demokracii',
217217
'en' => 'Struggle for Freedom and Democracy Day',
218218
],
219-
new \DateTime($this->year . '-11-17', new \DateTimeZone($this->timezone)),
219+
new \DateTime("{$this->year}-11-17", new \DateTimeZone($this->timezone)),
220220
$this->locale
221221
));
222222
}

src/Yasumi/Provider/Germany.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ protected function calculateGermanUnityDay(): void
9898
$this->addHoliday(new Holiday(
9999
'germanUnityDay',
100100
['de' => 'Tag der Deutschen Einheit'],
101-
new \DateTime($this->year . '-10-3', new \DateTimeZone($this->timezone)),
101+
new \DateTime("{$this->year}-10-3", new \DateTimeZone($this->timezone)),
102102
$this->locale
103103
));
104104
}

0 commit comments

Comments
 (0)