/** * @param FormInterface $form * @param string|null $data */ private function buildForm(FormInterface $form, $data) { $form->remove('value')->remove('from')->remove('to'); if ($data === null || in_array($data, NumberFilter::getSimpleTypes(), true)) { $form->add('value', NumberForm::class); } elseif (in_array($data, NumberFilter::getCompoundTypes())) { $form->add('from', NumberForm::class)->add('to', NumberForm::class); } }
public function testCompoundTypes() { $this->assertSame([NumberType::TYPE_BETWEEN, NumberType::TYPE_NOT_BETWEEN], NumberType::getCompoundTypes()); }