for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types = 1);
/**
* /src/Exception/models/ValidatorError.php
*
* @author TLe, Tarmo Leppänen <[email protected]>
*/
namespace App\Exception\models;
use Stringable;
use Symfony\Component\Validator\ConstraintViolationInterface;
use function str_replace;
* Class ValidatorError
* @package App\Exception\models
class ValidatorError
{
public string | Stringable $message;
public string $propertyPath;
public string $target;
public string | null $code;
public function __construct(ConstraintViolationInterface $error, string $target)
$this->message = $error->getMessage();
$this->propertyPath = $error->getPropertyPath();
$this->target = str_replace('\\', '.', $target);
$this->code = $error->getCode();
}