@@ -226,14 +226,12 @@ |
||
226 | 226 | $startOfWeek = $this->avoidMutation()->startOfWeek($weekStartsAt); |
227 | 227 | |
228 | 228 | return $startOfWeek != $this ? |
229 | - $this->startOfWeek($weekStartsAt)->addWeek() : |
|
230 | - $this; |
|
229 | + $this->startOfWeek($weekStartsAt)->addWeek() : $this; |
|
231 | 230 | } |
232 | 231 | |
233 | 232 | $startOfWeek = $this->startOfWeek($weekStartsAt); |
234 | 233 | |
235 | 234 | return $startOfWeek != $this ? |
236 | - $startOfWeek->addWeek() : |
|
237 | - $this->avoidMutation(); |
|
235 | + $startOfWeek->addWeek() : $this->avoidMutation(); |
|
238 | 236 | } |
239 | 237 | } |
@@ -437,7 +437,7 @@ |
||
437 | 437 | */ |
438 | 438 | public function __debugInfo() |
439 | 439 | { |
440 | - $infos = array_filter(get_object_vars($this), function ($var) { |
|
440 | + $infos = array_filter(get_object_vars($this), function($var) { |
|
441 | 441 | return $var; |
442 | 442 | }); |
443 | 443 |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | */ |
287 | 287 | public function diffInWeekdays($date = null, $absolute = true) |
288 | 288 | { |
289 | - return $this->diffInDaysFiltered(function (CarbonInterface $date) { |
|
289 | + return $this->diffInDaysFiltered(function(CarbonInterface $date) { |
|
290 | 290 | return $date->isWeekday(); |
291 | 291 | }, $date, $absolute); |
292 | 292 | } |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | */ |
302 | 302 | public function diffInWeekendDays($date = null, $absolute = true) |
303 | 303 | { |
304 | - return $this->diffInDaysFiltered(function (CarbonInterface $date) { |
|
304 | + return $this->diffInDaysFiltered(function(CarbonInterface $date) { |
|
305 | 305 | return $date->isWeekend(); |
306 | 306 | }, $date, $absolute); |
307 | 307 | } |
@@ -455,7 +455,7 @@ |
||
455 | 455 | */ |
456 | 456 | public function change($modifier) |
457 | 457 | { |
458 | - return $this->modify(preg_replace_callback('/^(next|previous|last)\s+(\d{1,2}(h|am|pm|:\d{1,2}(:\d{1,2})?))$/i', function ($match) { |
|
458 | + return $this->modify(preg_replace_callback('/^(next|previous|last)\s+(\d{1,2}(h|am|pm|:\d{1,2}(:\d{1,2})?))$/i', function($match) { |
|
459 | 459 | $match[2] = str_replace('h', ':00', $match[2]); |
460 | 460 | $test = $this->avoidMutation()->modify($match[2]); |
461 | 461 | $method = $match[1] === 'next' ? 'lt' : 'gt'; |
@@ -103,7 +103,7 @@ |
||
103 | 103 | foreach (self::getMixableMethods($context) as $name) { |
104 | 104 | $closureBase = Closure::fromCallable([$context, $name]); |
105 | 105 | |
106 | - static::macro($name, function () use ($closureBase, $className) { |
|
106 | + static::macro($name, function() use ($closureBase, $className) { |
|
107 | 107 | /** @phpstan-ignore-next-line */ |
108 | 108 | $context = isset($this) ? $this->cast($className) : new $className(); |
109 | 109 |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | 'minute', |
392 | 392 | 'second', |
393 | 393 | ], $messages, $key) : [], |
394 | - $mode & CarbonInterface::TRANSLATE_MERIDIEM ? array_map(function ($hour) use ($meridiem) { |
|
394 | + $mode & CarbonInterface::TRANSLATE_MERIDIEM ? array_map(function($hour) use ($meridiem) { |
|
395 | 395 | if (\is_array($meridiem)) { |
396 | 396 | return $meridiem[$hour < 12 ? 0 : 1]; |
397 | 397 | } |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | ); |
402 | 402 | } |
403 | 403 | |
404 | - return substr(preg_replace_callback('/(?<=[\d\s+.\/,_-])('.implode('|', $fromTranslations).')(?=[\d\s+.\/,_-])/iu', function ($match) use ($fromTranslations, $toTranslations) { |
|
404 | + return substr(preg_replace_callback('/(?<=[\d\s+.\/,_-])('.implode('|', $fromTranslations).')(?=[\d\s+.\/,_-])/iu', function($match) use ($fromTranslations, $toTranslations) { |
|
405 | 405 | [$chunk] = $match; |
406 | 406 | |
407 | 407 | foreach ($fromTranslations as $index => $word) { |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | */ |
557 | 557 | public static function localeHasShortUnits($locale) |
558 | 558 | { |
559 | - return static::executeWithLocale($locale, function ($newLocale, TranslatorInterface $translator) { |
|
559 | + return static::executeWithLocale($locale, function($newLocale, TranslatorInterface $translator) { |
|
560 | 560 | return ($newLocale && (($y = static::translateWith($translator, 'y')) !== 'y' && $y !== static::translateWith($translator, 'year'))) || ( |
561 | 561 | ($y = static::translateWith($translator, 'd')) !== 'd' && |
562 | 562 | $y !== static::translateWith($translator, 'day') |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | */ |
578 | 578 | public static function localeHasDiffSyntax($locale) |
579 | 579 | { |
580 | - return static::executeWithLocale($locale, function ($newLocale, TranslatorInterface $translator) { |
|
580 | + return static::executeWithLocale($locale, function($newLocale, TranslatorInterface $translator) { |
|
581 | 581 | if (!$newLocale) { |
582 | 582 | return false; |
583 | 583 | } |
@@ -608,7 +608,7 @@ discard block |
||
608 | 608 | */ |
609 | 609 | public static function localeHasDiffOneDayWords($locale) |
610 | 610 | { |
611 | - return static::executeWithLocale($locale, function ($newLocale, TranslatorInterface $translator) { |
|
611 | + return static::executeWithLocale($locale, function($newLocale, TranslatorInterface $translator) { |
|
612 | 612 | return $newLocale && |
613 | 613 | $translator->trans('diff_now') !== 'diff_now' && |
614 | 614 | $translator->trans('diff_yesterday') !== 'diff_yesterday' && |
@@ -626,7 +626,7 @@ discard block |
||
626 | 626 | */ |
627 | 627 | public static function localeHasDiffTwoDayWords($locale) |
628 | 628 | { |
629 | - return static::executeWithLocale($locale, function ($newLocale, TranslatorInterface $translator) { |
|
629 | + return static::executeWithLocale($locale, function($newLocale, TranslatorInterface $translator) { |
|
630 | 630 | return $newLocale && |
631 | 631 | $translator->trans('diff_before_yesterday') !== 'diff_before_yesterday' && |
632 | 632 | $translator->trans('diff_after_tomorrow') !== 'diff_after_tomorrow'; |
@@ -643,7 +643,7 @@ discard block |
||
643 | 643 | */ |
644 | 644 | public static function localeHasPeriodSyntax($locale) |
645 | 645 | { |
646 | - return static::executeWithLocale($locale, function ($newLocale, TranslatorInterface $translator) { |
|
646 | + return static::executeWithLocale($locale, function($newLocale, TranslatorInterface $translator) { |
|
647 | 647 | return $newLocale && |
648 | 648 | $translator->trans('period_recurrences') !== 'period_recurrences' && |
649 | 649 | $translator->trans('period_interval') !== 'period_interval' && |
@@ -778,7 +778,7 @@ discard block |
||
778 | 778 | */ |
779 | 779 | private static function translateWordsByKeys($keys, $messages, $key): array |
780 | 780 | { |
781 | - return array_map(function ($wordKey) use ($messages, $key) { |
|
781 | + return array_map(function($wordKey) use ($messages, $key) { |
|
782 | 782 | $message = $key === 'from' && isset($messages[$wordKey.'_regexp']) |
783 | 783 | ? $messages[$wordKey.'_regexp'] |
784 | 784 | : ($messages[$wordKey] ?? null); |
@@ -1050,7 +1050,7 @@ |
||
1050 | 1050 | // Replace not-escaped letters |
1051 | 1051 | $regex = preg_replace_callback( |
1052 | 1052 | '/(?<!\\\\)((?:\\\\{2})*)(['.implode('', array_keys($replacements)).'])/', |
1053 | - function ($match) use ($replacements) { |
|
1053 | + function($match) use ($replacements) { |
|
1054 | 1054 | return $match[1].strtr($match[2], $replacements); |
1055 | 1055 | }, |
1056 | 1056 | $regex |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | } |
374 | 374 | |
375 | 375 | $defaults = null; |
376 | - $getDefault = function ($unit) use ($tz, &$defaults) { |
|
376 | + $getDefault = function($unit) use ($tz, &$defaults) { |
|
377 | 377 | if ($defaults === null) { |
378 | 378 | $now = self::createNowInstance($tz); |
379 | 379 | |
@@ -721,7 +721,7 @@ discard block |
||
721 | 721 | */ |
722 | 722 | public static function createFromIsoFormat($format, $time, $tz = null, $locale = 'en', $translator = null) |
723 | 723 | { |
724 | - $format = preg_replace_callback('/(?<!\\\\)(\\\\{2})*(LTS|LT|[Ll]{1,4})/', function ($match) use ($locale, $translator) { |
|
724 | + $format = preg_replace_callback('/(?<!\\\\)(\\\\{2})*(LTS|LT|[Ll]{1,4})/', function($match) use ($locale, $translator) { |
|
725 | 725 | [$code] = $match; |
726 | 726 | |
727 | 727 | static $formats = null; |
@@ -741,14 +741,14 @@ discard block |
||
741 | 741 | |
742 | 742 | return $formats[$code] ?? preg_replace_callback( |
743 | 743 | '/MMMM|MM|DD|dddd/', |
744 | - function ($code) { |
|
744 | + function($code) { |
|
745 | 745 | return mb_substr($code[0], 1); |
746 | 746 | }, |
747 | 747 | $formats[strtoupper($code)] ?? '' |
748 | 748 | ); |
749 | 749 | }, $format); |
750 | 750 | |
751 | - $format = preg_replace_callback('/(?<!\\\\)(\\\\{2})*('.CarbonInterface::ISO_FORMAT_REGEXP.'|[A-Za-z])/', function ($match) { |
|
751 | + $format = preg_replace_callback('/(?<!\\\\)(\\\\{2})*('.CarbonInterface::ISO_FORMAT_REGEXP.'|[A-Za-z])/', function($match) { |
|
752 | 752 | [$code] = $match; |
753 | 753 | |
754 | 754 | static $replacements = null; |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | return implode(' || ', $ranges); |
159 | 159 | } |
160 | 160 | |
161 | - throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); |
|
161 | + throw new \OutOfBoundsException('Package "'.$packageName.'" is not installed'); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | /** |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | return $installed['versions'][$packageName]['version']; |
180 | 180 | } |
181 | 181 | |
182 | - throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); |
|
182 | + throw new \OutOfBoundsException('Package "'.$packageName.'" is not installed'); |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | /** |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | return $installed['versions'][$packageName]['pretty_version']; |
201 | 201 | } |
202 | 202 | |
203 | - throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); |
|
203 | + throw new \OutOfBoundsException('Package "'.$packageName.'" is not installed'); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | /** |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | return $installed['versions'][$packageName]['reference']; |
222 | 222 | } |
223 | 223 | |
224 | - throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); |
|
224 | + throw new \OutOfBoundsException('Package "'.$packageName.'" is not installed'); |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | /** |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null; |
239 | 239 | } |
240 | 240 | |
241 | - throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); |
|
241 | + throw new \OutOfBoundsException('Package "'.$packageName.'" is not installed'); |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | /** |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | // only require the installed.php file if this file is loaded from its dumped location, |
268 | 268 | // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 |
269 | 269 | if (substr(__DIR__, -8, 1) !== 'C') { |
270 | - self::$installed = include __DIR__ . '/installed.php'; |
|
270 | + self::$installed = include __DIR__.'/installed.php'; |
|
271 | 271 | } else { |
272 | 272 | self::$installed = array(); |
273 | 273 | } |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | // only require the installed.php file if this file is loaded from its dumped location, |
341 | 341 | // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 |
342 | 342 | if (substr(__DIR__, -8, 1) !== 'C') { |
343 | - self::$installed = require __DIR__ . '/installed.php'; |
|
343 | + self::$installed = require __DIR__.'/installed.php'; |
|
344 | 344 | } else { |
345 | 345 | self::$installed = array(); |
346 | 346 | } |