sebastianbergmann / phpunit-mock-objects

Mock Object library for PHPUnit
https://phpunit.de/
Other
4.97k stars 153 forks source link

TypeError: md5() expects parameter 1 to be string, integer given #374

Closed kevindh89 closed 7 years ago

kevindh89 commented 7 years ago

I'm using PHP 7.1.5 with strict_types enabled. With this setup, I get a TypeError when I try to create Mock objects with the MockBuilder.

After some searching I found this change: https://github.com/sebastianbergmann/phpunit-mock-objects/commit/a23b761686d50a560cc56233b9ecf49597cc9118

The PHP documentation states that mt_rand returns an int and microtime returns mixed while md5 expects a string.

I'm not sure what the solution for this issue should be. When there are good suggestions, I might fix it myself. For now I'll use an earlier version that doesn't contain the change to mt_rand.

sebastianbergmann commented 7 years ago

Thank you for your report.

Please provide a minimal, self-contained, reproducing test case that shows the problem you are reporting.

Without such a minimal, self-contained, reproducing test case I will not be able to investigate this issue.

kevindh89 commented 7 years ago

I'm sorry, I just found out that it was caused by a configuration in my IDE that automatically added declare(strict_types=1) to the files of the phpunit-mock-objects project.

I'll close the issue.