]> Raphaƫl G. Git Repositories - packbundle/blobdiff - Util/IntlUtil.php
Strict types
[packbundle] / Util / IntlUtil.php
index 7556838f2e6f4103ac8c6b0fe0a08d93c5d3ecfe..a9096df65e6fa29732b0be830b60031f61e2d1b4 100644 (file)
@@ -16,6 +16,8 @@ use Twig\Environment;
 
 /**
  * Helps manage intl conversions
 
 /**
  * Helps manage intl conversions
+ *
+ * @TODO Makes this class strict !!!
  */
 class IntlUtil {
        /**
  */
 class IntlUtil {
        /**
@@ -28,19 +30,19 @@ class IntlUtil {
                $date = twig_date_converter($env, $date, $timezone);
 
                $formatValues = array(
                $date = twig_date_converter($env, $date, $timezone);
 
                $formatValues = array(
-                       'none' => IntlDateFormatter::NONE,
-                       'short' => IntlDateFormatter::SHORT,
-                       'medium' => IntlDateFormatter::MEDIUM,
-                       'long' => IntlDateFormatter::LONG,
-                       'full' => IntlDateFormatter::FULL,
+                       'none' => \IntlDateFormatter::NONE,
+                       'short' => \IntlDateFormatter::SHORT,
+                       'medium' => \IntlDateFormatter::MEDIUM,
+                       'long' => \IntlDateFormatter::LONG,
+                       'full' => \IntlDateFormatter::FULL,
                );
 
                );
 
-               $formatter = IntlDateFormatter::create(
+               $formatter = \IntlDateFormatter::create(
                        $locale,
                        $formatValues[$dateFormat],
                        $formatValues[$timeFormat],
                        $locale,
                        $formatValues[$dateFormat],
                        $formatValues[$timeFormat],
-                       IntlTimeZone::createTimeZone($date->getTimezone()->getName()),
-                       'gregorian' === $calendar ? IntlDateFormatter::GREGORIAN : IntlDateFormatter::TRADITIONAL,
+                       \IntlTimeZone::createTimeZone($date->getTimezone()->getName()),
+                       'gregorian' === $calendar ? \IntlDateFormatter::GREGORIAN : \IntlDateFormatter::TRADITIONAL,
                        $format
                );
 
                        $format
                );
 
@@ -79,7 +81,7 @@ class IntlUtil {
         *
         * @return NumberFormatter A NumberFormatter instance
         */
         *
         * @return NumberFormatter A NumberFormatter instance
         */
-       protected function getNumberFormatter($locale, $style): NumberFormatter {
+       protected function getNumberFormatter($locale, $style): \NumberFormatter {
                static $formatter, $currentStyle;
 
                $locale = null !== $locale ? $locale : Locale::getDefault();
                static $formatter, $currentStyle;
 
                $locale = null !== $locale ? $locale : Locale::getDefault();
@@ -91,13 +93,13 @@ class IntlUtil {
                }
 
                static $styleValues = array(
                }
 
                static $styleValues = array(
-                       'decimal' => NumberFormatter::DECIMAL,
-                       'currency' => NumberFormatter::CURRENCY,
-                       'percent' => NumberFormatter::PERCENT,
-                       'scientific' => NumberFormatter::SCIENTIFIC,
-                       'spellout' => NumberFormatter::SPELLOUT,
-                       'ordinal' => NumberFormatter::ORDINAL,
-                       'duration' => NumberFormatter::DURATION,
+                       'decimal' => \NumberFormatter::DECIMAL,
+                       'currency' => \NumberFormatter::CURRENCY,
+                       'percent' => \NumberFormatter::PERCENT,
+                       'scientific' => \NumberFormatter::SCIENTIFIC,
+                       'spellout' => \NumberFormatter::SPELLOUT,
+                       'ordinal' => \NumberFormatter::ORDINAL,
+                       'duration' => \NumberFormatter::DURATION,
                );
 
                if (!isset($styleValues[$style])) {
                );
 
                if (!isset($styleValues[$style])) {
@@ -106,7 +108,7 @@ class IntlUtil {
 
                $currentStyle = $style;
 
 
                $currentStyle = $style;
 
-               $formatter = NumberFormatter::create($locale, $styleValues[$style]);
+               $formatter = \NumberFormatter::create($locale, $styleValues[$style]);
 
                return $formatter;
        }
 
                return $formatter;
        }