Conform to stricter typing rules
This commit is contained in:
parent
d6c514c208
commit
a33c354ad6
|
@ -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) . '.-';
|
||||
|
|
Loading…
Reference in New Issue
Block a user