From a33c354ad64befd1440e0d086a3f34e4a216891e Mon Sep 17 00:00:00 2001 From: Joshua Ramon Enslin Date: Tue, 21 Nov 2023 22:01:28 +0100 Subject: [PATCH] Conform to stricter typing rules --- src/NodaTimeSplitter.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/NodaTimeSplitter.php b/src/NodaTimeSplitter.php index 2d7151b..96019df 100644 --- a/src/NodaTimeSplitter.php +++ b/src/NodaTimeSplitter.php @@ -1098,7 +1098,7 @@ final class NodaTimeSplitter { // Hungarian year and month until month // 2005.01.-02. => 2005.01.-2005.02. - if ($inputLength === 12 && \preg_match("/^[0-9]{4}\.[0-1][0-9]\.\-[0-1][0-9]\.$/", $datum)) { + if ($inputLength === 12 && (\preg_match("/^[0-9]{4}\.[0-1][0-9]\.\-[0-1][0-9]\.$/", $datum)) !== false) { $reconstituted = substr($datum, 0, 8) . '-'; $reconstituted .= substr($datum, 0, 4) . '.' . substr($datum, -3); return $reconstituted; @@ -1107,7 +1107,7 @@ final class NodaTimeSplitter { // Hungarian year and month until month without a dot after the first YYYY-MM // 2005.01-02. => 2005.01.-2005.02. - if (in_array($inputLength, [10, 11], true) && \preg_match("/^[0-9]{4}\.[0-1][0-9]\-[0-1][0-9](\.|)$/", $datum)) { + if (in_array($inputLength, [10, 11], true) && (\preg_match("/^[0-9]{4}\.[0-1][0-9]\-[0-1][0-9](\.|)$/", $datum)) !== false) { $reconstituted = substr($datum, 0, 7) . '.-'; $reconstituted .= substr($datum, 0, 4) . '.' . substr(rtrim($datum, '.'), -2) . '.'; return $reconstituted; @@ -1116,7 +1116,7 @@ final class NodaTimeSplitter { // Hungarian year and month until month // 2005.01.01.-02.02. => 2005.01.01-2005.02.02. // 2005.01.01-02.02 => 2005.01.01-2005.02.02. - if ($inputLength >= 16 && $inputLength <= 18 && \preg_match("/^[0-9]{4}\.[0-1][0-9]\.[0-3][0-9](\.|)\-[0-1][0-9]\.[0-3][0-9](\.|)$/", $datum)) { + if ($inputLength >= 16 && $inputLength <= 18 && (\preg_match("/^[0-9]{4}\.[0-1][0-9]\.[0-3][0-9](\.|)\-[0-1][0-9]\.[0-3][0-9](\.|)$/", $datum)) !== false) { $parts = explode('-', $datum); if (count($parts) !== 2) return ''; $reconstituted = substr($datum, 0, 10) . '.-'; @@ -1125,7 +1125,7 @@ final class NodaTimeSplitter { } // Hungarian; without trailing dots: YYYY.MM.DD-DD - if ($inputLength >= 13 && $inputLength <= 15 && \preg_match("/^[0-9]{4}\.[0-1][0-9]\.[0-3][0-9](\.|)\-[0-3][0-9](\.|)$/", $datum)) { + if ($inputLength >= 13 && $inputLength <= 15 && (\preg_match("/^[0-9]{4}\.[0-1][0-9]\.[0-3][0-9](\.|)\-[0-3][0-9](\.|)$/", $datum)) !== false) { $parts = explode('-', $datum); if (count($parts) !== 2) return ''; $reconstituted = substr($datum, 0, 10) . '.-';