for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace League\HTMLToMarkdown;
/**
* @internal
*/
final class Coerce
{
private function __construct()
}
* @param mixed $val
public static function toString($val): string
switch (true) {
case \is_string($val):
is_string
If this is a false-positive, you can also ignore this issue in your code via the ignore-call annotation
ignore-call
case /** @scrutinizer ignore-call */ \is_string($val):
return $val;
case \is_bool($val):
is_bool
case /** @scrutinizer ignore-call */ \is_bool($val):
case \is_float($val):
is_float
case /** @scrutinizer ignore-call */ \is_float($val):
case \is_int($val):
is_int
case /** @scrutinizer ignore-call */ \is_int($val):
case \is_null($val):
is_null
case /** @scrutinizer ignore-call */ \is_null($val):
return \strval($val);
strval
return /** @scrutinizer ignore-call */ \strval($val);
case \is_object($val) && \method_exists($val, '__toString'):
is_object
case /** @scrutinizer ignore-call */ \is_object($val) && \method_exists($val, '__toString'):
return $val->__toString();
default:
throw new \InvalidArgumentException('Cannot coerce this value to string');