for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php declare(strict_types=1);
namespace Stratadox\Hydration\Mapping\Transform;
use RuntimeException;
use Stratadox\HydrationMapping\MappingFailure;
use function gettype;
use function sprintf;
final class JsonTransformationFailure extends RuntimeException implements MappingFailure
{
public static function detected(
string $error,
string $key,
string $name
): MappingFailure {
return new self(sprintf(
'Error in transforming the json from key `%s` for in the property `%s`: %s',
$key,
$name,
$error
));
}
public static function cannotBeScalar(
$value,
): self {
'Unexpected %s while transforming the json from key `%s` for in ' .
'the property `%s`: expecting an array',
gettype($value),
$name