*/
public function addConstraint(Constraint $constraint)
{
- if (!in_array(Constraint::CLASS_CONSTRAINT, (array) $constraint->getTargets())) {
- throw new ConstraintDefinitionException(sprintf(
- 'The constraint "%s" cannot be put on classes.',
- get_class($constraint)
- ));
+ if (!\in_array(Constraint::CLASS_CONSTRAINT, (array) $constraint->getTargets())) {
+ throw new ConstraintDefinitionException(sprintf('The constraint "%s" cannot be put on classes.', \get_class($constraint)));
}
if ($constraint instanceof Valid) {
- throw new ConstraintDefinitionException(sprintf(
- 'The constraint "%s" cannot be put on classes.',
- get_class($constraint)
- ));
+ throw new ConstraintDefinitionException(sprintf('The constraint "%s" cannot be put on classes.', \get_class($constraint)));
}
if ($constraint instanceof Traverse) {
$member = clone $member;
foreach ($member->getConstraints() as $constraint) {
- if (in_array($constraint::DEFAULT_GROUP, $constraint->groups, true)) {
+ if (\in_array($constraint::DEFAULT_GROUP, $constraint->groups, true)) {
$member->constraintsByGroup[$this->getDefaultGroup()][] = $constraint;
}
/**
* Sets the default group sequence for this class.
*
- * @param array $groupSequence An array of group names
+ * @param string[]|GroupSequence $groupSequence An array of group names
*
* @return $this
*
throw new GroupDefinitionException('Defining a static group sequence is not allowed with a group sequence provider');
}
- if (is_array($groupSequence)) {
+ if (\is_array($groupSequence)) {
$groupSequence = new GroupSequence($groupSequence);
}
- if (in_array(Constraint::DEFAULT_GROUP, $groupSequence->groups, true)) {
+ if (\in_array(Constraint::DEFAULT_GROUP, $groupSequence->groups, true)) {
throw new GroupDefinitionException(sprintf('The group "%s" is not allowed in group sequences', Constraint::DEFAULT_GROUP));
}
- if (!in_array($this->getDefaultGroup(), $groupSequence->groups, true)) {
+ if (!\in_array($this->getDefaultGroup(), $groupSequence->groups, true)) {
throw new GroupDefinitionException(sprintf('The group "%s" is missing in the group sequence', $this->getDefaultGroup()));
}
*/
public function hasGroupSequence()
{
- return $this->groupSequence && count($this->groupSequence->groups) > 0;
+ return $this->groupSequence && \count($this->groupSequence->groups) > 0;
}
/**