From 403ddaf0474982205fb6191864204292294c4052 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=B6ller?= Date: Sun, 11 Sep 2022 23:00:35 +0200 Subject: [PATCH 1/2] Enhancement: Enable random_api_migration fixer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Andreas Möller Co-authored-by: Mathias Reker --- .php-cs-fixer.php | 1 + 1 file changed, 1 insertion(+) diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index 42c7e609c4..a0380bc1d5 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -32,6 +32,7 @@ '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, From 5fc8e45b97237eec26b76f8062b947019d347387 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=B6ller?= Date: Sun, 11 Sep 2022 23:01:58 +0200 Subject: [PATCH 2/2] Fix: Run 'make coding-standards' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Andreas Möller Co-authored-by: Mathias Reker --- download-logos.php | 2 +- manual/spam_challenge.php | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/download-logos.php b/download-logos.php index c28f55f836..f044336630 100644 --- a/download-logos.php +++ b/download-logos.php @@ -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) . ";\""; } ?> diff --git a/manual/spam_challenge.php b/manual/spam_challenge.php index 1a42d3ac81..c19bbbe909 100644 --- a/manual/spam_challenge.php +++ b/manual/spam_challenge.php @@ -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 @@ function print_prefix($name, $a, $b) { // 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)];