- md5
- 48be2b16e45eae683a90ebae59a8e2d5
- sha1
- fad48e21ddc45a6c6feee4813be0581539936782
- sha256
- 6dbea90352cd60004f40092e555f059bf980fd912b3b7c6f8292d664b879c9a1
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Validator\Constraints;
use Symfony\Component\ExpressionLanguage\Expression;
use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\Exception\LogicException;
/**
* @Annotation
* @Target({"CLASS", "PROPERTY", "METHOD", "ANNOTATION"})
*/
#[\Attribute(\Attribute::TARGET_CLASS | \Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]
class When extends Composite
{
public $expression;
public $constraints = [];
public $values = [];
public function __construct(string|Expression|array $expression, array|Constraint|null $constraints = null, ?array $values = null, ?array $groups = null, $payload = null, array $options = [])
{
if (!class_exists(ExpressionLanguage::class)) {
throw new LogicException(\sprintf('The "symfony/expression-language" component is required to use the "%s" constraint. Try running "composer require symfony/expression-language".', __CLASS__));
}
if (\is_array($expression)) {
$options = array_merge($expression, $options);
} else {
$options['expression'] = $expression;
if (null !== $constraints) {
$options['constraints'] = $constraints;
}
}
if (isset($options['constraints']) && !\is_array($options['constraints'])) {
$options['constraints'] = [$options['constraints']];
}
if (null !== $groups) {
$options['groups'] = $groups;
}
if (null !== $payload) {
$options['payload'] = $payload;
}
parent::__construct($options);
$this->values = $values ?? $this->values;
}
public function getRequiredOptions(): array
{
return ['expression', 'constraints'];
}
public function getTargets(): string|array
{
return [self::CLASS_CONSTRAINT, self::PROPERTY_CONSTRAINT];
}
protected function getCompositeOption(): string
{
return 'constraints';
}
}
The same content is in 73 releases, Joomla 5.4.0-rc1 to 6.3.0-alpha1. See them all, or every version of this file.