upgrade to laravel 7 and set branch to v2

This commit is contained in:
2020-12-25 11:22:15 +00:00
parent 516105c492
commit 0ddd298350
4638 changed files with 132501 additions and 190226 deletions
+47 -47
View File
@@ -1,4 +1,6 @@
<?php
declare(strict_types=1);
/**
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
@@ -34,7 +36,7 @@ trait ComparisonTrait
*
* @return array
*/
public static function getWeekendDays()
public static function getWeekendDays(): array
{
return static::$weekendDays;
}
@@ -45,7 +47,7 @@ trait ComparisonTrait
* @param array $days Which days are 'weekends'.
* @return void
*/
public static function setWeekendDays($days)
public static function setWeekendDays(array $days): void
{
static::$weekendDays = $days;
}
@@ -56,7 +58,7 @@ trait ComparisonTrait
* @param \Cake\Chronos\ChronosInterface $dt The instance to compare with.
* @return bool
*/
public function eq(ChronosInterface $dt)
public function eq(ChronosInterface $dt): bool
{
return $this == $dt;
}
@@ -78,7 +80,7 @@ trait ComparisonTrait
* @param \Cake\Chronos\ChronosInterface $dt The instance to compare with.
* @return bool
*/
public function ne(ChronosInterface $dt)
public function ne(ChronosInterface $dt): bool
{
return !$this->eq($dt);
}
@@ -100,7 +102,7 @@ trait ComparisonTrait
* @param \Cake\Chronos\ChronosInterface $dt The instance to compare with.
* @return bool
*/
public function gt(ChronosInterface $dt)
public function gt(ChronosInterface $dt): bool
{
return $this > $dt;
}
@@ -122,7 +124,7 @@ trait ComparisonTrait
* @param \Cake\Chronos\ChronosInterface $dt The instance to compare with.
* @return bool
*/
public function gte(ChronosInterface $dt)
public function gte(ChronosInterface $dt): bool
{
return $this >= $dt;
}
@@ -144,7 +146,7 @@ trait ComparisonTrait
* @param \Cake\Chronos\ChronosInterface $dt The instance to compare with.
* @return bool
*/
public function lt(ChronosInterface $dt)
public function lt(ChronosInterface $dt): bool
{
return $this < $dt;
}
@@ -166,7 +168,7 @@ trait ComparisonTrait
* @param \Cake\Chronos\ChronosInterface $dt The instance to compare with.
* @return bool
*/
public function lte(ChronosInterface $dt)
public function lte(ChronosInterface $dt): bool
{
return $this <= $dt;
}
@@ -190,7 +192,7 @@ trait ComparisonTrait
* @param bool $equal Indicates if a > and < comparison should be used or <= or >=
* @return bool
*/
public function between(ChronosInterface $dt1, ChronosInterface $dt2, $equal = true)
public function between(ChronosInterface $dt1, ChronosInterface $dt2, bool $equal = true): bool
{
if ($dt1->gt($dt2)) {
$temp = $dt1;
@@ -212,7 +214,7 @@ trait ComparisonTrait
* @param \Cake\Chronos\ChronosInterface $dt2 The instance to compare with.
* @return \Cake\Chronos\ChronosInterface
*/
public function closest(ChronosInterface $dt1, ChronosInterface $dt2)
public function closest(ChronosInterface $dt1, ChronosInterface $dt2): ChronosInterface
{
return $this->diffInSeconds($dt1) < $this->diffInSeconds($dt2) ? $dt1 : $dt2;
}
@@ -224,7 +226,7 @@ trait ComparisonTrait
* @param \Cake\Chronos\ChronosInterface $dt2 The instance to compare with.
* @return \Cake\Chronos\ChronosInterface
*/
public function farthest(ChronosInterface $dt1, ChronosInterface $dt2)
public function farthest(ChronosInterface $dt1, ChronosInterface $dt2): ChronosInterface
{
return $this->diffInSeconds($dt1) > $this->diffInSeconds($dt2) ? $dt1 : $dt2;
}
@@ -235,9 +237,9 @@ trait ComparisonTrait
* @param \Cake\Chronos\ChronosInterface|null $dt The instance to compare with.
* @return \Cake\Chronos\ChronosInterface
*/
public function min(ChronosInterface $dt = null)
public function min(?ChronosInterface $dt = null): ChronosInterface
{
$dt = ($dt === null) ? static::now($this->tz) : $dt;
$dt = $dt ?? static::now($this->tz);
return $this->lt($dt) ? $this : $dt;
}
@@ -248,9 +250,9 @@ trait ComparisonTrait
* @param \Cake\Chronos\ChronosInterface|null $dt The instance to compare with.
* @return \Cake\Chronos\ChronosInterface
*/
public function max(ChronosInterface $dt = null)
public function max(?ChronosInterface $dt = null): ChronosInterface
{
$dt = ($dt === null) ? static::now($this->tz) : $dt;
$dt = $dt ?? static::now($this->tz);
return $this->gt($dt) ? $this : $dt;
}
@@ -260,7 +262,7 @@ trait ComparisonTrait
*
* @return bool
*/
public function isWeekday()
public function isWeekday(): bool
{
return !$this->isWeekend();
}
@@ -270,7 +272,7 @@ trait ComparisonTrait
*
* @return bool
*/
public function isWeekend()
public function isWeekend(): bool
{
return in_array($this->dayOfWeek, self::$weekendDays, true);
}
@@ -280,7 +282,7 @@ trait ComparisonTrait
*
* @return bool
*/
public function isYesterday()
public function isYesterday(): bool
{
return $this->toDateString() === static::yesterday($this->tz)->toDateString();
}
@@ -290,7 +292,7 @@ trait ComparisonTrait
*
* @return bool
*/
public function isToday()
public function isToday(): bool
{
return $this->toDateString() === static::now($this->tz)->toDateString();
}
@@ -300,7 +302,7 @@ trait ComparisonTrait
*
* @return bool
*/
public function isTomorrow()
public function isTomorrow(): bool
{
return $this->toDateString() === static::tomorrow($this->tz)->toDateString();
}
@@ -310,7 +312,7 @@ trait ComparisonTrait
*
* @return bool
*/
public function isNextWeek()
public function isNextWeek(): bool
{
return $this->format('W o') === static::now($this->tz)->addWeek()->format('W o');
}
@@ -320,7 +322,7 @@ trait ComparisonTrait
*
* @return bool
*/
public function isLastWeek()
public function isLastWeek(): bool
{
return $this->format('W o') === static::now($this->tz)->subWeek()->format('W o');
}
@@ -330,7 +332,7 @@ trait ComparisonTrait
*
* @return bool
*/
public function isNextMonth()
public function isNextMonth(): bool
{
return $this->format('m Y') === static::now($this->tz)->addMonth()->format('m Y');
}
@@ -340,7 +342,7 @@ trait ComparisonTrait
*
* @return bool
*/
public function isLastMonth()
public function isLastMonth(): bool
{
return $this->format('m Y') === static::now($this->tz)->subMonth()->format('m Y');
}
@@ -350,7 +352,7 @@ trait ComparisonTrait
*
* @return bool
*/
public function isNextYear()
public function isNextYear(): bool
{
return $this->year === static::now($this->tz)->addYear()->year;
}
@@ -360,7 +362,7 @@ trait ComparisonTrait
*
* @return bool
*/
public function isLastYear()
public function isLastYear(): bool
{
return $this->year === static::now($this->tz)->subYear()->year;
}
@@ -370,7 +372,7 @@ trait ComparisonTrait
*
* @return bool
*/
public function isFuture()
public function isFuture(): bool
{
return $this->gt(static::now($this->tz));
}
@@ -380,7 +382,7 @@ trait ComparisonTrait
*
* @return bool
*/
public function isPast()
public function isPast(): bool
{
return $this->lt(static::now($this->tz));
}
@@ -390,7 +392,7 @@ trait ComparisonTrait
*
* @return bool
*/
public function isLeapYear()
public function isLeapYear(): bool
{
return $this->format('L') === '1';
}
@@ -401,7 +403,7 @@ trait ComparisonTrait
* @param \Cake\Chronos\ChronosInterface $dt The instance to check against.
* @return bool
*/
public function isSameDay(ChronosInterface $dt)
public function isSameDay(ChronosInterface $dt): bool
{
return $this->toDateString() === $dt->toDateString();
}
@@ -411,7 +413,7 @@ trait ComparisonTrait
*
* @return bool
*/
public function isSunday()
public function isSunday(): bool
{
return $this->dayOfWeek === ChronosInterface::SUNDAY;
}
@@ -421,7 +423,7 @@ trait ComparisonTrait
*
* @return bool
*/
public function isMonday()
public function isMonday(): bool
{
return $this->dayOfWeek === ChronosInterface::MONDAY;
}
@@ -431,7 +433,7 @@ trait ComparisonTrait
*
* @return bool
*/
public function isTuesday()
public function isTuesday(): bool
{
return $this->dayOfWeek === ChronosInterface::TUESDAY;
}
@@ -441,7 +443,7 @@ trait ComparisonTrait
*
* @return bool
*/
public function isWednesday()
public function isWednesday(): bool
{
return $this->dayOfWeek === ChronosInterface::WEDNESDAY;
}
@@ -451,7 +453,7 @@ trait ComparisonTrait
*
* @return bool
*/
public function isThursday()
public function isThursday(): bool
{
return $this->dayOfWeek === ChronosInterface::THURSDAY;
}
@@ -461,7 +463,7 @@ trait ComparisonTrait
*
* @return bool
*/
public function isFriday()
public function isFriday(): bool
{
return $this->dayOfWeek === ChronosInterface::FRIDAY;
}
@@ -471,7 +473,7 @@ trait ComparisonTrait
*
* @return bool
*/
public function isSaturday()
public function isSaturday(): bool
{
return $this->dayOfWeek === ChronosInterface::SATURDAY;
}
@@ -481,7 +483,7 @@ trait ComparisonTrait
*
* @return bool
*/
public function isThisWeek()
public function isThisWeek(): bool
{
return static::now($this->getTimezone())->format('W o') === $this->format('W o');
}
@@ -491,7 +493,7 @@ trait ComparisonTrait
*
* @return bool
*/
public function isThisMonth()
public function isThisMonth(): bool
{
return static::now($this->getTimezone())->format('m Y') === $this->format('m Y');
}
@@ -501,7 +503,7 @@ trait ComparisonTrait
*
* @return bool
*/
public function isThisYear()
public function isThisYear(): bool
{
return static::now($this->getTimezone())->format('Y') === $this->format('Y');
}
@@ -512,11 +514,9 @@ trait ComparisonTrait
* @param \Cake\Chronos\ChronosInterface|null $dt The instance to compare with or null to use current day.
* @return bool
*/
public function isBirthday(ChronosInterface $dt = null)
public function isBirthday(?ChronosInterface $dt = null): bool
{
if ($dt === null) {
$dt = static::now($this->tz);
}
$dt = $dt ?? static::now($this->tz);
return $this->format('md') === $dt->format('md');
}
@@ -528,7 +528,7 @@ trait ComparisonTrait
* Example of valid types: 6 hours, 2 days, 1 minute.
* @return bool
*/
public function wasWithinLast($timeInterval)
public function wasWithinLast($timeInterval): bool
{
$now = new static();
$interval = $now->copy()->modify('-' . $timeInterval);
@@ -544,7 +544,7 @@ trait ComparisonTrait
* Example of valid types: 6 hours, 2 days, 1 minute.
* @return bool
*/
public function isWithinNext($timeInterval)
public function isWithinNext($timeInterval): bool
{
$now = new static();
$interval = $now->copy()->modify('+' . $timeInterval);
@@ -558,7 +558,7 @@ trait ComparisonTrait
*
* @return bool
*/
public function isMutable()
public function isMutable(): bool
{
return $this instanceof DateTime;
}