diff options
| author | 2023-05-22 20:55:59 +0200 | |
|---|---|---|
| committer | 2023-05-22 20:55:59 +0200 | |
| commit | 445cc23abdda5767b622d70cf7b5eb5310dcf908 (patch) | |
| tree | d3f4d05416576da2a0cd7e45eb768f1c2f900f08 /lib/lib_date.php | |
| parent | d554d0f6736c5cf94cb2a8fa61f3b6187b86ffa2 (diff) | |
PHPStan Level 7 complete (#5406)
* PHPStan Level 7 complete
* Start PHPStan Level 8
* Forgot exclude .phtml
Diffstat (limited to 'lib/lib_date.php')
| -rw-r--r-- | lib/lib_date.php | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/lib_date.php b/lib/lib_date.php index c1b40ecf6..70c1517af 100644 --- a/lib/lib_date.php +++ b/lib/lib_date.php @@ -63,6 +63,7 @@ function _dateCeiling(string $isoDate): string { return $x[0] . 'T' . $t; } +/** @phpstan-return ($isoDate is null ? null : ($isoDate is '' ? null : string)) */ function _noDelimit(?string $isoDate): ?string { return $isoDate === null || $isoDate === '' ? null : str_replace(array('-', ':'), '', $isoDate); //FIXME: Bug with negative time zone } @@ -70,7 +71,8 @@ function _noDelimit(?string $isoDate): ?string { function _dateRelative(?string $d1, ?string $d2): ?string { if ($d2 === null) { return $d1 !== null && $d1[0] !== 'P' ? $d1 : null; - } elseif ($d2 !== '' && $d2[0] != 'P' && $d1 !== null && $d1[0] !== 'P') { + } + if ($d2 !== '' && $d2[0] != 'P' && $d1 !== null && $d1[0] !== 'P') { $y2 = substr($d2, 0, 4); if (strlen($y2) < 4 || !ctype_digit($y2)) { //Does not start by a year $d2 = _noDelimit($d2); |
