/** * @throws \InvalidArgumentException */ private function applyFieldRule() { $this->rule = $this->rule ?: FieldRule::A_SINGLE_VALUE(); if ($this->isASet() && !$this->type->allowedInSet()) { throw new \InvalidArgumentException(sprintf('Field [%s] with type [%s] cannot be used in a set.', $this->name, $this->type->getTypeValue())); } }
public function testGetRule() { $this->assertInstanceOf('Gdbots\\Pbjc\\Enum\\FieldRule', $this->field->getRule()); $this->assertEquals(FieldRule::A_SINGLE_VALUE(), $this->field->getRule()); }