mirror of
https://github.com/php/web-php.git
synced 2026-03-23 23:02:13 +01:00
Enhancement: Enable random_api_migration fixer
Co-authored-by: Mathias Reker <mathias@reker.dk> Closes GH-699.
This commit is contained in:
@@ -35,6 +35,7 @@ $config
|
||||
'no_extra_blank_lines' => true,
|
||||
'no_trailing_whitespace' => true,
|
||||
'ordered_class_elements' => true,
|
||||
'random_api_migration' => true,
|
||||
'single_space_after_construct' => true,
|
||||
'strict_param' => true,
|
||||
'switch_case_space' => true,
|
||||
|
||||
@@ -22,7 +22,7 @@ function print_star(): void
|
||||
function random_bgcolor($min, $max): void
|
||||
{
|
||||
echo "style=\"background-color: #" .
|
||||
sprintf('%02x%02x%02x', rand($min, $max) * 51, rand($min, $max) * 51, rand($min, $max) * 51) .
|
||||
sprintf('%02x%02x%02x', mt_rand($min, $max) * 51, mt_rand($min, $max) * 51, mt_rand($min, $max) * 51) .
|
||||
";\"";
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -8,7 +8,7 @@ function plus($a, $b) {
|
||||
}
|
||||
|
||||
function gen_plus($a) {
|
||||
return rand(0, 9 - $a);
|
||||
return mt_rand(0, 9 - $a);
|
||||
}
|
||||
|
||||
function minus($a, $b) {
|
||||
@@ -16,7 +16,7 @@ function minus($a, $b) {
|
||||
}
|
||||
|
||||
function gen_minus($a) {
|
||||
return rand(0, $a);
|
||||
return mt_rand(0, $a);
|
||||
}
|
||||
|
||||
function print_infix($name, $a, $b) {
|
||||
@@ -37,11 +37,11 @@ const CHALLENGES = [
|
||||
|
||||
// generate a challenge
|
||||
function gen_challenge() {
|
||||
$c = CHALLENGES[rand(0, count(CHALLENGES) - 1)];
|
||||
$c = CHALLENGES[mt_rand(0, count(CHALLENGES) - 1)];
|
||||
|
||||
$a = rand(0, 9);
|
||||
$a = mt_rand(0, 9);
|
||||
$an = NUMS[$a];
|
||||
$b = isset($c[2]) ? $c[2]($a) : rand(0, 9);
|
||||
$b = isset($c[2]) ? $c[2]($a) : mt_rand(0, 9);
|
||||
$bn = NUMS[$b];
|
||||
|
||||
return [$c[0], $an, $bn, $c[1]($c[0], $an, $bn)];
|
||||
|
||||
Reference in New Issue
Block a user