for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace BrenoRoosevelt\Validation;
trait GuardForValidation
{
public function validateOrFail($input, array $context = [], string $message = 'Validation errors'): void
if (! $this instanceof Validation) {
return;
}
$violations = $this->validate($input, $context);
if (!$violations->isOk()) {
throw new ValidationException($violations, $message);