Skip to content

Commit e2bb990

Browse files
committed
Merge branch '4.4' into 5.1
* 4.4: Bump license year [Form] fix passing null $pattern to IntlDateFormatter Update README.md
2 parents c9843f6 + 3e124cc commit e2bb990

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

DateFormatter/IntlDateFormatter.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,10 @@ public function __construct(?string $locale, ?int $datetype, ?int $timetype, $ti
145145
$this->datetype = null !== $datetype ? $datetype : self::FULL;
146146
$this->timetype = null !== $timetype ? $timetype : self::FULL;
147147

148+
if ('' === ($pattern ?? '')) {
149+
$pattern = $this->getDefaultPattern();
150+
}
151+
148152
$this->setPattern($pattern);
149153
$this->setTimeZone($timezone);
150154
}
@@ -484,7 +488,7 @@ public function setLenient(bool $lenient)
484488
/**
485489
* Set the formatter's pattern.
486490
*
487-
* @param string|null $pattern A pattern string in conformance with the ICU IntlDateFormatter documentation
491+
* @param string $pattern A pattern string in conformance with the ICU IntlDateFormatter documentation
488492
*
489493
* @return bool true on success or false on failure
490494
*
@@ -493,11 +497,7 @@ public function setLenient(bool $lenient)
493497
*/
494498
public function setPattern(?string $pattern)
495499
{
496-
if (null === $pattern) {
497-
$pattern = $this->getDefaultPattern();
498-
}
499-
500-
$this->pattern = $pattern;
500+
$this->pattern = (string) $pattern;
501501

502502
return true;
503503
}

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2004-2020 Fabien Potencier
1+
Copyright (c) 2004-2021 Fabien Potencier
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy
44
of this software and associated documentation files (the "Software"), to deal

0 commit comments

Comments
 (0)