Skip to content

Commit 5d17de5

Browse files
committed
[Intl] Fixed version comparisons in the transformation rules
1 parent 470927d commit 5d17de5

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

src/Symfony/Component/Intl/ResourceBundle/Transformer/Rule/CurrencyBundleTransformationRule.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Symfony\Component\Intl\ResourceBundle\CurrencyBundle;
1616
use Symfony\Component\Intl\ResourceBundle\Transformer\CompilationContextInterface;
1717
use Symfony\Component\Intl\ResourceBundle\Transformer\StubbingContextInterface;
18+
use Symfony\Component\Intl\Util\IcuVersion;
1819

1920
/**
2021
* The rule for compiling the currency bundle.
@@ -38,7 +39,7 @@ public function beforeCompile(CompilationContextInterface $context)
3839
{
3940
// The currency data is contained in the locales and misc bundles
4041
// in ICU <= 4.2
41-
if (version_compare($context->getIcuVersion(), '4.2', '<=')) {
42+
if (IcuVersion::compare($context->getIcuVersion(), '4.2', '<=', 1)) {
4243
return array(
4344
$context->getSourceDir() . '/misc/supplementalData.txt',
4445
$context->getSourceDir() . '/locales'

src/Symfony/Component/Intl/ResourceBundle/Transformer/Rule/LanguageBundleTransformationRule.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Symfony\Component\Intl\Intl;
1515
use Symfony\Component\Intl\ResourceBundle\Transformer\CompilationContextInterface;
1616
use Symfony\Component\Intl\ResourceBundle\Transformer\StubbingContextInterface;
17+
use Symfony\Component\Intl\Util\IcuVersion;
1718

1819
/**
1920
* The rule for compiling the language bundle.
@@ -36,7 +37,7 @@ public function getBundleName()
3637
public function beforeCompile(CompilationContextInterface $context)
3738
{
3839
// The language data is contained in the locales bundle in ICU <= 4.2
39-
if (version_compare($context->getIcuVersion(), '4.2', '<=')) {
40+
if (IcuVersion::compare($context->getIcuVersion(), '4.2', '<=', 1)) {
4041
return $context->getSourceDir() . '/locales';
4142
}
4243

src/Symfony/Component/Intl/ResourceBundle/Transformer/Rule/RegionBundleTransformationRule.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Symfony\Component\Intl\Intl;
1515
use Symfony\Component\Intl\ResourceBundle\Transformer\CompilationContextInterface;
1616
use Symfony\Component\Intl\ResourceBundle\Transformer\StubbingContextInterface;
17+
use Symfony\Component\Intl\Util\IcuVersion;
1718

1819
/**
1920
* The rule for compiling the region bundle.
@@ -36,7 +37,7 @@ public function getBundleName()
3637
public function beforeCompile(CompilationContextInterface $context)
3738
{
3839
// The region data is contained in the locales bundle in ICU <= 4.2
39-
if (version_compare($context->getIcuVersion(), '4.2', '<=')) {
40+
if (IcuVersion::compare($context->getIcuVersion(), '4.2', '<=', 1)) {
4041
return $context->getSourceDir() . '/locales';
4142
}
4243

0 commit comments

Comments
 (0)