for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types = 1);
/**
* /src/Validator/Constraints/Timezone.php
*
* @author TLe, Tarmo Leppänen <[email protected]>
*/
namespace App\Validator\Constraints;
use Attribute;
use Symfony\Component\Validator\Constraint;
* Class Timezone
* Usage example;
* App\Validator\Constraints\Timezone()
* Just add that to your property as an annotation and you're good to go.
* @Annotation
* @Target({"PROPERTY"})
* @package App\Validator\Constraints
#[Attribute(Attribute::TARGET_PROPERTY | Attribute::IS_REPEATABLE)]
class Timezone extends Constraint
{
public const INVALID_TIMEZONE = '1f8dd2a3-5b61-43ca-a6b2-af553f86ac17';
public const MESSAGE = 'This timezone "{{ timezone }}" is not valid.';
* {@inheritdoc}
* @var array<string, string>
protected static $errorNames = [
self::INVALID_TIMEZONE => 'INVALID_TIMEZONE',
];
}