<?php
use Chubbyphp\Validation\Constraint\ValidConstraint;
use Chubbyphp\Validation\ValidatorContextInterface;
use Chubbyphp\Validation\ValidatorInterface;
$constraint = new ValidConstraint();
/** @var ValidatorContextInterface $context */
$context = ...;
/** @var ValidatorInterface $validator */
$validator = ...;
$model = new class()
{
/**
* @var string
*/
private $name;
};
$errors = $constraint->validate(
'path.to.property',
[$model],
$context,
$validator
);
// [
// new Error(
// "path.to.property[0]['name']",
// 'constraint.notnull.null'
// )
// ];
This repository has been archived by the owner on Jul 6, 2024. It is now read-only.