提交的内容

This commit is contained in:
2025-05-12 15:45:02 +08:00
parent 629c4750da
commit b48c692775
3043 changed files with 34732 additions and 60810 deletions

0
vendor/dragonmantank/cron-expression/src/Cron/AbstractField.php vendored Executable file → Normal file
View File

27
vendor/dragonmantank/cron-expression/src/Cron/CronExpression.php vendored Executable file → Normal file
View File

@ -12,7 +12,6 @@ use Exception;
use InvalidArgumentException;
use LogicException;
use RuntimeException;
use Webmozart\Assert\Assert;
/**
* CRON expression parser that can determine whether or not a CRON expression is
@ -148,7 +147,7 @@ class CronExpression
/**
* @deprecated since version 3.0.2, use __construct instead.
*/
public static function factory(string $expression, FieldFactoryInterface $fieldFactory = null): CronExpression
public static function factory(string $expression, ?FieldFactoryInterface $fieldFactory = null): CronExpression
{
/** @phpstan-ignore-next-line */
return new static($expression, $fieldFactory);
@ -179,7 +178,7 @@ class CronExpression
* @param null|FieldFactoryInterface $fieldFactory Factory to create cron fields
* @throws InvalidArgumentException
*/
public function __construct(string $expression, FieldFactoryInterface $fieldFactory = null)
public function __construct(string $expression, ?FieldFactoryInterface $fieldFactory = null)
{
$shortcut = strtolower($expression);
$expression = self::$registeredAliases[$shortcut] ?? $expression;
@ -200,7 +199,12 @@ class CronExpression
public function setExpression(string $value): CronExpression
{
$split = preg_split('/\s/', $value, -1, PREG_SPLIT_NO_EMPTY);
Assert::isArray($split);
if (!\is_array($split)) {
throw new InvalidArgumentException(
$value . ' is not a valid CRON expression'
);
}
$notEnoughParts = \count($split) < 5;
@ -334,7 +338,10 @@ class CronExpression
$currentTime = new DateTime($currentTime);
}
Assert::isInstanceOf($currentTime, DateTime::class);
if (!$currentTime instanceof DateTime) {
throw new InvalidArgumentException('invalid current time');
}
$currentTime->setTimezone(new DateTimeZone($timeZone));
$matches = [];
@ -420,7 +427,10 @@ class CronExpression
$currentTime = new DateTime($currentTime);
}
Assert::isInstanceOf($currentTime, DateTime::class);
if (!$currentTime instanceof DateTime) {
throw new InvalidArgumentException('invalid current time');
}
$currentTime->setTimezone(new DateTimeZone($timeZone));
// drop the seconds to 0
@ -462,7 +472,10 @@ class CronExpression
$currentDate = new DateTime('now');
}
Assert::isInstanceOf($currentDate, DateTime::class);
if (!$currentDate instanceof DateTime) {
throw new InvalidArgumentException('invalid current date');
}
$currentDate->setTimezone(new DateTimeZone($timeZone));
// Workaround for setTime causing an offset change: https://bugs.php.net/bug.php?id=81074
$currentDate = DateTime::createFromFormat("!Y-m-d H:iO", $currentDate->format("Y-m-d H:iP"), $currentDate->getTimezone());

0
vendor/dragonmantank/cron-expression/src/Cron/DayOfMonthField.php vendored Executable file → Normal file
View File

0
vendor/dragonmantank/cron-expression/src/Cron/DayOfWeekField.php vendored Executable file → Normal file
View File

0
vendor/dragonmantank/cron-expression/src/Cron/FieldFactory.php vendored Executable file → Normal file
View File

View File

0
vendor/dragonmantank/cron-expression/src/Cron/FieldInterface.php vendored Executable file → Normal file
View File

0
vendor/dragonmantank/cron-expression/src/Cron/HoursField.php vendored Executable file → Normal file
View File

0
vendor/dragonmantank/cron-expression/src/Cron/MinutesField.php vendored Executable file → Normal file
View File

0
vendor/dragonmantank/cron-expression/src/Cron/MonthField.php vendored Executable file → Normal file
View File