Conform to stricter typing rules

This commit is contained in:
Joshua Ramon Enslin 2023-11-21 22:01:28 +01:00
parent d6c514c208
commit a33c354ad6
Signed by: jrenslin
GPG Key ID: 46016F84501B70AE

View File

@ -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) . '.-';