Skip to content

Commit ee7de0c

Browse files
[Validator] throw when Constraint::_construct() has not been called
1 parent dba84cf commit ee7de0c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Constraint.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,10 @@ public function __isset($option)
226226
*/
227227
public function addImplicitGroupName($group)
228228
{
229+
if (null === $this->groups && \array_key_exists('groups', (array) $this)) {
230+
throw new \LogicException(sprintf('"%s::$groups" is set to null. Did you forget to call "%s::__construct()"?', static::class, self::class));
231+
}
232+
229233
if (\in_array(self::DEFAULT_GROUP, $this->groups) && !\in_array($group, $this->groups)) {
230234
$this->groups[] = $group;
231235
}

0 commit comments

Comments
 (0)