We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e13f929 commit edc9939Copy full SHA for edc9939
src/Framework/Constraint/Constraint.php
@@ -9,7 +9,9 @@
9
*/
10
namespace PHPUnit\Framework\Constraint;
11
12
+use function assert;
13
use function gettype;
14
+use function is_int;
15
use function is_object;
16
use function sprintf;
17
use function str_replace;
@@ -246,7 +248,12 @@ protected function valueToTypeStringFragment(mixed $value): string
246
248
247
249
if ($reflector->isAnonymous()) {
250
$name = str_replace('class@anonymous', '', $reflector->getName());
- $name = substr($name, 0, strpos($name, '$'));
251
+
252
+ $length = strpos($name, '$');
253
254
+ assert(is_int($length));
255
256
+ $name = substr($name, 0, $length);
257
258
return 'an instance of anonymous class created at ' . $name . ' ';
259
}
0 commit comments