composer update
This commit is contained in:
3
vendor/nesbot/carbon/composer.json
vendored
3
vendor/nesbot/carbon/composer.json
vendored
@@ -49,6 +49,9 @@
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"files": [
|
||||
"tests/Laravel/ServiceProvider.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"Tests\\": "tests/"
|
||||
}
|
||||
|
||||
2
vendor/nesbot/carbon/readme.md
vendored
2
vendor/nesbot/carbon/readme.md
vendored
@@ -2,7 +2,7 @@
|
||||
|
||||
[](https://packagist.org/packages/nesbot/carbon)
|
||||
[](https://packagist.org/packages/nesbot/carbon)
|
||||
[](https://travis-ci.org/briannesbitt/Carbon)
|
||||
[](https://actions-badge.atrox.dev/briannesbitt/Carbon/goto)
|
||||
[](https://github.styleci.io/repos/5724990)
|
||||
[](https://codecov.io/github/briannesbitt/Carbon?branch=master)
|
||||
[](https://github.com/phpstan/phpstan)
|
||||
|
||||
@@ -583,7 +583,13 @@ class CarbonInterval extends DateInterval implements CarbonConverterInterface
|
||||
$interval = new static(0);
|
||||
$localStrictModeEnabled = $interval->localStrictModeEnabled;
|
||||
$interval->localStrictModeEnabled = true;
|
||||
$result = $interval->$method(...$parameters);
|
||||
|
||||
$result = static::hasMacro($method)
|
||||
? static::bindMacroContext(null, function () use (&$method, &$parameters, &$interval) {
|
||||
return $interval->callMacro($method, $parameters);
|
||||
})
|
||||
: $interval->$method(...$parameters);
|
||||
|
||||
$interval->localStrictModeEnabled = $localStrictModeEnabled;
|
||||
|
||||
return $result;
|
||||
@@ -596,6 +602,16 @@ class CarbonInterval extends DateInterval implements CarbonConverterInterface
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the current context from inside a macro callee or a new one if static.
|
||||
*
|
||||
* @return static
|
||||
*/
|
||||
protected static function this()
|
||||
{
|
||||
return end(static::$macroContextStack) ?: new static(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a CarbonInterval from string.
|
||||
*
|
||||
@@ -811,7 +827,7 @@ class CarbonInterval extends DateInterval implements CarbonConverterInterface
|
||||
}
|
||||
|
||||
if ($interval instanceof self && is_a($className, self::class, true)) {
|
||||
$instance->setStep($interval->getStep());
|
||||
static::copyStep($interval, $instance);
|
||||
}
|
||||
|
||||
static::copyNegativeUnits($interval, $instance);
|
||||
@@ -819,7 +835,7 @@ class CarbonInterval extends DateInterval implements CarbonConverterInterface
|
||||
return $instance;
|
||||
}
|
||||
|
||||
private static function copyNegativeUnits(DateInterval $from, DateInterval $to)
|
||||
private static function copyNegativeUnits(DateInterval $from, DateInterval $to): void
|
||||
{
|
||||
$to->invert = $from->invert;
|
||||
|
||||
@@ -830,6 +846,11 @@ class CarbonInterval extends DateInterval implements CarbonConverterInterface
|
||||
}
|
||||
}
|
||||
|
||||
private static function copyStep(self $from, self $to): void
|
||||
{
|
||||
$to->setStep($from->getStep());
|
||||
}
|
||||
|
||||
/**
|
||||
* Cast the current instance into the given class.
|
||||
*
|
||||
@@ -1228,10 +1249,10 @@ class CarbonInterval extends DateInterval implements CarbonConverterInterface
|
||||
if ($macro instanceof Closure) {
|
||||
$boundMacro = @$macro->bindTo($this, static::class) ?: @$macro->bindTo(null, static::class);
|
||||
|
||||
return \call_user_func_array($boundMacro ?: $macro, $parameters);
|
||||
return ($boundMacro ?: $macro)(...$parameters);
|
||||
}
|
||||
|
||||
return \call_user_func_array($macro, $parameters);
|
||||
return $macro(...$parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
54
vendor/nesbot/carbon/src/Carbon/CarbonPeriod.php
vendored
54
vendor/nesbot/carbon/src/Carbon/CarbonPeriod.php
vendored
@@ -174,43 +174,43 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const RECURRENCES_FILTER = 'Carbon\CarbonPeriod::filterRecurrences';
|
||||
const END_DATE_FILTER = 'Carbon\CarbonPeriod::filterEndDate';
|
||||
public const RECURRENCES_FILTER = [self::class, 'filterRecurrences'];
|
||||
public const END_DATE_FILTER = [self::class, 'filterEndDate'];
|
||||
|
||||
/**
|
||||
* Special value which can be returned by filters to end iteration. Also a filter.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const END_ITERATION = 'Carbon\CarbonPeriod::endIteration';
|
||||
public const END_ITERATION = [self::class, 'endIteration'];
|
||||
|
||||
/**
|
||||
* Exclude start date from iteration.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
const EXCLUDE_START_DATE = 1;
|
||||
public const EXCLUDE_START_DATE = 1;
|
||||
|
||||
/**
|
||||
* Exclude end date from iteration.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
const EXCLUDE_END_DATE = 2;
|
||||
public const EXCLUDE_END_DATE = 2;
|
||||
|
||||
/**
|
||||
* Yield CarbonImmutable instances.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
const IMMUTABLE = 4;
|
||||
public const IMMUTABLE = 4;
|
||||
|
||||
/**
|
||||
* Number of maximum attempts before giving up on finding next valid date.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
const NEXT_MAX_ATTEMPTS = 1000;
|
||||
public const NEXT_MAX_ATTEMPTS = 1000;
|
||||
|
||||
/**
|
||||
* The registered macros.
|
||||
@@ -583,7 +583,15 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable
|
||||
*/
|
||||
public static function __callStatic($method, $parameters)
|
||||
{
|
||||
return (new static)->$method(...$parameters);
|
||||
$date = new static();
|
||||
|
||||
if (static::hasMacro($method)) {
|
||||
return static::bindMacroContext(null, function () use (&$method, &$parameters, &$date) {
|
||||
return $date->callMacro($method, $parameters);
|
||||
});
|
||||
}
|
||||
|
||||
return $date->$method(...$parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1212,7 +1220,7 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable
|
||||
*/
|
||||
public function setStartDate($date, $inclusive = null)
|
||||
{
|
||||
if (!$date = \call_user_func([$this->dateClass, 'make'], $date)) {
|
||||
if (!$date = ([$this->dateClass, 'make'])($date)) {
|
||||
throw new InvalidPeriodDateException('Invalid start date.');
|
||||
}
|
||||
|
||||
@@ -1237,7 +1245,7 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable
|
||||
*/
|
||||
public function setEndDate($date, $inclusive = null)
|
||||
{
|
||||
if (!\is_null($date) && !$date = \call_user_func([$this->dateClass, 'make'], $date)) {
|
||||
if (!\is_null($date) && !$date = ([$this->dateClass, 'make'])($date)) {
|
||||
throw new InvalidPeriodDateException('Invalid end date.');
|
||||
}
|
||||
|
||||
@@ -1330,7 +1338,7 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable
|
||||
public function rewind()
|
||||
{
|
||||
$this->key = 0;
|
||||
$this->current = \call_user_func([$this->dateClass, 'make'], $this->startDate);
|
||||
$this->current = ([$this->dateClass, 'make'])($this->startDate);
|
||||
$settings = $this->getSettings();
|
||||
|
||||
if ($this->hasLocalTranslator()) {
|
||||
@@ -1398,7 +1406,7 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable
|
||||
*/
|
||||
public function toString()
|
||||
{
|
||||
$translator = \call_user_func([$this->dateClass, 'getTranslator']);
|
||||
$translator = ([$this->dateClass, 'getTranslator'])();
|
||||
|
||||
$parts = [];
|
||||
|
||||
@@ -1490,11 +1498,7 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable
|
||||
|
||||
$result = iterator_to_array($this);
|
||||
|
||||
[
|
||||
$this->key,
|
||||
$this->current,
|
||||
$this->validationResult
|
||||
] = $state;
|
||||
[$this->key, $this->current, $this->validationResult] = $state;
|
||||
|
||||
return $result;
|
||||
}
|
||||
@@ -1637,9 +1641,10 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable
|
||||
case 'minute':
|
||||
case 'seconds':
|
||||
case 'second':
|
||||
return $this->setDateInterval(\call_user_func(
|
||||
return $this->setDateInterval((
|
||||
// Override default P1D when instantiating via fluent setters.
|
||||
[$this->isDefaultInterval ? new CarbonInterval('PT0S') : $this->dateInterval, $method],
|
||||
[$this->isDefaultInterval ? new CarbonInterval('PT0S') : $this->dateInterval, $method]
|
||||
)(
|
||||
\count($parameters) === 0 ? 1 : $first
|
||||
));
|
||||
}
|
||||
@@ -2173,7 +2178,7 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable
|
||||
}
|
||||
|
||||
return [function ($date) use ($method, $parameters) {
|
||||
return \call_user_func_array([$date, $method], $parameters);
|
||||
return ([$date, $method])(...$parameters);
|
||||
}, $method];
|
||||
}
|
||||
|
||||
@@ -2187,7 +2192,8 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable
|
||||
*/
|
||||
protected function isCarbonPredicateMethod($callable)
|
||||
{
|
||||
return \is_string($callable) && substr($callable, 0, 2) === 'is' && (method_exists($this->dateClass, $callable) || \call_user_func([$this->dateClass, 'hasMacro'], $callable));
|
||||
return \is_string($callable) && substr($callable, 0, 2) === 'is' &&
|
||||
(method_exists($this->dateClass, $callable) || ([$this->dateClass, 'hasMacro'])($callable));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2313,7 +2319,7 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable
|
||||
*/
|
||||
protected function prepareForReturn(CarbonInterface $date)
|
||||
{
|
||||
$date = \call_user_func([$this->dateClass, 'make'], $date);
|
||||
$date = ([$this->dateClass, 'make'])($date);
|
||||
|
||||
if ($this->timezone) {
|
||||
$date = $date->setTimezone($this->timezone);
|
||||
@@ -2359,10 +2365,10 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable
|
||||
if ($macro instanceof Closure) {
|
||||
$boundMacro = @$macro->bindTo($this, static::class) ?: @$macro->bindTo(null, static::class);
|
||||
|
||||
return \call_user_func_array($boundMacro ?: $macro, $parameters);
|
||||
return ($boundMacro ?: $macro)(...$parameters);
|
||||
}
|
||||
|
||||
return \call_user_func_array($macro, $parameters);
|
||||
return $macro(...$parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace Carbon\Cli;
|
||||
|
||||
class Invoker
|
||||
{
|
||||
const CLI_CLASS_NAME = 'Carbon\\Cli';
|
||||
public const CLI_CLASS_NAME = 'Carbon\\Cli';
|
||||
|
||||
protected function runWithCli(string $className, array $parameters): bool
|
||||
{
|
||||
|
||||
@@ -35,7 +35,7 @@ trait CarbonTypeConverter
|
||||
return preg_replace('/\(\d+\)/', "($precision)", $type);
|
||||
}
|
||||
|
||||
list($before, $after) = explode(' ', "$type ");
|
||||
[$before, $after] = explode(' ', "$type ");
|
||||
|
||||
return trim("$before($precision) $after");
|
||||
}
|
||||
|
||||
@@ -2295,10 +2295,10 @@ trait Date
|
||||
if ($macro instanceof Closure) {
|
||||
$boundMacro = @Closure::bind($macro, null, static::class);
|
||||
|
||||
return \call_user_func_array($boundMacro ?: $macro, $parameters);
|
||||
return ($boundMacro ?: $macro)(...$parameters);
|
||||
}
|
||||
|
||||
return \call_user_func_array($macro, $parameters);
|
||||
return $macro(...$parameters);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2412,10 +2412,10 @@ trait Date
|
||||
if ($macro instanceof Closure) {
|
||||
$boundMacro = @$macro->bindTo($this, static::class) ?: @$macro->bindTo(null, static::class);
|
||||
|
||||
return \call_user_func_array($boundMacro ?: $macro, $parameters);
|
||||
return ($boundMacro ?: $macro)(...$parameters);
|
||||
}
|
||||
|
||||
return \call_user_func_array($macro, $parameters);
|
||||
return $macro(...$parameters);
|
||||
}
|
||||
|
||||
protected function executeCallableWithContext($macro, ...$parameters)
|
||||
|
||||
@@ -495,8 +495,15 @@ trait Difference
|
||||
public function floatDiffInDays($date = null, $absolute = true)
|
||||
{
|
||||
$hoursDiff = $this->floatDiffInHours($date, $absolute);
|
||||
$interval = $this->diff($date, $absolute);
|
||||
|
||||
return ($hoursDiff < 0 ? -1 : 1) * $this->diffInDays($date) + fmod($hoursDiff, static::HOURS_PER_DAY) / static::HOURS_PER_DAY;
|
||||
if ($interval->y === 0 && $interval->m === 0 && $interval->d === 0) {
|
||||
return $hoursDiff / static::HOURS_PER_DAY;
|
||||
}
|
||||
|
||||
$daysDiff = (int) $interval->format('%r%a');
|
||||
|
||||
return $daysDiff + fmod($hoursDiff, static::HOURS_PER_DAY) / static::HOURS_PER_DAY;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -535,7 +535,7 @@ trait Localization
|
||||
public static function executeWithLocale($locale, $func)
|
||||
{
|
||||
$currentLocale = static::getLocale();
|
||||
$result = \call_user_func($func, static::setLocale($locale) ? static::getLocale() : false, static::translator());
|
||||
$result = $func(static::setLocale($locale) ? static::getLocale() : false, static::translator());
|
||||
static::setLocale($currentLocale);
|
||||
|
||||
return $result;
|
||||
|
||||
10
vendor/nesbot/carbon/src/Carbon/Traits/Mixin.php
vendored
10
vendor/nesbot/carbon/src/Carbon/Traits/Mixin.php
vendored
@@ -164,6 +164,16 @@ trait Mixin
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the current context from inside a macro callee or a null if static.
|
||||
*
|
||||
* @return static|null
|
||||
*/
|
||||
protected static function context()
|
||||
{
|
||||
return end(static::$macroContextStack) ?: null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the current context from inside a macro callee or a new one if static.
|
||||
*
|
||||
|
||||
@@ -92,7 +92,9 @@ trait Rounding
|
||||
$factor /= $delta;
|
||||
$fraction *= $delta;
|
||||
$arguments[0] += $this->$unit * $factor;
|
||||
$changes[$unit] = round($minimum + ($fraction ? $fraction * \call_user_func($function, ($this->$unit - $minimum) / $fraction) : 0));
|
||||
$changes[$unit] = round(
|
||||
$minimum + ($fraction ? $fraction * $function(($this->$unit - $minimum) / $fraction) : 0)
|
||||
);
|
||||
|
||||
// Cannot use modulo as it lose double precision
|
||||
while ($changes[$unit] >= $delta) {
|
||||
@@ -105,7 +107,9 @@ trait Rounding
|
||||
|
||||
[$value, $minimum] = $arguments;
|
||||
/** @var CarbonInterface $result */
|
||||
$result = $this->$normalizedUnit(floor(\call_user_func($function, ($value - $minimum) / $precision) * $precision + $minimum));
|
||||
$result = $this->$normalizedUnit(
|
||||
floor($function(($value - $minimum) / $precision) * $precision + $minimum)
|
||||
);
|
||||
|
||||
foreach ($changes as $unit => $value) {
|
||||
$result = $result->$unit($value);
|
||||
|
||||
@@ -149,10 +149,11 @@ trait Serialization
|
||||
public function jsonSerialize()
|
||||
{
|
||||
$serializer = $this->localSerializer ?? static::$serializer;
|
||||
|
||||
if ($serializer) {
|
||||
return \is_string($serializer)
|
||||
? $this->rawFormat($serializer)
|
||||
: \call_user_func($serializer, $this);
|
||||
: $serializer($this);
|
||||
}
|
||||
|
||||
return $this->toJSON();
|
||||
|
||||
Reference in New Issue
Block a user