Update tests to use more strict data types instead of mixed.
All checks were successful
The build was successful.
All checks were successful
The build was successful.
This commit is contained in:
부모
174ecb2a38
커밋
8782b9c25b
@ -3,13 +3,13 @@ class Program {
|
|||||||
private function num2Roman(int $num) {
|
private function num2Roman(int $num) {
|
||||||
int $n = intval($num);
|
int $n = intval($num);
|
||||||
string $result = '';
|
string $result = '';
|
||||||
mixed $lookup = array('M' => 1000, 'CM' => 900, 'D' => 500, 'CD' => 400,
|
int[] $lookup = array('M' => 1000, 'CM' => 900, 'D' => 500, 'CD' => 400,
|
||||||
'C' => 100, 'XC' => 90, 'L' => 50, 'XL' => 40,
|
'C' => 100, 'XC' => 90, 'L' => 50, 'XL' => 40,
|
||||||
'X' => 10, 'IX' => 9, 'V' => 5, 'IV' => 4, 'I' => 1);
|
'X' => 10, 'IX' => 9, 'V' => 5, 'IV' => 4, 'I' => 1);
|
||||||
|
|
||||||
int $matches;
|
int $matches;
|
||||||
foreach($lookup as $roman => $value) {
|
foreach($lookup as $roman => $value) {
|
||||||
$matches = intval($n / $value);
|
$matches = intval($n / $value);
|
||||||
$result += str_repeat($roman, $matches);
|
$result += str_repeat($roman, $matches);
|
||||||
$n = $n % $value;
|
$n = $n % $value;
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
class Unicode {
|
class Unicode {
|
||||||
|
|
||||||
public function unicon(string $str, bool $to_uni = true) {
|
public function unicon(string $str, bool $to_uni = true) {
|
||||||
mixed $cpp;
|
string $cpp;
|
||||||
mixed $cp = array('А' => 'А', 'а' => 'а',
|
string[] $cp = array('А' => 'А', 'а' => 'а',
|
||||||
"Б" => "Б", "б" => "б",
|
"Б" => "Б", "б" => "б",
|
||||||
"В" => "В", "в" => "в",
|
"В" => "В", "в" => "в",
|
||||||
"Г" => "Г", "г" => "г",
|
"Г" => "Г", "г" => "г",
|
||||||
|
불러오는 중...
x
Reference in New Issue
Block a user