Author: Andreas Möller (localheinz)
Committer: GitHub (web-flow)
Pusher: cmb69
Date: 2022-09-16T13:51:25+02:00

Commit: 
https://github.com/php/web-php/commit/11c5706c3971f97de26eaaa900345dd0b892bc16
Raw diff: 
https://github.com/php/web-php/commit/11c5706c3971f97de26eaaa900345dd0b892bc16.diff

Enhancement: Enable `random_api_migration` fixer

Co-authored-by: Mathias Reker <math...@reker.dk>

Closes GH-699.

Changed paths:
  M  .php-cs-fixer.php
  M  download-logos.php
  M  manual/spam_challenge.php


Diff:

diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php
index 22a9275ef..7376e5cbc 100644
--- a/.php-cs-fixer.php
+++ b/.php-cs-fixer.php
@@ -35,6 +35,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,
diff --git a/download-logos.php b/download-logos.php
index c28f55f83..f04433663 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 1a42d3ac8..c19bbbe90 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)];

-- 
PHP Webmaster List Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to