Skip to content

Commit ae63cb5

Browse files
committed
refactoring
1 parent d826b1a commit ae63cb5

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/Forms/Controls/UploadControl.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
use Nette;
1313
use Nette\Forms;
14+
use Nette\Forms\Form;
1415
use Nette\Http\FileUpload;
1516

1617

@@ -34,7 +35,7 @@ public function __construct($label = null, bool $multiple = false)
3435
$this->setOption('type', 'file');
3536
$this->addRule([$this, 'isOk'], Forms\Validator::$messages[self::VALID]);
3637

37-
$this->monitor(Forms\Form::class, function (Forms\Form $form): void {
38+
$this->monitor(Form::class, function (Form $form): void {
3839
if (!$form->isMethod('post')) {
3940
throw new Nette\InvalidStateException('File upload requires method POST.');
4041
}
@@ -48,7 +49,7 @@ public function __construct($label = null, bool $multiple = false)
4849
*/
4950
public function loadHttpData(): void
5051
{
51-
$this->value = $this->getHttpData(Nette\Forms\Form::DATA_FILE);
52+
$this->value = $this->getHttpData(Nette\Form::DATA_FILE);
5253
if ($this->value === null) {
5354
$this->value = new FileUpload(null);
5455
}
@@ -103,9 +104,9 @@ public function isOk(): bool
103104
*/
104105
public function addRule($validator, $errorMessage = null, $arg = null)
105106
{
106-
if ($validator === Forms\Form::IMAGE) {
107+
if ($validator === Form::IMAGE) {
107108
$this->control->accept = implode(', ', FileUpload::IMAGE_MIME_TYPES);
108-
} elseif ($validator === Forms\Form::MIME_TYPE) {
109+
} elseif ($validator === Form::MIME_TYPE) {
109110
$this->control->accept = implode(', ', (array) $arg);
110111
}
111112
return parent::addRule($validator, $errorMessage, $arg);

0 commit comments

Comments
 (0)