-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Conversation
@@ -184,7 +184,7 @@ public function seed($seed = null) | |||
if ($seed === null) { | |||
mt_srand(); | |||
} else { | |||
mt_srand($seed); | |||
mt_srand(intval($seed)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no trailing whitespace please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just use (int) $seed
. It's exactly the same, but has better performance...
Thanks @GrahamCampbell, sorry for the trailing spaces :) |
@@ -184,7 +184,7 @@ public function seed($seed = null) | |||
if ($seed === null) { | |||
mt_srand(); | |||
} else { | |||
mt_srand($seed); | |||
mt_srand((int)$seed); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be (int) $seed
.
An |
An empty one? |
Include a message explaining why you do this, something like: $this->assertTrue(true, 'seeding with a string doesn\'t throw an exception'); Unfortunately , that's all phpUnit offers us to test that (cf sebastianbergmann/phpunit-documentation#171). |
ping @fzaninotto fast merge :) |
Thanks! |
Cast
$seed
instead of checking ifnull
. This way it does not throw an error if we passed a stringified int value either.