Lines 100.00% 1 / 1
Functions and Methods 100.00% 1 / 1
Classes and Traits 100.00% 1 / 1
Name Lines Functions and Methods CRAP Classes and Traits
NoOverlappingTravel 100.00% 1 / 1 100.00% 1 / 1 1 100.00% 1 / 1
 getTargets 100.00% 1 / 1 100.00% 1 / 1 1
1<?php
2
3declare(strict_types=1);
4
5namespace App\Validator;
6
7use Symfony\Component\Validator\Constraint;
8
9/**
10 * On a TimelineEvent: a travel (an event with an end date) must not share a day with another
11 * travel of its owner, so that the timeline has at most one travel at a time.
12 */
13#[\Attribute(\Attribute::TARGET_CLASS)]
14final class NoOverlappingTravel extends Constraint
15{
16    public string $message = 'Travels cannot overlap: {{ travel }}.';
17
18    public function getTargets(): string
19    {
20        return self::CLASS_CONSTRAINT;
21    }
22}