You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: DateFormatter/DateFormat/TimezoneTransformer.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -102,7 +102,7 @@ public static function getEtcTimeZoneId($formattedTimeZone)
102
102
if (preg_match('/GMT(?P<signal>[+-])(?P<hours>\d{2}):?(?P<minutes>\d{2})/', $formattedTimeZone, $matches)) {
103
103
$hours = (int) $matches['hours'];
104
104
$minutes = (int) $matches['minutes'];
105
-
$signal = '-' == $matches['signal'] ? '+' : '-';
105
+
$signal = '-' === $matches['signal'] ? '+' : '-';
106
106
107
107
if (0 < $minutes) {
108
108
throw new NotImplementedException(sprintf('It is not possible to use a GMT time zone with minutes offset different than zero (0). GMT time zone tried: %s.', $formattedTimeZone));
* @param string $locale The locale code. The only supported locale is "en" (or null using the default locale, i.e. "en")
282
-
* @param int $style Style of the formatting, one of the format style constants.
283
-
* The only currently supported styles are NumberFormatter::DECIMAL
284
-
* and NumberFormatter::CURRENCY.
285
-
* @param string $pattern Not supported. A pattern string in case $style is NumberFormat::PATTERN_DECIMAL or
286
-
* NumberFormat::PATTERN_RULEBASED. It must conform to the syntax
287
-
* described in the ICU DecimalFormat or ICU RuleBasedNumberFormat documentation
281
+
* @param string|null $locale The locale code. The only supported locale is "en" (or null using the default locale, i.e. "en")
282
+
* @param int $style Style of the formatting, one of the format style constants.
283
+
* The only currently supported styles are NumberFormatter::DECIMAL
284
+
* and NumberFormatter::CURRENCY.
285
+
* @param string $pattern Not supported. A pattern string in case $style is NumberFormat::PATTERN_DECIMAL or
286
+
* NumberFormat::PATTERN_RULEBASED. It must conform to the syntax
287
+
* described in the ICU DecimalFormat or ICU RuleBasedNumberFormat documentation
288
288
*
289
289
* @return self
290
290
*
@@ -314,7 +314,7 @@ public static function create($locale = 'en', $style = null, $pattern = null)
314
314
*/
315
315
public function formatCurrency($value, $currency)
316
316
{
317
-
if (self::DECIMAL == $this->style) {
317
+
if (self::DECIMAL === $this->style) {
318
318
return $this->format($value);
319
319
}
320
320
@@ -353,19 +353,21 @@ public function formatCurrency($value, $currency)
353
353
*/
354
354
public function format($value, $type = self::TYPE_DEFAULT)
355
355
{
356
+
$type = (int) $type;
357
+
356
358
// The original NumberFormatter does not support this format type
357
-
if (self::TYPE_CURRENCY == $type) {
359
+
if (self::TYPE_CURRENCY === $type) {
358
360
trigger_error(__METHOD__.'(): Unsupported format type '.$type, \E_USER_WARNING);
359
361
360
362
return false;
361
363
}
362
364
363
-
if (self::CURRENCY == $this->style) {
365
+
if (self::CURRENCY === $this->style) {
364
366
throw new NotImplementedException(sprintf('%s() method does not support the formatting of currencies (instance with CURRENCY style). %s', __METHOD__, NotImplementedException::INTL_INSTALL_MESSAGE));
365
367
}
366
368
367
369
// Only the default type is supported.
368
-
if (self::TYPE_DEFAULT != $type) {
370
+
if (self::TYPE_DEFAULT !== $type) {
369
371
throw new MethodArgumentValueNotImplementedException(__METHOD__, 'type', $type, 'Only TYPE_DEFAULT is supported');
370
372
}
371
373
@@ -385,7 +387,7 @@ public function format($value, $type = self::TYPE_DEFAULT)
385
387
*
386
388
* @param int $attr An attribute specifier, one of the numeric attribute constants
387
389
*
388
-
* @return bool|int The attribute value on success or false on error
390
+
* @return int|false The attribute value on success or false on error
0 commit comments