|
| 1 | +<?php |
| 2 | + |
| 3 | +declare(strict_types=1); |
| 4 | + |
| 5 | +use Nette\Forms\Form; |
| 6 | +use function PHPStan\Testing\assertType; |
| 7 | + |
| 8 | + |
| 9 | +$form = new Form; |
| 10 | + |
| 11 | +$input = $form->addText('Text'); |
| 12 | +assertType('string|null', $input->getValue()); |
| 13 | + |
| 14 | +$input = $form->addPassword('Password'); |
| 15 | +assertType('string|null', $input->getValue()); |
| 16 | + |
| 17 | +$input = $form->addTextArea('TextArea'); |
| 18 | +assertType('string|null', $input->getValue()); |
| 19 | + |
| 20 | +$input = $form->addEmail('Email'); |
| 21 | +assertType('string|null', $input->getValue()); |
| 22 | + |
| 23 | +$input = $form->addInteger('Integer'); |
| 24 | +assertType('string|null', $input->getValue()); |
| 25 | + |
| 26 | +$input = $form->addUpload('Upload'); |
| 27 | +assertType('array<Nette\Http\FileUpload>|Nette\Http\FileUpload|null', $input->getValue()); |
| 28 | + |
| 29 | +$input = $form->addMultiUpload('MultiUpload'); |
| 30 | +assertType('array<Nette\Http\FileUpload>|Nette\Http\FileUpload|null', $input->getValue()); |
| 31 | + |
| 32 | +$input = $form->addHidden('Hidden'); |
| 33 | +assertType('string|null', $input->getValue()); |
| 34 | + |
| 35 | +$input = $form->addCheckbox('Checkbox'); |
| 36 | +assertType('bool|null', $input->getValue()); |
| 37 | + |
| 38 | +$input = $form->addRadioList('RadioList'); |
| 39 | +assertType('int|string|null', $input->getValue()); |
| 40 | + |
| 41 | +$input = $form->addCheckboxList('CheckboxList'); |
| 42 | +assertType('array<(int|string)>', $input->getValue()); |
| 43 | + |
| 44 | +$input = $form->addSelect('Select'); |
| 45 | +assertType('int|string|null', $input->getValue()); |
| 46 | + |
| 47 | +$input = $form->addMultiSelect('MultiSelect'); |
| 48 | +assertType('array<(int|string)>', $input->getValue()); |
| 49 | + |
| 50 | +$input = $form->addSubmit('Submit'); |
| 51 | +assertType('string|null', $input->getValue()); |
| 52 | + |
| 53 | +$input = $form->addButton('Button'); |
| 54 | +assertType('string|null', $input->getValue()); |
| 55 | + |
| 56 | +$input = $form->addImageButton('ImageButton'); |
| 57 | +assertType('array|null', $input->getValue()); |
| 58 | + |
| 59 | +$input = $form->addImage('Image'); |
| 60 | +assertType('array|null', $input->getValue()); |
0 commit comments