From b36e122a231dbbfcbdd0ca4e04d50c8b3484e6b3 Mon Sep 17 00:00:00 2001 From: David Grudl Date: Sat, 11 Mar 2023 20:47:10 +0100 Subject: [PATCH 1/4] fixed phpDoc --- src/Forms/Container.php | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/Forms/Container.php b/src/Forms/Container.php index d49d8fab1..e08c1302d 100644 --- a/src/Forms/Container.php +++ b/src/Forms/Container.php @@ -322,7 +322,7 @@ public function getForm(bool $throw = true): ?Form /** * Adds single-line text input control to the form. - * @param string|object $label + * @param string|object|null $label */ public function addText(string $name, $label = null, ?int $cols = null, ?int $maxLength = null): Controls\TextInput { @@ -333,7 +333,7 @@ public function addText(string $name, $label = null, ?int $cols = null, ?int $ma /** * Adds single-line text input control used for sensitive input such as passwords. - * @param string|object $label + * @param string|object|null $label */ public function addPassword( string $name, @@ -350,7 +350,7 @@ public function addPassword( /** * Adds multi-line text input control to the form. - * @param string|object $label + * @param string|object|null $label */ public function addTextArea(string $name, $label = null, ?int $cols = null, ?int $rows = null): Controls\TextArea { @@ -361,7 +361,7 @@ public function addTextArea(string $name, $label = null, ?int $cols = null, ?int /** * Adds input for email. - * @param string|object $label + * @param string|object|null $label */ public function addEmail(string $name, $label = null): Controls\TextInput { @@ -372,7 +372,7 @@ public function addEmail(string $name, $label = null): Controls\TextInput /** * Adds input for integer. - * @param string|object $label + * @param string|object|null $label */ public function addInteger(string $name, $label = null): Controls\TextInput { @@ -384,7 +384,7 @@ public function addInteger(string $name, $label = null): Controls\TextInput /** * Adds control that allows the user to upload files. - * @param string|object $label + * @param string|object|null $label */ public function addUpload(string $name, $label = null): Controls\UploadControl { @@ -394,7 +394,7 @@ public function addUpload(string $name, $label = null): Controls\UploadControl /** * Adds control that allows the user to upload multiple files. - * @param string|object $label + * @param string|object|null $label */ public function addMultiUpload(string $name, $label = null): Controls\UploadControl { @@ -414,7 +414,7 @@ public function addHidden(string $name, $default = null): Controls\HiddenField /** * Adds check box control to the form. - * @param string|object $caption + * @param string|object|null $caption */ public function addCheckbox(string $name, $caption = null): Controls\Checkbox { @@ -424,7 +424,7 @@ public function addCheckbox(string $name, $caption = null): Controls\Checkbox /** * Adds set of radio button controls to the form. - * @param string|object $label + * @param string|object|null $label */ public function addRadioList(string $name, $label = null, ?array $items = null): Controls\RadioList { @@ -434,7 +434,7 @@ public function addRadioList(string $name, $label = null, ?array $items = null): /** * Adds set of checkbox controls to the form. - * @param string|object $label + * @param string|object|null $label */ public function addCheckboxList(string $name, $label = null, ?array $items = null): Controls\CheckboxList { @@ -444,7 +444,7 @@ public function addCheckboxList(string $name, $label = null, ?array $items = nul /** * Adds select box control that allows single item selection. - * @param string|object $label + * @param string|object|null $label */ public function addSelect(string $name, $label = null, ?array $items = null, ?int $size = null): Controls\SelectBox { @@ -455,7 +455,7 @@ public function addSelect(string $name, $label = null, ?array $items = null, ?in /** * Adds select box control that allows multiple item selection. - * @param string|object $label + * @param string|object|null $label */ public function addMultiSelect( string $name, @@ -471,7 +471,7 @@ public function addMultiSelect( /** * Adds button used to submit form. - * @param string|object $caption + * @param string|object|null $caption */ public function addSubmit(string $name, $caption = null): Controls\SubmitButton { @@ -481,7 +481,7 @@ public function addSubmit(string $name, $caption = null): Controls\SubmitButton /** * Adds push buttons with no default behavior. - * @param string|object $caption + * @param string|object|null $caption */ public function addButton(string $name, $caption = null): Controls\Button { @@ -491,8 +491,8 @@ public function addButton(string $name, $caption = null): Controls\Button /** * Adds graphical button used to submit form. - * @param string $src URI of the image - * @param string $alt alternate text for the image + * @param string|null $src URI of the image + * @param string|null $alt alternate text for the image */ public function addImageButton(string $name, ?string $src = null, ?string $alt = null): Controls\ImageButton { From 1a51373b8c480866f2b63b8ae8f001ac118bf428 Mon Sep 17 00:00:00 2001 From: David Grudl Date: Sun, 12 Mar 2023 23:42:32 +0100 Subject: [PATCH 2/4] UploadControl: changed %i to %d [Closes #300] --- src/Forms/Controls/UploadControl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Forms/Controls/UploadControl.php b/src/Forms/Controls/UploadControl.php index 84ce5afd2..f28da81fa 100644 --- a/src/Forms/Controls/UploadControl.php +++ b/src/Forms/Controls/UploadControl.php @@ -39,7 +39,7 @@ public function __construct($label = null, bool $multiple = false) ->addRule([$this, 'isOk'], Forms\Validator::$messages[self::Valid]); $this->addRule(Form::MaxFileSize, null, Forms\Helpers::iniGetSize('upload_max_filesize')); if ($multiple) { - $this->addRule(Form::MaxLength, 'The maximum allowed number of uploaded files is %i', (int) ini_get('max_file_uploads')); + $this->addRule(Form::MaxLength, 'The maximum allowed number of uploaded files is %d', (int) ini_get('max_file_uploads')); } $this->monitor(Form::class, function (Form $form): void { From 8a23250f05443cae8b7c8294003c3f2a9d38ffc5 Mon Sep 17 00:00:00 2001 From: David Grudl Date: Sun, 12 Mar 2023 23:46:01 +0100 Subject: [PATCH 3/4] Container: const Array changed to public [Closes #301] --- src/Forms/Container.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Forms/Container.php b/src/Forms/Container.php index e08c1302d..c4e39fcf9 100644 --- a/src/Forms/Container.php +++ b/src/Forms/Container.php @@ -24,7 +24,7 @@ class Container extends Nette\ComponentModel\Container implements \ArrayAccess { use Nette\ComponentModel\ArrayAccess; - private const Array = 'array'; + public const Array = 'array'; /** * Occurs when the form was validated From ea9f6abb6a59673d5bb61791ea05a3ec8b082f90 Mon Sep 17 00:00:00 2001 From: Michal Lulco Date: Mon, 24 Jul 2023 22:53:01 +0200 Subject: [PATCH 4/4] Update BaseControl.php - removed string from return types of method getLabel() --- src/Forms/Controls/BaseControl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Forms/Controls/BaseControl.php b/src/Forms/Controls/BaseControl.php index 2f9de2a27..028768da9 100644 --- a/src/Forms/Controls/BaseControl.php +++ b/src/Forms/Controls/BaseControl.php @@ -269,7 +269,7 @@ public function getControl() /** * Generates label's HTML element. * @param string|object $caption - * @return Html|string|null + * @return Html|null */ public function getLabel($caption = null) {