Page MenuHomeCode

No OneTemporary

diff --git a/Engines/Templates/Smarty/Plugins/modifier.romanize.php b/Engines/Templates/Smarty/Plugins/modifier.romanize.php
index 4fa5f0b..a9f00a1 100644
--- a/Engines/Templates/Smarty/Plugins/modifier.romanize.php
+++ b/Engines/Templates/Smarty/Plugins/modifier.romanize.php
@@ -1,28 +1,34 @@
<?php
+declare(strict_types=1);
+
/**
* Smarty plugin
*
* @package Smarty
* @subpackage PluginsModifier
*/
use Keruald\OmniTools\Culture\Rome\RomanNumerals;
/**
* Smarty romanize modifier plugin
*
* Type: modifier<br>
* Name: romanize<br>
* Purpose: prints a number in roman
*
* @param int $
* @return string
*/
function smarty_modifier_romanize ($number) : string {
+ if (!is_numeric($number)) {
+ return (string)$number;
+ }
+
try {
- return RomanNumerals::fromHinduArabic($number);
- } catch (Throwable $ex) {
+ return RomanNumerals::fromHinduArabic((int)$number);
+ } catch (InvalidArgumentException $ex) {
// Not a strictly positive integer, don't modify
- return $number;
+ return (string)$number;
}
}

File Metadata

Mime Type
text/x-diff
Expires
Mon, Nov 11, 11:14 (2 w, 3 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
20891
Default Alt Text
(1 KB)

Event Timeline