Showing 24 of 25 files from the diff.
Other files ignored by Codecov
.php_cs.dist has changed.

@@ -33,11 +33,11 @@
Loading
33 33
34 34
    protected static function getDateTimeZoneNameFromMixed($timezone)
35 35
    {
36 -
        if (is_null($timezone)) {
36 +
        if (\is_null($timezone)) {
37 37
            return date_default_timezone_get();
38 38
        }
39 39
40 -
        if (is_string($timezone)) {
40 +
        if (\is_string($timezone)) {
41 41
            $timezone = preg_replace('/^\s*([+-]\d+)(\d{2})\s*$/', '$1:$2', $timezone);
42 42
        }
43 43

@@ -82,7 +82,7 @@
Loading
82 82
        }
83 83
84 84
        return $this->change(
85 -
            'next '.(is_string($modifier) ? $modifier : static::$days[$modifier])
85 +
            'next '.(\is_string($modifier) ? $modifier : static::$days[$modifier])
86 86
        );
87 87
    }
88 88
@@ -164,7 +164,7 @@
Loading
164 164
        }
165 165
166 166
        return $this->change(
167 -
            'last '.(is_string($modifier) ? $modifier : static::$days[$modifier])
167 +
            'last '.(\is_string($modifier) ? $modifier : static::$days[$modifier])
168 168
        );
169 169
    }
170 170

@@ -24,7 +24,7 @@
Loading
24 24
     */
25 25
    public function __construct($object, $code = 0, Exception $previous = null)
26 26
    {
27 -
        $dump = is_object($object) ? get_class($object) : gettype($object);
27 +
        $dump = \is_object($object) ? \get_class($object) : \gettype($object);
28 28
29 29
        parent::__construct("$dump does neither implements Symfony\Contracts\Translation\LocaleAwareInterface nor getLocale() method.", $code, $previous);
30 30
    }

@@ -60,7 +60,7 @@
Loading
60 60
    'ordinal' => function ($number) {
61 61
        return $number.(
62 62
            $number > 20
63 -
                ? (in_array($number, [40, 50, 60, 80, 100]) ? 'fed' : 'ain')
63 +
                ? (\in_array($number, [40, 50, 60, 80, 100]) ? 'fed' : 'ain')
64 64
                : ([
65 65
                    '', 'af', 'il', 'ydd', 'ydd', 'ed', 'ed', 'ed', 'fed', 'fed', 'fed', // 1af to 10fed
66 66
                    'eg', 'fed', 'eg', 'eg', 'fed', 'eg', 'eg', 'fed', 'eg', 'fed', // 11eg to 20fed

@@ -83,11 +83,11 @@
Loading
83 83
            return $this->rawFormat($format);
84 84
        }
85 85
86 -
        if (is_string($function) && method_exists($this, $function)) {
86 +
        if (\is_string($function) && method_exists($this, $function)) {
87 87
            $function = [$this, $function];
88 88
        }
89 89
90 -
        return $function(...func_get_args());
90 +
        return $function(...\func_get_args());
91 91
    }
92 92
93 93
    /**
@@ -119,7 +119,7 @@
Loading
119 119
        return $format instanceof Closure
120 120
            ? $format($this)
121 121
            : $this->rawFormat($format ?: (
122 -
                defined('static::DEFAULT_TO_STRING_FORMAT')
122 +
                \defined('static::DEFAULT_TO_STRING_FORMAT')
123 123
                    ? static::DEFAULT_TO_STRING_FORMAT
124 124
                    : CarbonInterface::DEFAULT_TO_STRING_FORMAT
125 125
            ));
@@ -452,7 +452,7 @@
Loading
452 452
    {
453 453
        return $this->copy()
454 454
            ->setTimezone('GMT')
455 -
            ->rawFormat(defined('static::RFC7231_FORMAT') ? static::RFC7231_FORMAT : CarbonInterface::RFC7231_FORMAT);
455 +
            ->rawFormat(\defined('static::RFC7231_FORMAT') ? static::RFC7231_FORMAT : CarbonInterface::RFC7231_FORMAT);
456 456
    }
457 457
458 458
    /**
@@ -478,7 +478,7 @@
Loading
478 478
            'second' => $this->second,
479 479
            'micro' => $this->micro,
480 480
            'timestamp' => $this->timestamp,
481 -
            'formatted' => $this->rawFormat(defined('static::DEFAULT_TO_STRING_FORMAT') ? static::DEFAULT_TO_STRING_FORMAT : CarbonInterface::DEFAULT_TO_STRING_FORMAT),
481 +
            'formatted' => $this->rawFormat(\defined('static::DEFAULT_TO_STRING_FORMAT') ? static::DEFAULT_TO_STRING_FORMAT : CarbonInterface::DEFAULT_TO_STRING_FORMAT),
482 482
            'timezone' => $this->timezone,
483 483
        ];
484 484
    }
@@ -623,7 +623,7 @@
Loading
623 623
            $period->setDateInterval($interval);
624 624
        }
625 625
626 -
        if (is_int($end) || is_string($end) && ctype_digit($end)) {
626 +
        if (\is_int($end) || \is_string($end) && ctype_digit($end)) {
627 627
            $period->setRecurrences($end);
628 628
        } elseif ($end) {
629 629
            $period->setEndDate($end);

@@ -285,10 +285,10 @@
Loading
285 285
286 286
        if ($settings && isset($settings['timezone'])) {
287 287
            $tzParameters = array_filter($method->getParameters(), function ($parameter) {
288 -
                return in_array($parameter->getName(), ['tz', 'timezone'], true);
288 +
                return \in_array($parameter->getName(), ['tz', 'timezone'], true);
289 289
            });
290 290
291 -
            if (count($tzParameters)) {
291 +
            if (\count($tzParameters)) {
292 292
                array_splice($arguments, key($tzParameters), 0, [$settings['timezone']]);
293 293
                unset($settings['timezone']);
294 294
            }

@@ -51,7 +51,7 @@
Loading
51 51
            $testNow = null;
52 52
        }
53 53
54 -
        static::$testNow = is_string($testNow) ? static::parse($testNow) : $testNow;
54 +
        static::$testNow = \is_string($testNow) ? static::parse($testNow) : $testNow;
55 55
    }
56 56
57 57
    /**

@@ -783,14 +783,14 @@
Loading
783 783
    public function diffForHumans($other = null, $syntax = null, $short = false, $parts = 1, $options = null)
784 784
    {
785 785
        /* @var CarbonInterface $this */
786 -
        if (is_array($other)) {
787 -
            $other['syntax'] = array_key_exists('syntax', $other) ? $other['syntax'] : $syntax;
786 +
        if (\is_array($other)) {
787 +
            $other['syntax'] = \array_key_exists('syntax', $other) ? $other['syntax'] : $syntax;
788 788
            $syntax = $other;
789 789
            $other = $syntax['other'] ?? null;
790 790
        }
791 791
792 792
        $intSyntax = &$syntax;
793 -
        if (is_array($syntax)) {
793 +
        if (\is_array($syntax)) {
794 794
            $syntax['syntax'] = $syntax['syntax'] ?? null;
795 795
            $intSyntax = &$syntax['syntax'];
796 796
        }
@@ -983,7 +983,7 @@
Loading
983 983
        $other = null;
984 984
985 985
        if ($syntax instanceof DateTimeInterface) {
986 -
            [$other, $syntax, $short, $parts, $options] = array_pad(func_get_args(), 5, null);
986 +
            [$other, $syntax, $short, $parts, $options] = array_pad(\func_get_args(), 5, null);
987 987
        }
988 988
989 989
        return $this->from($other, $syntax, $short, $parts, $options);
@@ -1055,7 +1055,7 @@
Loading
1055 1055
        $other = null;
1056 1056
1057 1057
        if ($syntax instanceof DateTimeInterface) {
1058 -
            [$other, $syntax, $short, $parts, $options] = array_pad(func_get_args(), 5, null);
1058 +
            [$other, $syntax, $short, $parts, $options] = array_pad(\func_get_args(), 5, null);
1059 1059
        }
1060 1060
1061 1061
        return $this->from($other, $syntax, $short, $parts, $options);
@@ -1112,6 +1112,6 @@
Loading
1112 1112
            $format = $format($current, $other) ?? '';
1113 1113
        }
1114 1114
1115 -
        return $this->isoFormat(strval($format));
1115 +
        return $this->isoFormat(\strval($format));
1116 1116
    }
1117 1117
}

@@ -377,7 +377,7 @@
Loading
377 377
        if (isset($settings['locale'])) {
378 378
            $locales = $settings['locale'];
379 379
380 -
            if (!is_array($locales)) {
380 +
            if (!\is_array($locales)) {
381 381
                $locales = [$locales];
382 382
            }
383 383

@@ -359,13 +359,13 @@
Loading
359 359
            );
360 360
        }
361 361
362 -
        $class = get_called_class();
363 -
        $type = gettype($period);
362 +
        $class = \get_called_class();
363 +
        $type = \gettype($period);
364 364
365 365
        throw new NotAPeriodException(
366 366
            'Argument 1 passed to '.$class.'::'.__METHOD__.'() '.
367 367
            'must be an instance of DatePeriod or '.$class.', '.
368 -
            ($type === 'object' ? 'instance of '.get_class($period) : $type).' given.'
368 +
            ($type === 'object' ? 'instance of '.\get_class($period) : $type).' given.'
369 369
        );
370 370
    }
371 371
@@ -436,7 +436,7 @@
Loading
436 436
     */
437 437
    protected static function isIso8601($var)
438 438
    {
439 -
        if (!is_string($var)) {
439 +
        if (!\is_string($var)) {
440 440
            return false;
441 441
        }
442 442
@@ -467,7 +467,7 @@
Loading
467 467
468 468
        foreach (explode('/', $iso) as $key => $part) {
469 469
            if ($key === 0 && preg_match('/^R([0-9]*)$/', $part, $match)) {
470 -
                $parsed = strlen($match[1]) ? (int) $match[1] : null;
470 +
                $parsed = \strlen($match[1]) ? (int) $match[1] : null;
471 471
            } elseif ($interval === null && $parsed = CarbonInterval::make($part)) {
472 472
                $interval = $part;
473 473
            } elseif ($start === null && $parsed = Carbon::make($part)) {
@@ -598,7 +598,7 @@
Loading
598 598
        // Parse and assign arguments one by one. First argument may be an ISO 8601 spec,
599 599
        // which will be first parsed into parts and then processed the same way.
600 600
601 -
        $argumentsCount = count($arguments);
601 +
        $argumentsCount = \count($arguments);
602 602
603 603
        if ($argumentsCount && static::isIso8601($iso = $arguments[0])) {
604 604
            array_splice($arguments, 0, 1, static::parseIso8601($iso));
@@ -625,7 +625,7 @@
Loading
625 625
        foreach ($arguments as $argument) {
626 626
            if ($this->dateInterval === null &&
627 627
                (
628 -
                    is_string($argument) && preg_match(
628 +
                    \is_string($argument) && preg_match(
629 629
                        '/^(\d(\d(?![\/-])|[^\d\/-]([\/-])?)*|P[T0-9].*|(?:\h*\d+(?:\.\d+)?\h*[a-z]+)+)$/i',
630 630
                        $argument
631 631
                    ) ||
@@ -641,7 +641,7 @@
Loading
641 641
                $this->setEndDate($parsed);
642 642
            } elseif ($this->recurrences === null && $this->endDate === null && is_numeric($argument)) {
643 643
                $this->setRecurrences($argument);
644 -
            } elseif ($this->options === null && (is_int($argument) || $argument === null)) {
644 +
            } elseif ($this->options === null && (\is_int($argument) || $argument === null)) {
645 645
                $this->setOptions($argument);
646 646
            } else {
647 647
                throw new InvalidPeriodParameterException('Invalid constructor parameters.');
@@ -836,7 +836,7 @@
Loading
836 836
     */
837 837
    public function setOptions($options)
838 838
    {
839 -
        if (!is_int($options) && !is_null($options)) {
839 +
        if (!\is_int($options) && !\is_null($options)) {
840 840
            throw new InvalidPeriodParameterException('Invalid options.');
841 841
        }
842 842
@@ -1045,7 +1045,7 @@
Loading
1045 1045
     */
1046 1046
    public function addFilter($callback, $name = null)
1047 1047
    {
1048 -
        $tuple = $this->createFilterTuple(func_get_args());
1048 +
        $tuple = $this->createFilterTuple(\func_get_args());
1049 1049
1050 1050
        $this->filters[] = $tuple;
1051 1051
@@ -1066,7 +1066,7 @@
Loading
1066 1066
     */
1067 1067
    public function prependFilter($callback, $name = null)
1068 1068
    {
1069 -
        $tuple = $this->createFilterTuple(func_get_args());
1069 +
        $tuple = $this->createFilterTuple(\func_get_args());
1070 1070
1071 1071
        array_unshift($this->filters, $tuple);
1072 1072
@@ -1084,7 +1084,7 @@
Loading
1084 1084
     */
1085 1085
    public function removeFilter($filter)
1086 1086
    {
1087 -
        $key = is_callable($filter) ? 0 : 1;
1087 +
        $key = \is_callable($filter) ? 0 : 1;
1088 1088
1089 1089
        $this->filters = array_values(array_filter(
1090 1090
            $this->filters,
@@ -1109,7 +1109,7 @@
Loading
1109 1109
     */
1110 1110
    public function hasFilter($filter)
1111 1111
    {
1112 -
        $key = is_callable($filter) ? 0 : 1;
1112 +
        $key = \is_callable($filter) ? 0 : 1;
1113 1113
1114 1114
        foreach ($this->filters as $tuple) {
1115 1115
            if ($tuple[$key] === $filter) {
@@ -1181,7 +1181,7 @@
Loading
1181 1181
     */
1182 1182
    public function setRecurrences($recurrences)
1183 1183
    {
1184 -
        if (!is_numeric($recurrences) && !is_null($recurrences) || $recurrences < 0) {
1184 +
        if (!is_numeric($recurrences) && !\is_null($recurrences) || $recurrences < 0) {
1185 1185
            throw new InvalidPeriodParameterException('Invalid number of recurrences.');
1186 1186
        }
1187 1187
@@ -1212,7 +1212,7 @@
Loading
1212 1212
     */
1213 1213
    public function setStartDate($date, $inclusive = null)
1214 1214
    {
1215 -
        if (!$date = call_user_func([$this->dateClass, 'make'], $date)) {
1215 +
        if (!$date = \call_user_func([$this->dateClass, 'make'], $date)) {
1216 1216
            throw new InvalidPeriodDateException('Invalid start date.');
1217 1217
        }
1218 1218
@@ -1237,7 +1237,7 @@
Loading
1237 1237
     */
1238 1238
    public function setEndDate($date, $inclusive = null)
1239 1239
    {
1240 -
        if (!is_null($date) && !$date = call_user_func([$this->dateClass, 'make'], $date)) {
1240 +
        if (!\is_null($date) && !$date = \call_user_func([$this->dateClass, 'make'], $date)) {
1241 1241
            throw new InvalidPeriodDateException('Invalid end date.');
1242 1242
        }
1243 1243
@@ -1330,7 +1330,7 @@
Loading
1330 1330
    public function rewind()
1331 1331
    {
1332 1332
        $this->key = 0;
1333 -
        $this->current = call_user_func([$this->dateClass, 'make'], $this->startDate);
1333 +
        $this->current = \call_user_func([$this->dateClass, 'make'], $this->startDate);
1334 1334
        $settings = $this->getSettings();
1335 1335
1336 1336
        if ($this->hasLocalTranslator()) {
@@ -1398,7 +1398,7 @@
Loading
1398 1398
     */
1399 1399
    public function toString()
1400 1400
    {
1401 -
        $translator = call_user_func([$this->dateClass, 'getTranslator']);
1401 +
        $translator = \call_user_func([$this->dateClass, 'getTranslator']);
1402 1402
1403 1403
        $parts = [];
1404 1404
@@ -1506,7 +1506,7 @@
Loading
1506 1506
     */
1507 1507
    public function count()
1508 1508
    {
1509 -
        return count($this->toArray());
1509 +
        return \count($this->toArray());
1510 1510
    }
1511 1511
1512 1512
    /**
@@ -1528,7 +1528,7 @@
Loading
1528 1528
    {
1529 1529
        $array = $this->toArray();
1530 1530
1531 -
        return $array ? $array[count($array) - 1] : null;
1531 +
        return $array ? $array[\count($array) - 1] : null;
1532 1532
    }
1533 1533
1534 1534
    /**
@@ -1570,8 +1570,8 @@
Loading
1570 1570
            return $roundedValue;
1571 1571
        }
1572 1572
1573 -
        $first = count($parameters) >= 1 ? $parameters[0] : null;
1574 -
        $second = count($parameters) >= 2 ? $parameters[1] : null;
1573 +
        $first = \count($parameters) >= 1 ? $parameters[0] : null;
1574 +
        $second = \count($parameters) >= 2 ? $parameters[1] : null;
1575 1575
1576 1576
        switch ($method) {
1577 1577
            case 'start':
@@ -1637,10 +1637,10 @@
Loading
1637 1637
            case 'minute':
1638 1638
            case 'seconds':
1639 1639
            case 'second':
1640 -
                return $this->setDateInterval(call_user_func(
1640 +
                return $this->setDateInterval(\call_user_func(
1641 1641
                    // Override default P1D when instantiating via fluent setters.
1642 1642
                    [$this->isDefaultInterval ? new CarbonInterval('PT0S') : $this->dateInterval, $method],
1643 -
                    count($parameters) === 0 ? 1 : $first
1643 +
                    \count($parameters) === 0 ? 1 : $first
1644 1644
                ));
1645 1645
        }
1646 1646
@@ -2173,7 +2173,7 @@
Loading
2173 2173
        }
2174 2174
2175 2175
        return [function ($date) use ($method, $parameters) {
2176 -
            return call_user_func_array([$date, $method], $parameters);
2176 +
            return \call_user_func_array([$date, $method], $parameters);
2177 2177
        }, $method];
2178 2178
    }
2179 2179
@@ -2187,7 +2187,7 @@
Loading
2187 2187
     */
2188 2188
    protected function isCarbonPredicateMethod($callable)
2189 2189
    {
2190 -
        return is_string($callable) && substr($callable, 0, 2) === 'is' && (method_exists($this->dateClass, $callable) || call_user_func([$this->dateClass, 'hasMacro'], $callable));
2190 +
        return \is_string($callable) && substr($callable, 0, 2) === 'is' && (method_exists($this->dateClass, $callable) || \call_user_func([$this->dateClass, 'hasMacro'], $callable));
2191 2191
    }
2192 2192
2193 2193
    /**
@@ -2285,7 +2285,7 @@
Loading
2285 2285
        $current = $this->prepareForReturn($this->current);
2286 2286
2287 2287
        foreach ($this->filters as $tuple) {
2288 -
            $result = call_user_func(
2288 +
            $result = \call_user_func(
2289 2289
                $tuple[0],
2290 2290
                $current->copy(),
2291 2291
                $this->key,
@@ -2313,7 +2313,7 @@
Loading
2313 2313
     */
2314 2314
    protected function prepareForReturn(CarbonInterface $date)
2315 2315
    {
2316 -
        $date = call_user_func([$this->dateClass, 'make'], $date);
2316 +
        $date = \call_user_func([$this->dateClass, 'make'], $date);
2317 2317
2318 2318
        if ($this->timezone) {
2319 2319
            $date = $date->setTimezone($this->timezone);
@@ -2359,10 +2359,10 @@
Loading
2359 2359
        if ($macro instanceof Closure) {
2360 2360
            $boundMacro = @$macro->bindTo($this, static::class) ?: @$macro->bindTo(null, static::class);
2361 2361
2362 -
            return call_user_func_array($boundMacro ?: $macro, $parameters);
2362 +
            return \call_user_func_array($boundMacro ?: $macro, $parameters);
2363 2363
        }
2364 2364
2365 -
        return call_user_func_array($macro, $parameters);
2365 +
        return \call_user_func_array($macro, $parameters);
2366 2366
    }
2367 2367
2368 2368
    /**

@@ -441,7 +441,7 @@
Loading
441 441
     */
442 442
    public function isWeekend()
443 443
    {
444 -
        return in_array($this->dayOfWeek, static::$weekendDays);
444 +
        return \in_array($this->dayOfWeek, static::$weekendDays);
445 445
    }
446 446
447 447
    /**
@@ -710,8 +710,8 @@
Loading
710 710
     */
711 711
    public function isDayOfWeek($dayOfWeek)
712 712
    {
713 -
        if (is_string($dayOfWeek) && defined($constant = static::class.'::'.strtoupper($dayOfWeek))) {
714 -
            $dayOfWeek = constant($constant);
713 +
        if (\is_string($dayOfWeek) && \defined($constant = static::class.'::'.strtoupper($dayOfWeek))) {
714 +
            $dayOfWeek = \constant($constant);
715 715
        }
716 716
717 717
        return $this->dayOfWeek === $dayOfWeek;
@@ -943,7 +943,7 @@
Loading
943 943
        $tester = trim($tester);
944 944
945 945
        if (preg_match('/^\d+$/', $tester)) {
946 -
            return $this->year === intval($tester);
946 +
            return $this->year === \intval($tester);
947 947
        }
948 948
949 949
        if (preg_match('/^\d{3,}-\d{1,2}$/', $tester)) {

@@ -162,7 +162,7 @@
Loading
162 162
     */
163 163
    private static function getIntegerAndDecimalParts($numbers, $decimals = 6)
164 164
    {
165 -
        if (is_int($numbers) || is_float($numbers)) {
165 +
        if (\is_int($numbers) || \is_float($numbers)) {
166 166
            $numbers = number_format($numbers, $decimals, '.', '');
167 167
        }
168 168
@@ -173,8 +173,8 @@
Loading
173 173
        foreach (preg_split('`[^0-9.]+`', $numbers) as $chunk) {
174 174
            [$integerPart, $decimalPart] = explode('.', "$chunk.");
175 175
176 -
            $integer += intval($integerPart);
177 -
            $decimal += floatval("0.$decimalPart");
176 +
            $integer += \intval($integerPart);
177 +
            $decimal += \floatval("0.$decimalPart");
178 178
        }
179 179
180 180
        $overflow = floor($decimal);

@@ -173,7 +173,7 @@
Loading
173 173
        if (!($translator instanceof TranslatorBagInterface && $translator instanceof TranslatorInterface)) {
174 174
            throw new InvalidTypeException(
175 175
                'Translator does not implement '.TranslatorInterface::class.' and '.TranslatorBagInterface::class.'. '.
176 -
                (is_object($translator) ? get_class($translator) : gettype($translator)).' has been given.'
176 +
                (\is_object($translator) ? \get_class($translator) : \gettype($translator)).' has been given.'
177 177
            );
178 178
        }
179 179
@@ -387,7 +387,7 @@
Loading
387 387
                    'second',
388 388
                ], $messages, $key) : [],
389 389
                $mode & CarbonInterface::TRANSLATE_MERIDIEM ? array_map(function ($hour) use ($meridiem) {
390 -
                    if (is_array($meridiem)) {
390 +
                    if (\is_array($meridiem)) {
391 391
                        return $meridiem[$hour < 12 ? 0 : 1];
392 392
                    }
393 393
@@ -535,7 +535,7 @@
Loading
535 535
    public static function executeWithLocale($locale, $func)
536 536
    {
537 537
        $currentLocale = static::getLocale();
538 -
        $result = call_user_func($func, static::setLocale($locale) ? static::getLocale() : false, static::translator());
538 +
        $result = \call_user_func($func, static::setLocale($locale) ? static::getLocale() : false, static::translator());
539 539
        static::setLocale($currentLocale);
540 540
541 541
        return $result;
@@ -706,7 +706,7 @@
Loading
706 706
     */
707 707
    protected function getTranslatorLocale($translator = null): ?string
708 708
    {
709 -
        if (func_num_args() === 0) {
709 +
        if (\func_num_args() === 0) {
710 710
            $translator = $this->getLocalTranslator();
711 711
        }
712 712
@@ -724,7 +724,7 @@
Loading
724 724
     */
725 725
    protected static function getLocaleAwareTranslator($translator = null)
726 726
    {
727 -
        if (func_num_args() === 0) {
727 +
        if (\func_num_args() === 0) {
728 728
            $translator = static::translator();
729 729
        }
730 730
@@ -792,7 +792,7 @@
Loading
792 792
    {
793 793
        $filler = '>>DO NOT REPLACE<<';
794 794
795 -
        if (is_array($translation)) {
795 +
        if (\is_array($translation)) {
796 796
            return array_pad($translation, $length, $filler);
797 797
        }
798 798

@@ -63,7 +63,7 @@
Loading
63 63
     */
64 64
    public static function mixin($mixin)
65 65
    {
66 -
        is_string($mixin) && trait_exists($mixin)
66 +
        \is_string($mixin) && trait_exists($mixin)
67 67
            ? static::loadMixinTrait($mixin)
68 68
            : static::loadMixinClass($mixin);
69 69
    }
@@ -97,7 +97,7 @@
Loading
97 97
    {
98 98
        $baseClass = static::class;
99 99
        $context = eval('return new class() extends '.$baseClass.' {use '.$trait.';};');
100 -
        $className = get_class($context);
100 +
        $className = \get_class($context);
101 101
102 102
        foreach (get_class_methods($context) as $name) {
103 103
            if (method_exists($baseClass, $name)) {
@@ -115,7 +115,7 @@
Loading
115 115
                    $closure = $closureBase;
116 116
                }
117 117
118 -
                return $closure(...func_get_args());
118 +
                return $closure(...\func_get_args());
119 119
            });
120 120
        }
121 121
    }

@@ -21,7 +21,7 @@
Loading
21 21
    public function hasMethod(string $className, string $methodName): bool
22 22
    {
23 23
        return is_a($className, CarbonInterface::class, true) &&
24 -
            is_callable([$className, 'hasMacro']) &&
24 +
            \is_callable([$className, 'hasMacro']) &&
25 25
            $className::hasMacro($methodName);
26 26
    }
27 27

@@ -709,7 +709,7 @@
Loading
709 709
        if (!$date instanceof DateTime && !$date instanceof DateTimeInterface) {
710 710
            throw new InvalidTypeException(
711 711
                $message.'DateTime or DateTimeInterface, '.
712 -
                (is_object($date) ? get_class($date) : gettype($date)).' given'
712 +
                (\is_object($date) ? \get_class($date) : \gettype($date)).' given'
713 713
            );
714 714
        }
715 715
    }
@@ -728,7 +728,7 @@
Loading
728 728
            return $this->nowWithSameTz();
729 729
        }
730 730
731 -
        if (is_string($date)) {
731 +
        if (\is_string($date)) {
732 732
            return static::parse($date, $this->getTimezone());
733 733
        }
734 734
@@ -925,7 +925,7 @@
Loading
925 925
926 926
            // @property int 1 through 366
927 927
            case $name === 'dayOfYear':
928 -
                return 1 + intval($this->rawFormat('z'));
928 +
                return 1 + \intval($this->rawFormat('z'));
929 929
930 930
            // @property-read int 365 or 366
931 931
            case $name === 'daysInYear':
@@ -1073,7 +1073,7 @@
Loading
1073 1073
            throw new ImmutableException(sprintf('%s class', static::class));
1074 1074
        }
1075 1075
1076 -
        if (is_array($name)) {
1076 +
        if (\is_array($name)) {
1077 1077
            foreach ($name as $key => $value) {
1078 1078
                $this->set($key, $value);
1079 1079
            }
@@ -1283,7 +1283,7 @@
Loading
1283 1283
    {
1284 1284
        $dayOfYear = $this->dayOfYear;
1285 1285
1286 -
        return is_null($value) ? $dayOfYear : $this->addDays($value - $dayOfYear);
1286 +
        return \is_null($value) ? $dayOfYear : $this->addDays($value - $dayOfYear);
1287 1287
    }
1288 1288
1289 1289
    /**
@@ -1295,9 +1295,9 @@
Loading
1295 1295
     */
1296 1296
    public function weekday($value = null)
1297 1297
    {
1298 -
        $dayOfWeek = ($this->dayOfWeek + 7 - intval($this->getTranslationMessage('first_day_of_week') ?? 0)) % 7;
1298 +
        $dayOfWeek = ($this->dayOfWeek + 7 - \intval($this->getTranslationMessage('first_day_of_week') ?? 0)) % 7;
1299 1299
1300 -
        return is_null($value) ? $dayOfWeek : $this->addDays($value - $dayOfWeek);
1300 +
        return \is_null($value) ? $dayOfWeek : $this->addDays($value - $dayOfWeek);
1301 1301
    }
1302 1302
1303 1303
    /**
@@ -1311,7 +1311,7 @@
Loading
1311 1311
    {
1312 1312
        $dayOfWeekIso = $this->dayOfWeekIso;
1313 1313
1314 -
        return is_null($value) ? $dayOfWeekIso : $this->addDays($value - $dayOfWeekIso);
1314 +
        return \is_null($value) ? $dayOfWeekIso : $this->addDays($value - $dayOfWeekIso);
1315 1315
    }
1316 1316
1317 1317
    /**
@@ -1380,7 +1380,7 @@
Loading
1380 1380
     */
1381 1381
    public function utcOffset(int $offset = null)
1382 1382
    {
1383 -
        if (func_num_args() < 1) {
1383 +
        if (\func_num_args() < 1) {
1384 1384
            return $this->offsetMinutes;
1385 1385
        }
1386 1386
@@ -1507,7 +1507,7 @@
Loading
1507 1507
     */
1508 1508
    public function tz($value = null)
1509 1509
    {
1510 -
        if (func_num_args() < 1) {
1510 +
        if (\func_num_args() < 1) {
1511 1511
            return $this->tzName;
1512 1512
        }
1513 1513
@@ -1869,7 +1869,7 @@
Loading
1869 1869
                's' => 'second',
1870 1870
                'ss' => ['getPaddedUnit', ['second']],
1871 1871
                'S' => function (CarbonInterface $date) {
1872 -
                    return strval((string) floor($date->micro / 100000));
1872 +
                    return \strval((string) floor($date->micro / 100000));
1873 1873
                },
1874 1874
                'SS' => function (CarbonInterface $date) {
1875 1875
                    return str_pad((string) floor($date->micro / 10000), 2, '0', STR_PAD_LEFT);
@@ -1976,7 +1976,7 @@
Loading
1976 1976
            ':period' => $period,
1977 1977
        ]);
1978 1978
1979 -
        return strval($result === 'ordinal' ? $number : $result);
1979 +
        return \strval($result === 'ordinal' ? $number : $result);
1980 1980
    }
1981 1981
1982 1982
    /**
@@ -2028,7 +2028,7 @@
Loading
2028 2028
     */
2029 2029
    public function getAltNumber(string $key): string
2030 2030
    {
2031 -
        return $this->translateNumber(strlen($key) > 1 ? $this->$key : $this->rawFormat('h'));
2031 +
        return $this->translateNumber(\strlen($key) > 1 ? $this->$key : $this->rawFormat('h'));
2032 2032
    }
2033 2033
2034 2034
    /**
@@ -2107,13 +2107,13 @@
Loading
2107 2107
2108 2108
                if ($sequence instanceof Closure) {
2109 2109
                    $sequence = $sequence($this, $originalFormat);
2110 -
                } elseif (is_array($sequence)) {
2110 +
                } elseif (\is_array($sequence)) {
2111 2111
                    try {
2112 2112
                        $sequence = $this->{$sequence[0]}(...$sequence[1]);
2113 2113
                    } catch (ReflectionException | InvalidArgumentException | BadMethodCallException $e) {
2114 2114
                        $sequence = '';
2115 2115
                    }
2116 -
                } elseif (is_string($sequence)) {
2116 +
                } elseif (\is_string($sequence)) {
2117 2117
                    $sequence = $this->$sequence ?? $code;
2118 2118
                }
2119 2119
@@ -2295,10 +2295,10 @@
Loading
2295 2295
            if ($macro instanceof Closure) {
2296 2296
                $boundMacro = @Closure::bind($macro, null, static::class);
2297 2297
2298 -
                return call_user_func_array($boundMacro ?: $macro, $parameters);
2298 +
                return \call_user_func_array($boundMacro ?: $macro, $parameters);
2299 2299
            }
2300 2300
2301 -
            return call_user_func_array($macro, $parameters);
2301 +
            return \call_user_func_array($macro, $parameters);
2302 2302
        });
2303 2303
    }
2304 2304
@@ -2344,7 +2344,7 @@
Loading
2344 2344
    {
2345 2345
        $unit = static::singularUnit($unit);
2346 2346
        $dateUnits = ['year', 'month', 'day'];
2347 -
        if (in_array($unit, $dateUnits)) {
2347 +
        if (\in_array($unit, $dateUnits)) {
2348 2348
            return $this->setDate(...array_map(function ($name) use ($unit, $value) {
2349 2349
                return (int) ($name === $unit ? $value : $this->$name);
2350 2350
            }, $dateUnits));
@@ -2412,10 +2412,10 @@
Loading
2412 2412
        if ($macro instanceof Closure) {
2413 2413
            $boundMacro = @$macro->bindTo($this, static::class) ?: @$macro->bindTo(null, static::class);
2414 2414
2415 -
            return call_user_func_array($boundMacro ?: $macro, $parameters);
2415 +
            return \call_user_func_array($boundMacro ?: $macro, $parameters);
2416 2416
        }
2417 2417
2418 -
        return call_user_func_array($macro, $parameters);
2418 +
        return \call_user_func_array($macro, $parameters);
2419 2419
    }
2420 2420
2421 2421
    protected function executeCallableWithContext($macro, ...$parameters)
@@ -2471,7 +2471,7 @@
Loading
2471 2471
            });
2472 2472
            $other = null;
2473 2473
2474 -
            if (count($dates)) {
2474 +
            if (\count($dates)) {
2475 2475
                $key = key($dates);
2476 2476
                $other = current($dates);
2477 2477
                array_splice($parameters, $key, 1);
@@ -2491,7 +2491,7 @@
Loading
2491 2491
        if (substr($unit, 0, 2) === 'is') {
2492 2492
            $word = substr($unit, 2);
2493 2493
2494 -
            if (in_array($word, static::$days)) {
2494 +
            if (\in_array($word, static::$days)) {
2495 2495
                return $this->isDayOfWeek($word);
2496 2496
            }
2497 2497
@@ -2519,7 +2519,7 @@
Loading
2519 2519
            $unit = strtolower(substr($unit, 3));
2520 2520
        }
2521 2521
2522 -
        if (in_array($unit, static::$units)) {
2522 +
        if (\in_array($unit, static::$units)) {
2523 2523
            return $this->setUnit($unit, ...$parameters);
2524 2524
        }
2525 2525

@@ -165,7 +165,7 @@
Loading
165 165
166 166
            return $format(
167 167
                ...array_values($parameters),
168 -
                ...array_fill(0, max(0, $count - count($parameters)), null)
168 +
                ...array_fill(0, max(0, $count - \count($parameters)), null)
169 169
            );
170 170
        }
171 171
@@ -317,7 +317,7 @@
Loading
317 317
            // _2-letters or YUE is a region, _3+-letters is a variant
318 318
            $upper = strtoupper($matches[1]);
319 319
320 -
            if ($upper === 'YUE' || $upper === 'ISO' || strlen($upper) < 3) {
320 +
            if ($upper === 'YUE' || $upper === 'ISO' || \strlen($upper) < 3) {
321 321
                return "_$upper";
322 322
            }
323 323

@@ -27,8 +27,8 @@
Loading
27 27
            $action = substr($method, 0, 5);
28 28
        }
29 29
30 -
        if (in_array($action, ['round', 'floor', 'ceil'])) {
31 -
            return $this->{$action.'Unit'}(substr($method, strlen($action)), ...$parameters);
30 +
        if (\in_array($action, ['round', 'floor', 'ceil'])) {
31 +
            return $this->{$action.'Unit'}(substr($method, \strlen($action)), ...$parameters);
32 32
        }
33 33
34 34
        return null;
@@ -42,7 +42,7 @@
Loading
42 42
            $precision = (string) CarbonInterval::instance($precision);
43 43
        }
44 44
45 -
        if (is_string($precision) && preg_match('/^\s*(?<precision>\d+)?\s*(?<unit>\w+)(?<other>\W.*)?$/', $precision, $match)) {
45 +
        if (\is_string($precision) && preg_match('/^\s*(?<precision>\d+)?\s*(?<unit>\w+)(?<other>\W.*)?$/', $precision, $match)) {
46 46
            if (trim($match['other'] ?? '') !== '') {
47 47
                throw new InvalidIntervalException('Rounding is only possible with single unit intervals.');
48 48
            }

@@ -334,7 +334,7 @@
Loading
334 334
335 335
        $spec = $years;
336 336
337 -
        if (!is_string($spec) || floatval($years) || preg_match('/^[0-9.]/', $years)) {
337 +
        if (!\is_string($spec) || \floatval($years) || preg_match('/^[0-9.]/', $years)) {
338 338
            $spec = static::PERIOD_PREFIX;
339 339
340 340
            $spec .= $years > 0 ? $years.static::PERIOD_YEARS : '';
@@ -361,7 +361,7 @@
Loading
361 361
362 362
        parent::__construct($spec);
363 363
364 -
        if (!is_null($microseconds)) {
364 +
        if (!\is_null($microseconds)) {
365 365
            $this->f = $microseconds / Carbon::MICROSECONDS_PER_SECOND;
366 366
        }
367 367
    }
@@ -499,7 +499,7 @@
Loading
499 499
500 500
        if (preg_match('/s([,.])([uv])$/', $format, $match)) {
501 501
            $interval = explode($match[1], $interval);
502 -
            $index = count($interval) - 1;
502 +
            $index = \count($interval) - 1;
503 503
            $interval[$index] = str_pad($interval[$index], $match[2] === 'v' ? 3 : 6, '0');
504 504
            $interval = implode($match[1], $interval);
505 505
        }
@@ -515,7 +515,7 @@
Loading
515 515
                }
516 516
517 517
                $interval = mb_substr($interval, mb_strlen($match[0]));
518 -
                $instance->$unit += intval($match[0]);
518 +
                $instance->$unit += \intval($match[0]);
519 519
520 520
                continue;
521 521
            }
@@ -642,8 +642,8 @@
Loading
642 642
        preg_match_all($pattern, $intervalDefinition, $parts, PREG_SET_ORDER);
643 643
644 644
        while ([$part, $value, $unit] = array_shift($parts)) {
645 -
            $intValue = intval($value);
646 -
            $fraction = floatval($value) - $intValue;
645 +
            $intValue = \intval($value);
646 +
            $fraction = \floatval($value) - $intValue;
647 647
648 648
            // Fix calculation precision
649 649
            switch (round($fraction, 6)) {
@@ -881,7 +881,7 @@
Loading
881 881
            return new static($interval);
882 882
        }
883 883
884 -
        if (!is_string($interval)) {
884 +
        if (!\is_string($interval)) {
885 885
            return null;
886 886
        }
887 887
@@ -1028,7 +1028,7 @@
Loading
1028 1028
     */
1029 1029
    public function set($name, $value = null)
1030 1030
    {
1031 -
        $properties = is_array($name) ? $name : [$name => $value];
1031 +
        $properties = \is_array($name) ? $name : [$name => $value];
1032 1032
1033 1033
        foreach ($properties as $key => $value) {
1034 1034
            switch (Carbon::singularUnit(rtrim($key, 'z'))) {
@@ -1228,10 +1228,10 @@
Loading
1228 1228
        if ($macro instanceof Closure) {
1229 1229
            $boundMacro = @$macro->bindTo($this, static::class) ?: @$macro->bindTo(null, static::class);
1230 1230
1231 -
            return call_user_func_array($boundMacro ?: $macro, $parameters);
1231 +
            return \call_user_func_array($boundMacro ?: $macro, $parameters);
1232 1232
        }
1233 1233
1234 -
        return call_user_func_array($macro, $parameters);
1234 +
        return \call_user_func_array($macro, $parameters);
1235 1235
    }
1236 1236
1237 1237
    /**
@@ -1262,7 +1262,7 @@
Loading
1262 1262
        }
1263 1263
1264 1264
        try {
1265 -
            $this->set($method, count($parameters) === 0 ? 1 : $parameters[0]);
1265 +
            $this->set($method, \count($parameters) === 0 ? 1 : $parameters[0]);
1266 1266
        } catch (UnknownSetterException $exception) {
1267 1267
            if ($this->localStrictModeEnabled ?? Carbon::isStrictModeEnabled()) {
1268 1268
                throw new BadFluentSetterException($method, 0, $exception);
@@ -1274,18 +1274,18 @@
Loading
1274 1274
1275 1275
    protected function getForHumansInitialVariables($syntax, $short)
1276 1276
    {
1277 -
        if (is_array($syntax)) {
1277 +
        if (\is_array($syntax)) {
1278 1278
            return $syntax;
1279 1279
        }
1280 1280
1281 -
        if (is_int($short)) {
1281 +
        if (\is_int($short)) {
1282 1282
            return [
1283 1283
                'parts' => $short,
1284 1284
                'short' => false,
1285 1285
            ];
1286 1286
        }
1287 1287
1288 -
        if (is_bool($syntax)) {
1288 +
        if (\is_bool($syntax)) {
1289 1289
            return [
1290 1290
                'short' => $syntax,
1291 1291
                'syntax' => CarbonInterface::DIFF_ABSOLUTE,
@@ -1313,7 +1313,7 @@
Loading
1313 1313
        $minimumUnit = 's';
1314 1314
        extract($this->getForHumansInitialVariables($syntax, $short));
1315 1315
1316 -
        if (is_null($syntax)) {
1316 +
        if (\is_null($syntax)) {
1317 1317
            $syntax = CarbonInterface::DIFF_ABSOLUTE;
1318 1318
        }
1319 1319
@@ -1321,7 +1321,7 @@
Loading
1321 1321
            $parts = INF;
1322 1322
        }
1323 1323
1324 -
        if (is_null($options)) {
1324 +
        if (\is_null($options)) {
1325 1325
            $options = static::getHumanDiffOptions();
1326 1326
        }
1327 1327
@@ -1337,11 +1337,11 @@
Loading
1337 1337
        if ($altNumbers) {
1338 1338
            if ($altNumbers !== true) {
1339 1339
                $language = new Language($this->locale);
1340 -
                $altNumbers = in_array($language->getCode(), (array) $altNumbers);
1340 +
                $altNumbers = \in_array($language->getCode(), (array) $altNumbers);
1341 1341
            }
1342 1342
        }
1343 1343
1344 -
        if (is_array($join)) {
1344 +
        if (\is_array($join)) {
1345 1345
            [$default, $last] = $join;
1346 1346
1347 1347
            if ($default !== ' ') {
@@ -1349,7 +1349,7 @@
Loading
1349 1349
            }
1350 1350
1351 1351
            $join = function ($list) use ($default, $last) {
1352 -
                if (count($list) < 2) {
1352 +
                if (\count($list) < 2) {
1353 1353
                    return implode('', $list);
1354 1354
                }
1355 1355
@@ -1359,7 +1359,7 @@
Loading
1359 1359
            };
1360 1360
        }
1361 1361
1362 -
        if (is_string($join)) {
1362 +
        if (\is_string($join)) {
1363 1363
            if ($join !== ' ') {
1364 1364
                $optionalSpace = '';
1365 1365
            }
@@ -1439,7 +1439,7 @@
Loading
1439 1439
1440 1440
        $keys = array_keys($nonZeroValues);
1441 1441
        $firstKey = $keys[0];
1442 -
        $lastKey = $keys[count($keys) - 1];
1442 +
        $lastKey = $keys[\count($keys) - 1];
1443 1443
        $values = [];
1444 1444
        $record = false;
1445 1445
@@ -1544,8 +1544,8 @@
Loading
1544 1544
1545 1545
        if ($method) {
1546 1546
            while (
1547 -
                count($intervalValues->getNonZeroValues()) > $parts &&
1548 -
                ($count = count($keys = array_keys($intervalValues->getValuesSequence()))) > 1
1547 +
                \count($intervalValues->getNonZeroValues()) > $parts &&
1548 +
                ($count = \count($keys = array_keys($intervalValues->getValuesSequence()))) > 1
1549 1549
            ) {
1550 1550
                $intervalValues = $this->copy()->roundUnit($keys[$count - 2], 1, $method);
1551 1551
            }
@@ -1593,24 +1593,24 @@
Loading
1593 1593
                $unit = $short ? $diffIntervalData['unitShort'] : $diffIntervalData['unit'];
1594 1594
                $count = $diffIntervalData['value'];
1595 1595
                $interval[] = $transChoice($short, $diffIntervalData);
1596 -
            } elseif ($options & CarbonInterface::SEQUENTIAL_PARTS_ONLY && count($interval) > 0) {
1596 +
            } elseif ($options & CarbonInterface::SEQUENTIAL_PARTS_ONLY && \count($interval) > 0) {
1597 1597
                break;
1598 1598
            }
1599 1599
1600 1600
            // break the loop after we get the required number of parts in array
1601 -
            if (count($interval) >= $parts) {
1601 +
            if (\count($interval) >= $parts) {
1602 1602
                break;
1603 1603
            }
1604 1604
1605 1605
            // break the loop after we have reached the minimum unit
1606 -
            if (in_array($minimumUnit, [$diffIntervalData['unit'], $diffIntervalData['unitShort']])) {
1606 +
            if (\in_array($minimumUnit, [$diffIntervalData['unit'], $diffIntervalData['unitShort']])) {
1607 1607
                $fallbackUnit = [$diffIntervalData['unit'], $diffIntervalData['unitShort']];
1608 1608
1609 1609
                break;
1610 1610
            }
1611 1611
        }
1612 1612
1613 -
        if (count($interval) === 0) {
1613 +
        if (\count($interval) === 0) {
1614 1614
            if ($relativeToNow && $options & CarbonInterface::JUST_NOW) {
1615 1615
                $key = 'diff_now';
1616 1616
                $translation = $this->translate($key, $interpolations, null, $translator);
@@ -1728,7 +1728,7 @@
Loading
1728 1728
     */
1729 1729
    public function invert($inverted = null)
1730 1730
    {
1731 -
        $this->invert = (func_num_args() === 0 ? !$this->invert : $inverted) ? 1 : 0;
1731 +
        $this->invert = (\func_num_args() === 0 ? !$this->invert : $inverted) ? 1 : 0;
1732 1732
1733 1733
        return $this;
1734 1734
    }
@@ -1763,7 +1763,7 @@
Loading
1763 1763
            [$value, $unit] = [$unit, $value];
1764 1764
        }
1765 1765
1766 -
        if (is_string($unit) && !preg_match('/^\s*\d/', $unit)) {
1766 +
        if (\is_string($unit) && !preg_match('/^\s*\d/', $unit)) {
1767 1767
            $unit = "$value $unit";
1768 1768
            $value = 1;
1769 1769
        }
@@ -1806,7 +1806,7 @@
Loading
1806 1806
            [$value, $unit] = [$unit, $value];
1807 1807
        }
1808 1808
1809 -
        return $this->add($unit, -floatval($value));
1809 +
        return $this->add($unit, -\floatval($value));
1810 1810
    }
1811 1811
1812 1812
    /**
@@ -1959,7 +1959,7 @@
Loading
1959 1959
            $specString .= $value.$key;
1960 1960
        }
1961 1961
1962 -
        if (count($time) > 0) {
1962 +
        if (\count($time) > 0) {
1963 1963
            $specString .= static::PERIOD_TIME_PREFIX;
1964 1964
            foreach ($time as $key => $value) {
1965 1965
                $specString .= $value.$key;
@@ -2112,9 +2112,9 @@
Loading
2112 2112
    {
2113 2113
        $realUnit = $unit = strtolower($unit);
2114 2114
2115 -
        if (in_array($unit, ['days', 'weeks'])) {
2115 +
        if (\in_array($unit, ['days', 'weeks'])) {
2116 2116
            $realUnit = 'dayz';
2117 -
        } elseif (!in_array($unit, ['microseconds', 'milliseconds', 'seconds', 'minutes', 'hours', 'dayz', 'months', 'years'])) {
2117 +
        } elseif (!\in_array($unit, ['microseconds', 'milliseconds', 'seconds', 'minutes', 'hours', 'dayz', 'months', 'years'])) {
2118 2118
            throw new UnknownUnitException($unit);
2119 2119
        }
2120 2120

@@ -65,7 +65,7 @@
Loading
65 65
    {
66 66
        $this->className = $className;
67 67
        $this->methodName = $methodName;
68 -
        $this->reflectionFunction = is_array($macro)
68 +
        $this->reflectionFunction = \is_array($macro)
69 69
            ? new ReflectionMethod($macro[0], $macro[1])
70 70
            : new ReflectionFunction($macro);
71 71
        $this->parameters = $this->reflectionFunction->getParameters();

@@ -165,7 +165,7 @@
Loading
165 165
            'weekday',
166 166
        ];
167 167
168 -
        return in_array($unit, $modifiableUnits) || in_array($unit, static::$units);
168 +
        return \in_array($unit, $modifiableUnits) || \in_array($unit, static::$units);
169 169
    }
170 170
171 171
    /**
@@ -195,7 +195,7 @@
Loading
195 195
     */
196 196
    public function add($unit, $value = 1, $overflow = null)
197 197
    {
198 -
        if (is_string($unit) && func_num_args() === 1) {
198 +
        if (\is_string($unit) && \func_num_args() === 1) {
199 199
            $unit = CarbonInterval::make($unit);
200 200
        }
201 201
@@ -231,7 +231,7 @@
Loading
231 231
    {
232 232
        $date = $this;
233 233
234 -
        if (!is_numeric($value) || !floatval($value)) {
234 +
        if (!is_numeric($value) || !\floatval($value)) {
235 235
            return $date->isMutable() ? $date : $date->copy();
236 236
        }
237 237
@@ -253,14 +253,14 @@
Loading
253 253
            if ($weekendDays !== [static::SATURDAY, static::SUNDAY]) {
254 254
                $absoluteValue = abs($value);
255 255
                $sign = $value / max(1, $absoluteValue);
256 -
                $weekDaysCount = 7 - min(6, count(array_unique($weekendDays)));
256 +
                $weekDaysCount = 7 - min(6, \count(array_unique($weekendDays)));
257 257
                $weeks = floor($absoluteValue / $weekDaysCount);
258 258
259 259
                for ($diff = $absoluteValue % $weekDaysCount; $diff; $diff--) {
260 260
                    /** @var static $date */
261 261
                    $date = $date->addDays($sign);
262 262
263 -
                    while (in_array($date->dayOfWeek, $weekendDays)) {
263 +
                    while (\in_array($date->dayOfWeek, $weekendDays)) {
264 264
                        $date = $date->addDays($sign);
265 265
                    }
266 266
                }
@@ -270,7 +270,7 @@
Loading
270 270
            }
271 271
272 272
            $timeString = $date->toTimeString();
273 -
        } elseif ($canOverflow = in_array($unit, [
273 +
        } elseif ($canOverflow = \in_array($unit, [
274 274
                'month',
275 275
                'year',
276 276
            ]) && ($overflow === false || (
@@ -354,7 +354,7 @@
Loading
354 354
     */
355 355
    public function sub($unit, $value = 1, $overflow = null)
356 356
    {
357 -
        if (is_string($unit) && func_num_args() === 1) {
357 +
        if (\is_string($unit) && \func_num_args() === 1) {
358 358
            $unit = CarbonInterval::make($unit);
359 359
        }
360 360
@@ -374,7 +374,7 @@
Loading
374 374
            [$value, $unit] = [$unit, $value];
375 375
        }
376 376
377 -
        return $this->addUnit($unit, -floatval($value), $overflow);
377 +
        return $this->addUnit($unit, -\floatval($value), $overflow);
378 378
    }
379 379
380 380
    /**
@@ -390,7 +390,7 @@
Loading
390 390
     */
391 391
    public function subtract($unit, $value = 1, $overflow = null)
392 392
    {
393 -
        if (is_string($unit) && func_num_args() === 1) {
393 +
        if (\is_string($unit) && \func_num_args() === 1) {
394 394
            $unit = CarbonInterval::make($unit);
395 395
        }
396 396

@@ -92,7 +92,7 @@
Loading
92 92
                $factor /= $delta;
93 93
                $fraction *= $delta;
94 94
                $arguments[0] += $this->$unit * $factor;
95 -
                $changes[$unit] = round($minimum + ($fraction ? $fraction * call_user_func($function, ($this->$unit - $minimum) / $fraction) : 0));
95 +
                $changes[$unit] = round($minimum + ($fraction ? $fraction * \call_user_func($function, ($this->$unit - $minimum) / $fraction) : 0));
96 96
97 97
                // Cannot use modulo as it lose double precision
98 98
                while ($changes[$unit] >= $delta) {
@@ -105,7 +105,7 @@
Loading
105 105
106 106
        [$value, $minimum] = $arguments;
107 107
        /** @var CarbonInterface $result */
108 -
        $result = $this->$normalizedUnit(floor(call_user_func($function, ($value - $minimum) / $precision) * $precision + $minimum));
108 +
        $result = $this->$normalizedUnit(floor(\call_user_func($function, ($value - $minimum) / $precision) * $precision + $minimum));
109 109
110 110
        foreach ($changes as $unit => $value) {
111 111
            $result = $result->$unit($value);

@@ -59,7 +59,7 @@
Loading
59 59
            $time = $this->constructTimezoneFromDateTime($time, $tz)->format('Y-m-d H:i:s.u');
60 60
        }
61 61
62 -
        if (is_numeric($time) && (!is_string($time) || !preg_match('/^\d{1,14}$/', $time))) {
62 +
        if (is_numeric($time) && (!\is_string($time) || !preg_match('/^\d{1,14}$/', $time))) {
63 63
            $time = static::createFromTimestampUTC($time)->format('Y-m-d\TH:i:s.uP');
64 64
        }
65 65
@@ -214,11 +214,11 @@
Loading
214 214
            return static::rawParse($time, $tz);
215 215
        }
216 216
217 -
        if (is_string($function) && method_exists(static::class, $function)) {
217 +
        if (\is_string($function) && method_exists(static::class, $function)) {
218 218
            $function = [static::class, $function];
219 219
        }
220 220
221 -
        return $function(...func_get_args());
221 +
        return $function(...\func_get_args());
222 222
    }
223 223
224 224
    /**
@@ -366,8 +366,8 @@
Loading
366 366
     */
367 367
    public static function create($year = 0, $month = 1, $day = 1, $hour = 0, $minute = 0, $second = 0, $tz = null)
368 368
    {
369 -
        if (is_string($year) && !is_numeric($year)) {
370 -
            return static::parse($year, $tz ?: (is_string($month) || $month instanceof DateTimeZone ? $month : null));
369 +
        if (\is_string($year) && !is_numeric($year)) {
370 +
            return static::parse($year, $tz ?: (\is_string($month) || $month instanceof DateTimeZone ? $month : null));
371 371
        }
372 372
373 373
        $defaults = null;
@@ -453,7 +453,7 @@
Loading
453 453
        $fields = static::getRangesByUnit();
454 454
455 455
        foreach ($fields as $field => $range) {
456 -
            if ($$field !== null && (!is_int($$field) || $$field < $range[0] || $$field > $range[1])) {
456 +
            if ($$field !== null && (!\is_int($$field) || $$field < $range[0] || $$field > $range[1])) {
457 457
                if (static::isStrictModeEnabled()) {
458 458
                    throw new InvalidDateException($field, $$field);
459 459
                }
@@ -465,7 +465,7 @@
Loading
465 465
        $instance = static::create($year, $month, $day, $hour, $minute, $second, $tz);
466 466
467 467
        foreach (array_reverse($fields) as $field => $range) {
468 -
            if ($$field !== null && (!is_int($$field) || $$field !== $instance->$field)) {
468 +
            if ($$field !== null && (!\is_int($$field) || $$field !== $instance->$field)) {
469 469
                if (static::isStrictModeEnabled()) {
470 470
                    throw new InvalidDateException($field, $$field);
471 471
                }
@@ -563,7 +563,7 @@
Loading
563 563
            return parent::createFromFormat($format, "$time");
564 564
        }
565 565
566 -
        $tz = is_int($originalTz)
566 +
        $tz = \is_int($originalTz)
567 567
            ? @timezone_name_from_abbr('', (int) ($originalTz * static::MINUTES_PER_HOUR * static::SECONDS_PER_MINUTE), 1)
568 568
            : $originalTz;
569 569
@@ -665,11 +665,11 @@
Loading
665 665
            return static::rawCreateFromFormat($format, $time, $tz);
666 666
        }
667 667
668 -
        if (is_string($function) && method_exists(static::class, $function)) {
668 +
        if (\is_string($function) && method_exists(static::class, $function)) {
669 669
            $function = [static::class, $function];
670 670
        }
671 671
672 -
        return $function(...func_get_args());
672 +
        return $function(...\func_get_args());
673 673
    }
674 674
675 675
    /**
@@ -870,10 +870,10 @@
Loading
870 870
871 871
        $date = null;
872 872
873 -
        if (is_string($var)) {
873 +
        if (\is_string($var)) {
874 874
            $var = trim($var);
875 875
876 -
            if (is_string($var) &&
876 +
            if (\is_string($var) &&
877 877
                !preg_match('/^P[0-9T]/', $var) &&
878 878
                !preg_match('/^R[0-9]/', $var) &&
879 879
                preg_match('/[a-z0-9]/i', $var)

@@ -93,7 +93,7 @@
Loading
93 93
     */
94 94
    public static function __set_state($dump)
95 95
    {
96 -
        if (is_string($dump)) {
96 +
        if (\is_string($dump)) {
97 97
            return static::parse($dump);
98 98
        }
99 99
@@ -150,9 +150,9 @@
Loading
150 150
    {
151 151
        $serializer = $this->localSerializer ?? static::$serializer;
152 152
        if ($serializer) {
153 -
            return is_string($serializer)
153 +
            return \is_string($serializer)
154 154
                ? $this->rawFormat($serializer)
155 -
                : call_user_func($serializer, $this);
155 +
                : \call_user_func($serializer, $this);
156 156
        }
157 157
158 158
        return $this->toJSON();
Files Complexity Coverage
src/Carbon 2,062 100.00%
Project Totals (885 files) 2062 100.00%
4946.15
7.3=.3
TRAVIS_OS_NAME=linux

No yaml found.

Create your codecov.yml to customize your Codecov experience

Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading