diff --git a/README.md b/README.md
index 4d0c0555..675d8910 100644
--- a/README.md
+++ b/README.md
@@ -367,13 +367,6 @@ class IndexController extends Controller
{{ $amount | money_format_currency }}
```
-### PHP templating integration
-
-```php
-format($price) ?>
-formatCurrencyAsSymbol($price->getCurrency()) ?>
-```
-
### Fetching ratio values from remote provider
```bash
@@ -613,7 +606,6 @@ Optimizations
In your config.yml, you can :
-* select the templating engine to use. By default, only Twig is loaded.
* define the decimals count after a unit (ex : 12.25€ : 2 decimals ; 11.5678€ : 4 decimals)
```yaml
diff --git a/Tests/Templating/Helper/CurrencyHelperTest.php b/Tests/Templating/Helper/CurrencyHelperTest.php
deleted file mode 100644
index c3c48855..00000000
--- a/Tests/Templating/Helper/CurrencyHelperTest.php
+++ /dev/null
@@ -1,51 +0,0 @@
-formatter = $this->createMock(MoneyFormatter::class);
- $this->helper = new CurrencyHelper($this->formatter);
- }
-
- public function testGetName(): void
- {
- $this->assertSame('tbbc_money_currency_helper', $this->helper->getName());
- }
-
- public function testName(): void
- {
- $currency = new Currency('USD');
- $this->formatter
- ->expects($this->once())
- ->method('formatCurrencyAsName')
- ->willReturn($currency->getCode());
-
- self::assertSame($currency->getCode(), $this->helper->name($currency));
- }
-
- public function testSymbol(): void
- {
- $currency = new Currency('USD');
- $this->formatter
- ->expects($this->once())
- ->method('formatCurrencyAsSymbol')
- ->willReturn('$');
-
- self::assertSame('$', $this->helper->symbol($currency));
- }
-}
diff --git a/Tests/Templating/Helper/MoneyHelperTest.php b/Tests/Templating/Helper/MoneyHelperTest.php
deleted file mode 100644
index 67ebfcc2..00000000
--- a/Tests/Templating/Helper/MoneyHelperTest.php
+++ /dev/null
@@ -1,101 +0,0 @@
-moneyFormatter = $this->createMock(MoneyFormatter::class);
- $this->pairManager = $this->createMock(PairManagerInterface::class);
- $this->helper = new MoneyHelper($this->moneyFormatter, $this->pairManager);
- }
-
- public function testFormat(): void
- {
- $money = new Money(100000, new Currency('EUR'));
- $this->moneyFormatter
- ->expects($this->once())
- ->method('formatMoney')
- ->with($money, '.', '_')
- ->willReturn('1_000.00 EUR');
- self::assertSame('1_000.00 EUR', $this->helper->format($money, '.', '_'));
- }
-
- public function testFormatAmount(): void
- {
- $money = new Money(100000, new Currency('EUR'));
- $this->moneyFormatter
- ->expects($this->once())
- ->method('formatAmount')
- ->with($money, '.', '_')
- ->willReturn('1_000.00 EUR');
- self::assertSame('1_000.00 EUR', $this->helper->formatAmount($money, '.', '_'));
- }
-
- public function testAsFloat(): void
- {
- $money = new Money(100000, new Currency('EUR'));
- $this->moneyFormatter
- ->expects($this->once())
- ->method('asFloat')
- ->with($money)
- ->willReturn(1000.00);
- self::assertSame(1000.00, $this->helper->asFloat($money));
- }
-
- public function testFormatCurrency(): void
- {
- $money = new Money(100000, new Currency('EUR'));
- $this->moneyFormatter
- ->expects($this->once())
- ->method('formatCurrency')
- ->with($money)
- ->willReturn('$');
- self::assertSame('$', $this->helper->formatCurrency($money));
- }
-
- public function testGetCurrency(): void
- {
- $money = new Money(100000, new Currency('EUR'));
- $this->moneyFormatter
- ->expects($this->once())
- ->method('getCurrency')
- ->with($money)
- ->willReturn($money->getCurrency());
- self::assertSame($money->getCurrency(), $this->helper->getCurrency($money));
- }
-
- public function testConvert(): void
- {
- $money = new Money(100000, new Currency('EUR'));
- $returnMoney = new Money(5000, new Currency('USD'));
- $currency = 'USD';
- $this->pairManager
- ->expects($this->once())
- ->method('convert')
- ->with($money, $currency)
- ->willReturn($returnMoney);
- self::assertSame($returnMoney, $this->helper->convert($money, $currency));
- }
-
- public function testName(): void
- {
- self::assertSame('tbbc_money_helper', $this->helper->getName());
- }
-}
diff --git a/change-log-5.0-and-versions.md b/change-log-5.0-and-versions.md
index 06f5ee29..36705054 100644
--- a/change-log-5.0-and-versions.md
+++ b/change-log-5.0-and-versions.md
@@ -13,6 +13,13 @@ Versions from 5.0
- Dropped support for yahoo finance provider (they don't offer this anymore)
- Dropped support for Google provider (doesn't exist anymore)
+- Drop `YahooFinanceRatioProvider` ratio provider support
+ - Remove `tbbc_money.ratio_provider.yahoo_finance.class` container parameter
+ - Remove `tbbc_money.ratio_provider.yahoo_finance` service definition
+- Drop `GoogleRatioProvider` ratio provider support
+ - Remove `tbbc_money.ratio_provider.google.class` container parameter
+ - Remove `tbbc_money.ratio_provider.google` service definition
+
**Internal Developer things**
- Added psalm level 1 (highest level)
- Added php cs fixer
diff --git a/change-log-6.0-and-versions.md b/change-log-6.0-and-versions.md
index 5b1662d7..177052d5 100644
--- a/change-log-6.0-and-versions.md
+++ b/change-log-6.0-and-versions.md
@@ -1,17 +1,11 @@
Versions from 6.0
-----------------
-### 2023-10-31 : updates for 6.0.0 version
+### TBD : updates for 6.0.0 version
**New features**
**BC breaking changes**
-
-- Drop `YahooFinanceRatioProvider` ratio provider support
- - Remove `tbbc_money.ratio_provider.yahoo_finance.class` container parameter
- - Remove `tbbc_money.ratio_provider.yahoo_finance` service definition
-- Drop `GoogleRatioProvider` ratio provider support
- - Remove `tbbc_money.ratio_provider.google.class` container parameter
- - Remove `tbbc_money.ratio_provider.google` service definition
+- Drop `symfony/templating` and template function (use twig)
**Internal Developer things**
diff --git a/composer.json b/composer.json
index efeab9c0..65b9490e 100644
--- a/composer.json
+++ b/composer.json
@@ -28,7 +28,6 @@
"symfony/console": "^5.4|^6.0|^7.0",
"symfony/dom-crawler": "^5.4|^6.0|^7.0",
"symfony/event-dispatcher": "^5.4|^6.0|^7.0",
- "symfony/templating": "^5.4|^6.0|^7.0",
"symfony/http-client": "^5.4|^6.0|^7.0"
},
"autoload": {
diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php
index 6f8e0718..bb017787 100644
--- a/src/DependencyInjection/Configuration.php
+++ b/src/DependencyInjection/Configuration.php
@@ -58,27 +58,6 @@ private function addCurrencySection(ArrayNodeDefinition $node): void
->cannotBeEmpty()
->defaultValue('tbbc_money.ratio_provider.ecb')
->end()
- ->arrayNode('templating')
- ->addDefaultsIfNotSet()
- ->children()
- ->arrayNode('engines')
- ->isRequired()
- ->requiresAtLeastOneElement()
- ->example(['twig'])
- ->beforeNormalization()
- ->ifTrue(fn ($v) => !is_array($v))
- ->then(fn ($v) => [$v])
- ->end()
- ->prototype('scalar')
- ->validate()
- ->ifNotInArray(['twig', 'php'])
- ->thenInvalid('Only "twig" and "php" engines are supported.')
- ->end()
- ->end()
- ->defaultValue(['twig'])
- ->end()
- ->end()
- ->end()
->end()
;
}
diff --git a/src/DependencyInjection/TbbcMoneyExtension.php b/src/DependencyInjection/TbbcMoneyExtension.php
index d93b691a..81a86d9c 100644
--- a/src/DependencyInjection/TbbcMoneyExtension.php
+++ b/src/DependencyInjection/TbbcMoneyExtension.php
@@ -27,14 +27,7 @@ public function load(array $configs, ContainerBuilder $container): void
$loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('services.xml');
$loader->load('form_types.xml');
-
- if (in_array('twig', $config['templating']['engines'], true)) {
- $loader->load('twig_extension.xml');
- }
-
- if (in_array('php', $config['templating']['engines'], true)) {
- $loader->load('templating_helper.xml');
- }
+ $loader->load('twig_extension.xml');
$this->remapParameters($config, $container, [
'currencies' => 'tbbc_money.currencies',
diff --git a/src/Resources/config/templating_helpers.xml b/src/Resources/config/templating_helpers.xml
deleted file mode 100644
index 70d2020a..00000000
--- a/src/Resources/config/templating_helpers.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
-
- Tbbc\MoneyBundle\Templating\Helper\MoneyHelper
- Tbbc\MoneyBundle\Templating\Helper\CurrencyHelper
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/Templating/Helper/CurrencyHelper.php b/src/Templating/Helper/CurrencyHelper.php
deleted file mode 100644
index f0aeb67f..00000000
--- a/src/Templating/Helper/CurrencyHelper.php
+++ /dev/null
@@ -1,43 +0,0 @@
-moneyFormatter->formatCurrencyAsName($currency);
- }
-
- /**
- * Returns the symbol corresponding to the given currency.
- */
- public function symbol(Currency $currency): string
- {
- return $this->moneyFormatter->formatCurrencyAsSymbol($currency);
- }
-
- public function getName(): string
- {
- return 'tbbc_money_currency_helper';
- }
-}
diff --git a/src/Templating/Helper/MoneyHelper.php b/src/Templating/Helper/MoneyHelper.php
deleted file mode 100644
index ad266693..00000000
--- a/src/Templating/Helper/MoneyHelper.php
+++ /dev/null
@@ -1,80 +0,0 @@
-moneyFormatter->formatMoney($money, $decPoint, $thousandsSep);
- }
-
- /**
- * Formats the amount part of the given Money object
- * WITHOUT INCLUDING the currency symbol.
- */
- public function formatAmount(Money $money, string $decPoint = ',', string $thousandsSep = ' '): string
- {
- return $this->moneyFormatter->formatAmount($money, $decPoint, $thousandsSep);
- }
-
- /**
- * Returns the amount for the given Money object as simple float.
- */
- public function asFloat(Money $money): float
- {
- return $this->moneyFormatter->asFloat($money);
- }
-
- /**
- * Formats only the currency part of the given Money object.
- */
- public function formatCurrency(Money $money): string
- {
- return $this->moneyFormatter->formatCurrency($money);
- }
-
- /**
- * Returns the Currency object.
- */
- public function getCurrency(Money $money): Currency
- {
- return $this->moneyFormatter->getCurrency($money);
- }
-
- /**
- * Converts the given Money object into another
- * currency and returns new Money object.
- */
- public function convert(Money $money, string $currencyCode): Money
- {
- return $this->pairManager->convert($money, $currencyCode);
- }
-
- /**
- * {@inheritDoc}
- */
- public function getName(): string
- {
- return 'tbbc_money_helper';
- }
-}