@@ -668,7 +668,7 @@ discard block |
||
668 | 668 | */ |
669 | 669 | public function isCurrentUnit($unit) |
670 | 670 | { |
671 | - return $this->{'isSame'.ucfirst($unit)}(); |
|
671 | + return $this->{'isSame' . ucfirst($unit)}(); |
|
672 | 672 | } |
673 | 673 | |
674 | 674 | /** |
@@ -732,7 +732,7 @@ discard block |
||
732 | 732 | */ |
733 | 733 | public function isDayOfWeek($dayOfWeek) |
734 | 734 | { |
735 | - if (\is_string($dayOfWeek) && \defined($constant = static::class.'::'.strtoupper($dayOfWeek))) { |
|
735 | + if (\is_string($dayOfWeek) && \defined($constant = static::class . '::' . strtoupper($dayOfWeek))) { |
|
736 | 736 | $dayOfWeek = \constant($constant); |
737 | 737 | } |
738 | 738 | |
@@ -861,7 +861,7 @@ discard block |
||
861 | 861 | public function isMidday() |
862 | 862 | { |
863 | 863 | /* @var CarbonInterface $this */ |
864 | - return $this->rawFormat('G:i:s') === static::$midDayAt.':00:00'; |
|
864 | + return $this->rawFormat('G:i:s') === static::$midDayAt . ':00:00'; |
|
865 | 865 | } |
866 | 866 | |
867 | 867 | /** |
@@ -973,7 +973,7 @@ discard block |
||
973 | 973 | } |
974 | 974 | |
975 | 975 | if (preg_match('/^\d{1,2}-\d{1,2}$/', $tester)) { |
976 | - return $this->isSameDay(static::parse($this->year.'-'.$tester)); |
|
976 | + return $this->isSameDay(static::parse($this->year . '-' . $tester)); |
|
977 | 977 | } |
978 | 978 | |
979 | 979 | $modifier = preg_replace('/(\d)h$/i', '$1:00', $tester); |
@@ -1049,9 +1049,9 @@ discard block |
||
1049 | 1049 | $regex = str_replace('\\\\', '\\', $format); |
1050 | 1050 | // Replace not-escaped letters |
1051 | 1051 | $regex = preg_replace_callback( |
1052 | - '/(?<!\\\\)((?:\\\\{2})*)(['.implode('', array_keys($replacements)).'])/', |
|
1053 | - function ($match) use ($replacements) { |
|
1054 | - return $match[1].strtr($match[2], $replacements); |
|
1052 | + '/(?<!\\\\)((?:\\\\{2})*)([' . implode('', array_keys($replacements)) . '])/', |
|
1053 | + function($match) use ($replacements) { |
|
1054 | + return $match[1] . strtr($match[2], $replacements); |
|
1055 | 1055 | }, |
1056 | 1056 | $regex |
1057 | 1057 | ); |
@@ -1060,7 +1060,7 @@ discard block |
||
1060 | 1060 | // Escape not escaped slashes |
1061 | 1061 | $regex = preg_replace('#(?<!\\\\)((?:\\\\{2})*)/#', '$1\\/', $regex); |
1062 | 1062 | |
1063 | - return (bool) @preg_match('/^'.$regex.'$/', $date); |
|
1063 | + return (bool) @preg_match('/^' . $regex . '$/', $date); |
|
1064 | 1064 | } |
1065 | 1065 | |
1066 | 1066 | /** |
@@ -277,8 +277,8 @@ discard block |
||
277 | 277 | 'year', |
278 | 278 | ]) && ($overflow === false || ( |
279 | 279 | $overflow === null && |
280 | - ($ucUnit = ucfirst($unit).'s') && |
|
281 | - !($this->{'local'.$ucUnit.'Overflow'} ?? static::{'shouldOverflow'.$ucUnit}()) |
|
280 | + ($ucUnit = ucfirst($unit) . 's') && |
|
281 | + !($this->{'local' . $ucUnit . 'Overflow'} ?? static::{'shouldOverflow' . $ucUnit}()) |
|
282 | 282 | )))) { |
283 | 283 | $day = $date->day; |
284 | 284 | } |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | } |
312 | 312 | |
313 | 313 | if (!$date) { |
314 | - throw new UnitException('Unable to add unit '.var_export(\func_get_args(), true)); |
|
314 | + throw new UnitException('Unable to add unit ' . var_export(\func_get_args(), true)); |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | return $date; |
@@ -103,7 +103,7 @@ discard block |
||
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 | |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | |
125 | 125 | private static function getAnonymousClassCodeForTrait(string $trait) |
126 | 126 | { |
127 | - return 'return new class() extends '.static::class.' {use '.$trait.';};'; |
|
127 | + return 'return new class() extends ' . static::class . ' {use ' . $trait . ';};'; |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | private static function getMixableMethods(self $context): Generator |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | } |
85 | 85 | |
86 | 86 | return $this->change( |
87 | - 'next '.(\is_string($modifier) ? $modifier : static::$days[$modifier]) |
|
87 | + 'next ' . (\is_string($modifier) ? $modifier : static::$days[$modifier]) |
|
88 | 88 | ); |
89 | 89 | } |
90 | 90 | |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | } |
167 | 167 | |
168 | 168 | return $this->change( |
169 | - 'last '.(\is_string($modifier) ? $modifier : static::$days[$modifier]) |
|
169 | + 'last ' . (\is_string($modifier) ? $modifier : static::$days[$modifier]) |
|
170 | 170 | ); |
171 | 171 | } |
172 | 172 | |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | return $date->day(1); |
189 | 189 | } |
190 | 190 | |
191 | - return $date->modify('first '.static::$days[$dayOfWeek].' of '.$date->rawFormat('F').' '.$date->year); |
|
191 | + return $date->modify('first ' . static::$days[$dayOfWeek] . ' of ' . $date->rawFormat('F') . ' ' . $date->year); |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | /** |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | return $date->day($date->daysInMonth); |
210 | 210 | } |
211 | 211 | |
212 | - return $date->modify('last '.static::$days[$dayOfWeek].' of '.$date->rawFormat('F').' '.$date->year); |
|
212 | + return $date->modify('last ' . static::$days[$dayOfWeek] . ' of ' . $date->rawFormat('F') . ' ' . $date->year); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | /** |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | { |
228 | 228 | $date = $this->avoidMutation()->firstOfMonth(); |
229 | 229 | $check = $date->rawFormat('Y-m'); |
230 | - $date = $date->modify('+'.$nth.' '.static::$days[$dayOfWeek]); |
|
230 | + $date = $date->modify('+' . $nth . ' ' . static::$days[$dayOfWeek]); |
|
231 | 231 | |
232 | 232 | return $date->rawFormat('Y-m') === $check ? $this->modify((string) $date) : false; |
233 | 233 | } |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | $date = $this->avoidMutation()->day(1)->month($this->quarter * static::MONTHS_PER_QUARTER); |
279 | 279 | $lastMonth = $date->month; |
280 | 280 | $year = $date->year; |
281 | - $date = $date->firstOfQuarter()->modify('+'.$nth.' '.static::$days[$dayOfWeek]); |
|
281 | + $date = $date->firstOfQuarter()->modify('+' . $nth . ' ' . static::$days[$dayOfWeek]); |
|
282 | 282 | |
283 | 283 | return ($lastMonth < $date->month || $year !== $date->year) ? false : $this->modify((string) $date); |
284 | 284 | } |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | */ |
327 | 327 | public function nthOfYear($nth, $dayOfWeek) |
328 | 328 | { |
329 | - $date = $this->avoidMutation()->firstOfYear()->modify('+'.$nth.' '.static::$days[$dayOfWeek]); |
|
329 | + $date = $this->avoidMutation()->firstOfYear()->modify('+' . $nth . ' ' . static::$days[$dayOfWeek]); |
|
330 | 330 | |
331 | 331 | return $this->year === $date->year ? $this->modify((string) $date) : false; |
332 | 332 | } |
@@ -455,13 +455,13 @@ discard block |
||
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'; |
462 | - $match[1] = $test->$method($this) ? $match[1].' day' : 'today'; |
|
462 | + $match[1] = $test->$method($this) ? $match[1] . ' day' : 'today'; |
|
463 | 463 | |
464 | - return $match[1].' '.$match[2]; |
|
464 | + return $match[1] . ' ' . $match[2]; |
|
465 | 465 | }, strtr(trim($modifier), [ |
466 | 466 | ' at ' => ' ', |
467 | 467 | 'just now' => 'now', |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | */ |
190 | 190 | public function toDateTimeString($unitPrecision = 'second') |
191 | 191 | { |
192 | - return $this->rawFormat('Y-m-d '.static::getTimeFormatByPrecision($unitPrecision)); |
|
192 | + return $this->rawFormat('Y-m-d ' . static::getTimeFormatByPrecision($unitPrecision)); |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | /** |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | */ |
234 | 234 | public function toDateTimeLocalString($unitPrecision = 'second') |
235 | 235 | { |
236 | - return $this->rawFormat('Y-m-d\T'.static::getTimeFormatByPrecision($unitPrecision)); |
|
236 | + return $this->rawFormat('Y-m-d\T' . static::getTimeFormatByPrecision($unitPrecision)); |
|
237 | 237 | } |
238 | 238 | |
239 | 239 | /** |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | { |
328 | 328 | return $this->avoidMutation() |
329 | 329 | ->utc() |
330 | - ->rawFormat('Y-m-d\T'.static::getTimeFormatByPrecision($unitPrecision).'\Z'); |
|
330 | + ->rawFormat('Y-m-d\T' . static::getTimeFormatByPrecision($unitPrecision) . '\Z'); |
|
331 | 331 | } |
332 | 332 | |
333 | 333 | /** |
@@ -619,7 +619,7 @@ discard block |
||
619 | 619 | public function toPeriod($end = null, $interval = null, $unit = null) |
620 | 620 | { |
621 | 621 | if ($unit) { |
622 | - $interval = CarbonInterval::make("$interval ".static::pluralUnit($unit)); |
|
622 | + $interval = CarbonInterval::make("$interval " . static::pluralUnit($unit)); |
|
623 | 623 | } |
624 | 624 | |
625 | 625 | $period = (new CarbonPeriod())->setDateClass(static::class)->setStartDate($this); |
@@ -727,8 +727,8 @@ discard block |
||
727 | 727 | |
728 | 728 | if (!$date instanceof DateTime && !$date instanceof DateTimeInterface) { |
729 | 729 | throw new InvalidTypeException( |
730 | - $message.'DateTime or DateTimeInterface, '. |
|
731 | - (\is_object($date) ? \get_class($date) : \gettype($date)).' given' |
|
730 | + $message . 'DateTime or DateTimeInterface, ' . |
|
731 | + (\is_object($date) ? \get_class($date) : \gettype($date)) . ' given' |
|
732 | 732 | ); |
733 | 733 | } |
734 | 734 | } |
@@ -1067,7 +1067,7 @@ discard block |
||
1067 | 1067 | return $this->getTranslatorLocale(); |
1068 | 1068 | |
1069 | 1069 | default: |
1070 | - $macro = $this->getLocalMacro('get'.ucfirst($name)); |
|
1070 | + $macro = $this->getLocalMacro('get' . ucfirst($name)); |
|
1071 | 1071 | |
1072 | 1072 | if ($macro) { |
1073 | 1073 | return $this->executeCallableWithContext($macro); |
@@ -1161,7 +1161,7 @@ discard block |
||
1161 | 1161 | $value -= static::MICROSECONDS_PER_SECOND; |
1162 | 1162 | } |
1163 | 1163 | |
1164 | - $this->modify($this->rawFormat('H:i:s.').str_pad((string) round($value), 6, '0', STR_PAD_LEFT)); |
|
1164 | + $this->modify($this->rawFormat('H:i:s.') . str_pad((string) round($value), 6, '0', STR_PAD_LEFT)); |
|
1165 | 1165 | |
1166 | 1166 | break; |
1167 | 1167 | |
@@ -1229,7 +1229,7 @@ discard block |
||
1229 | 1229 | break; |
1230 | 1230 | |
1231 | 1231 | default: |
1232 | - $macro = $this->getLocalMacro('set'.ucfirst($name)); |
|
1232 | + $macro = $this->getLocalMacro('set' . ucfirst($name)); |
|
1233 | 1233 | |
1234 | 1234 | if ($macro) { |
1235 | 1235 | $this->executeCallableWithContext($macro, $value); |
@@ -1249,7 +1249,7 @@ discard block |
||
1249 | 1249 | |
1250 | 1250 | protected function getTranslatedFormByRegExp($baseKey, $keySuffix, $context, $subKey, $defaultValue) |
1251 | 1251 | { |
1252 | - $key = $baseKey.$keySuffix; |
|
1252 | + $key = $baseKey . $keySuffix; |
|
1253 | 1253 | $standaloneKey = "{$key}_standalone"; |
1254 | 1254 | $baseTranslation = $this->getTranslationMessage($key); |
1255 | 1255 | |
@@ -1922,13 +1922,13 @@ discard block |
||
1922 | 1922 | 'DD' => ['rawFormat', ['d']], |
1923 | 1923 | 'Do' => ['ordinal', ['day', 'D']], |
1924 | 1924 | 'd' => 'dayOfWeek', |
1925 | - 'dd' => function (CarbonInterface $date, $originalFormat = null) { |
|
1925 | + 'dd' => function(CarbonInterface $date, $originalFormat = null) { |
|
1926 | 1926 | return $date->getTranslatedMinDayName($originalFormat); |
1927 | 1927 | }, |
1928 | - 'ddd' => function (CarbonInterface $date, $originalFormat = null) { |
|
1928 | + 'ddd' => function(CarbonInterface $date, $originalFormat = null) { |
|
1929 | 1929 | return $date->getTranslatedShortDayName($originalFormat); |
1930 | 1930 | }, |
1931 | - 'dddd' => function (CarbonInterface $date, $originalFormat = null) { |
|
1931 | + 'dddd' => function(CarbonInterface $date, $originalFormat = null) { |
|
1932 | 1932 | return $date->getTranslatedDayName($originalFormat); |
1933 | 1933 | }, |
1934 | 1934 | 'DDD' => 'dayOfYear', |
@@ -1952,34 +1952,34 @@ discard block |
||
1952 | 1952 | 'A' => 'upperMeridiem', |
1953 | 1953 | 's' => 'second', |
1954 | 1954 | 'ss' => ['getPaddedUnit', ['second']], |
1955 | - 'S' => function (CarbonInterface $date) { |
|
1955 | + 'S' => function(CarbonInterface $date) { |
|
1956 | 1956 | return (string) floor($date->micro / 100000); |
1957 | 1957 | }, |
1958 | - 'SS' => function (CarbonInterface $date) { |
|
1958 | + 'SS' => function(CarbonInterface $date) { |
|
1959 | 1959 | return str_pad((string) floor($date->micro / 10000), 2, '0', STR_PAD_LEFT); |
1960 | 1960 | }, |
1961 | - 'SSS' => function (CarbonInterface $date) { |
|
1961 | + 'SSS' => function(CarbonInterface $date) { |
|
1962 | 1962 | return str_pad((string) floor($date->micro / 1000), 3, '0', STR_PAD_LEFT); |
1963 | 1963 | }, |
1964 | - 'SSSS' => function (CarbonInterface $date) { |
|
1964 | + 'SSSS' => function(CarbonInterface $date) { |
|
1965 | 1965 | return str_pad((string) floor($date->micro / 100), 4, '0', STR_PAD_LEFT); |
1966 | 1966 | }, |
1967 | - 'SSSSS' => function (CarbonInterface $date) { |
|
1967 | + 'SSSSS' => function(CarbonInterface $date) { |
|
1968 | 1968 | return str_pad((string) floor($date->micro / 10), 5, '0', STR_PAD_LEFT); |
1969 | 1969 | }, |
1970 | 1970 | 'SSSSSS' => ['getPaddedUnit', ['micro', 6]], |
1971 | - 'SSSSSSS' => function (CarbonInterface $date) { |
|
1971 | + 'SSSSSSS' => function(CarbonInterface $date) { |
|
1972 | 1972 | return str_pad((string) floor($date->micro * 10), 7, '0', STR_PAD_LEFT); |
1973 | 1973 | }, |
1974 | - 'SSSSSSSS' => function (CarbonInterface $date) { |
|
1974 | + 'SSSSSSSS' => function(CarbonInterface $date) { |
|
1975 | 1975 | return str_pad((string) floor($date->micro * 100), 8, '0', STR_PAD_LEFT); |
1976 | 1976 | }, |
1977 | - 'SSSSSSSSS' => function (CarbonInterface $date) { |
|
1977 | + 'SSSSSSSSS' => function(CarbonInterface $date) { |
|
1978 | 1978 | return str_pad((string) floor($date->micro * 1000), 9, '0', STR_PAD_LEFT); |
1979 | 1979 | }, |
1980 | 1980 | 'M' => 'month', |
1981 | 1981 | 'MM' => ['rawFormat', ['m']], |
1982 | - 'MMM' => function (CarbonInterface $date, $originalFormat = null) { |
|
1982 | + 'MMM' => function(CarbonInterface $date, $originalFormat = null) { |
|
1983 | 1983 | $month = $date->getTranslatedShortMonthName($originalFormat); |
1984 | 1984 | $suffix = $date->getTranslationMessage('mmm_suffix'); |
1985 | 1985 | if ($suffix && $month !== $date->monthName) { |
@@ -1988,7 +1988,7 @@ discard block |
||
1988 | 1988 | |
1989 | 1989 | return $month; |
1990 | 1990 | }, |
1991 | - 'MMMM' => function (CarbonInterface $date, $originalFormat = null) { |
|
1991 | + 'MMMM' => function(CarbonInterface $date, $originalFormat = null) { |
|
1992 | 1992 | return $date->getTranslatedMonthName($originalFormat); |
1993 | 1993 | }, |
1994 | 1994 | 'Mo' => ['ordinal', ['month', 'M']], |
@@ -2016,8 +2016,8 @@ discard block |
||
2016 | 2016 | 'YY' => ['rawFormat', ['y']], |
2017 | 2017 | 'YYYY' => ['getPaddedUnit', ['year', 4]], |
2018 | 2018 | 'YYYYY' => ['getPaddedUnit', ['year', 5]], |
2019 | - 'YYYYYY' => function (CarbonInterface $date) { |
|
2020 | - return ($date->year < 0 ? '' : '+').$date->getPaddedUnit('year', 6); |
|
2019 | + 'YYYYYY' => function(CarbonInterface $date) { |
|
2020 | + return ($date->year < 0 ? '' : '+') . $date->getPaddedUnit('year', 6); |
|
2021 | 2021 | }, |
2022 | 2022 | 'z' => ['rawFormat', ['T']], |
2023 | 2023 | 'zz' => 'tzName', |
@@ -2041,7 +2041,7 @@ discard block |
||
2041 | 2041 | */ |
2042 | 2042 | public function getPaddedUnit($unit, $length = 2, $padString = '0', $padType = STR_PAD_LEFT) |
2043 | 2043 | { |
2044 | - return ($this->$unit < 0 ? '-' : '').str_pad((string) abs($this->$unit), $length, $padString, $padType); |
|
2044 | + return ($this->$unit < 0 ? '-' : '') . str_pad((string) abs($this->$unit), $length, $padString, $padType); |
|
2045 | 2045 | } |
2046 | 2046 | |
2047 | 2047 | /** |
@@ -2076,7 +2076,7 @@ discard block |
||
2076 | 2076 | $index = $hour < 12 ? 0 : 1; |
2077 | 2077 | |
2078 | 2078 | if ($isLower) { |
2079 | - $key = 'meridiem.'.($index + 2); |
|
2079 | + $key = 'meridiem.' . ($index + 2); |
|
2080 | 2080 | $result = $this->translate($key); |
2081 | 2081 | |
2082 | 2082 | if ($result !== $key) { |
@@ -2169,18 +2169,18 @@ discard block |
||
2169 | 2169 | $code = $match[0]; |
2170 | 2170 | $sequence = $formats[$code] ?? preg_replace_callback( |
2171 | 2171 | '/MMMM|MM|DD|dddd/', |
2172 | - function ($code) { |
|
2172 | + function($code) { |
|
2173 | 2173 | return mb_substr($code[0], 1); |
2174 | 2174 | }, |
2175 | 2175 | $formats[strtoupper($code)] ?? '' |
2176 | 2176 | ); |
2177 | 2177 | $rest = mb_substr($format, $i + mb_strlen($code)); |
2178 | - $format = mb_substr($format, 0, $i).$sequence.$rest; |
|
2178 | + $format = mb_substr($format, 0, $i) . $sequence . $rest; |
|
2179 | 2179 | $length = mb_strlen($format); |
2180 | - $input = $sequence.$rest; |
|
2180 | + $input = $sequence . $rest; |
|
2181 | 2181 | } |
2182 | 2182 | |
2183 | - if (preg_match('/^'.CarbonInterface::ISO_FORMAT_REGEXP.'/', $input, $match)) { |
|
2183 | + if (preg_match('/^' . CarbonInterface::ISO_FORMAT_REGEXP . '/', $input, $match)) { |
|
2184 | 2184 | $code = $match[0]; |
2185 | 2185 | |
2186 | 2186 | if ($units === null) { |
@@ -2201,7 +2201,7 @@ discard block |
||
2201 | 2201 | $sequence = $this->$sequence ?? $code; |
2202 | 2202 | } |
2203 | 2203 | |
2204 | - $format = mb_substr($format, 0, $i).$sequence.mb_substr($format, $i + mb_strlen($code)); |
|
2204 | + $format = mb_substr($format, 0, $i) . $sequence . mb_substr($format, $i + mb_strlen($code)); |
|
2205 | 2205 | $i += mb_strlen((string) $sequence) - 1; |
2206 | 2206 | $length = mb_strlen($format); |
2207 | 2207 | $char = $sequence; |
@@ -2229,7 +2229,7 @@ discard block |
||
2229 | 2229 | 'j' => true, |
2230 | 2230 | 'l' => 'dddd', |
2231 | 2231 | 'N' => true, |
2232 | - 'S' => function ($date) { |
|
2232 | + 'S' => function($date) { |
|
2233 | 2233 | $day = $date->rawFormat('j'); |
2234 | 2234 | |
2235 | 2235 | return str_replace((string) $day, '', $date->isoFormat('Do')); |
@@ -2331,14 +2331,14 @@ discard block |
||
2331 | 2331 | ]; |
2332 | 2332 | } |
2333 | 2333 | |
2334 | - $isoFormat .= '['.$this->rawFormat($char).']'; |
|
2334 | + $isoFormat .= '[' . $this->rawFormat($char) . ']'; |
|
2335 | 2335 | $context .= $contextReplacements[$char] ?? ' '; |
2336 | 2336 | |
2337 | 2337 | continue; |
2338 | 2338 | } |
2339 | 2339 | |
2340 | 2340 | if ($replacement instanceof Closure) { |
2341 | - $replacement = '['.$replacement($this).']'; |
|
2341 | + $replacement = '[' . $replacement($this) . ']'; |
|
2342 | 2342 | $isoFormat .= $replacement; |
2343 | 2343 | $context .= $replacement; |
2344 | 2344 | |
@@ -2375,7 +2375,7 @@ discard block |
||
2375 | 2375 | |
2376 | 2376 | protected static function executeStaticCallable($macro, ...$parameters) |
2377 | 2377 | { |
2378 | - return static::bindMacroContext(null, function () use (&$macro, &$parameters) { |
|
2378 | + return static::bindMacroContext(null, function() use (&$macro, &$parameters) { |
|
2379 | 2379 | if ($macro instanceof Closure) { |
2380 | 2380 | $boundMacro = @Closure::bind($macro, null, static::class); |
2381 | 2381 | |
@@ -2429,7 +2429,7 @@ discard block |
||
2429 | 2429 | $unit = static::singularUnit($unit); |
2430 | 2430 | $dateUnits = ['year', 'month', 'day']; |
2431 | 2431 | if (\in_array($unit, $dateUnits)) { |
2432 | - return $this->setDate(...array_map(function ($name) use ($unit, $value) { |
|
2432 | + return $this->setDate(...array_map(function($name) use ($unit, $value) { |
|
2433 | 2433 | return (int) ($name === $unit ? $value : $this->$name); |
2434 | 2434 | }, $dateUnits)); |
2435 | 2435 | } |
@@ -2442,7 +2442,7 @@ discard block |
||
2442 | 2442 | $unit = 'micro'; |
2443 | 2443 | } |
2444 | 2444 | |
2445 | - return $this->setTime(...array_map(function ($name) use ($unit, $value) { |
|
2445 | + return $this->setTime(...array_map(function($name) use ($unit, $value) { |
|
2446 | 2446 | return (int) ($name === $unit ? $value : $this->$name); |
2447 | 2447 | }, $units)); |
2448 | 2448 | } |
@@ -2504,7 +2504,7 @@ discard block |
||
2504 | 2504 | |
2505 | 2505 | protected function executeCallableWithContext($macro, ...$parameters) |
2506 | 2506 | { |
2507 | - return static::bindMacroContext($this, function () use (&$macro, &$parameters) { |
|
2507 | + return static::bindMacroContext($this, function() use (&$macro, &$parameters) { |
|
2508 | 2508 | return $this->executeCallable($macro, ...$parameters); |
2509 | 2509 | }); |
2510 | 2510 | } |
@@ -2550,7 +2550,7 @@ discard block |
||
2550 | 2550 | $syntaxPattern = implode('|', array_keys($diffSyntaxModes)); |
2551 | 2551 | |
2552 | 2552 | if (preg_match("/^(?<size>$sizePattern)(?<syntax>$syntaxPattern)DiffForHumans$/", $method, $match)) { |
2553 | - $dates = array_filter($parameters, function ($parameter) { |
|
2553 | + $dates = array_filter($parameters, function($parameter) { |
|
2554 | 2554 | return $parameter instanceof DateTimeInterface; |
2555 | 2555 | }); |
2556 | 2556 | $other = null; |
@@ -2670,7 +2670,7 @@ discard block |
||
2670 | 2670 | } |
2671 | 2671 | } |
2672 | 2672 | |
2673 | - return static::bindMacroContext($this, function () use (&$method, &$parameters) { |
|
2673 | + return static::bindMacroContext($this, function() use (&$method, &$parameters) { |
|
2674 | 2674 | $macro = $this->getLocalMacro($method); |
2675 | 2675 | |
2676 | 2676 | if (!$macro) { |
@@ -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 | } |
@@ -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 |
@@ -29,7 +29,7 @@ |
||
29 | 29 | } |
30 | 30 | |
31 | 31 | if (\in_array($action, ['round', 'floor', 'ceil'])) { |
32 | - return $this->{$action.'Unit'}(substr($method, \strlen($action)), ...$parameters); |
|
32 | + return $this->{$action . 'Unit'}(substr($method, \strlen($action)), ...$parameters); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | return null; |