Cannot call method toString() on class-string|object. in HasToString.php:41
Author: pscheitCreated Jul 26, 2025Updated Jul 26, 2025
protected function featureValueOf($actual)
{
if (method_exists($actual, 'toString')) {
return $actual->toString();
}
return (string) $actual;
}This error is detected by phpstan and was written to the baseline in #88
------ -------------------------------------------------------
Line hamcrest/Hamcrest/Core/HasToString.php
------ -------------------------------------------------------
41 Cannot call method toString() on class-string|object.
method.nonObject
✏️ hamcrest/Hamcrest/Core/HasToString.php
------ -------------------------------------------------------Source: hamcrest/hamcrest-php