Skip to content

Commit 46e1ab1

Browse files
authored
Merge pull request #7640 from kenjis/fix-number_to_roman
fix: number_to_roman() param type
2 parents eeaa556 + 713c1db commit 46e1ab1

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

system/Helpers/number_helper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,9 @@ function format_number(float $num, int $precision = 1, ?string $locale = null, a
173173
/**
174174
* Convert a number to a roman numeral.
175175
*
176-
* @param string $num it will convert to int
176+
* @param int|string $num it will convert to int
177177
*/
178-
function number_to_roman(string $num): ?string
178+
function number_to_roman($num): ?string
179179
{
180180
static $map = [
181181
'M' => 1000,

user_guide_src/source/helpers/number_helper.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ The following functions are available:
9292

9393
.. php:function:: number_to_roman($num)
9494
95-
:param string $num: The number want to convert
95+
:param int|string $num: The number want to convert
9696
:returns: The roman number converted from given parameter
9797
:rtype: string|null
9898

@@ -101,4 +101,4 @@ The following functions are available:
101101
.. literalinclude:: number_helper/009.php
102102

103103
This function only handles numbers in the range 1 through 3999.
104-
It will return null for any value outside that range.
104+
It will return ``null`` for any value outside that range.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
22

3-
echo number_to_roman(23); // Returns XXIII
4-
echo number_to_roman(324); // Returns CCCXXIV
3+
echo number_to_roman(23); // Returns XXIII
4+
echo number_to_roman(324); // Returns CCCXXIV
55
echo number_to_roman(2534); // Returns MMDXXXIV

0 commit comments

Comments
 (0)