Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed string from return types of method BaseControl::getLabel() #309

Open
wants to merge 4 commits into
base: v3.1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions src/Forms/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
{
Expand All @@ -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,
Expand All @@ -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
{
Expand All @@ -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
{
Expand All @@ -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
{
Expand All @@ -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
{
Expand All @@ -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
{
Expand All @@ -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
{
Expand All @@ -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
{
Expand All @@ -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
{
Expand All @@ -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
{
Expand All @@ -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,
Expand All @@ -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
{
Expand All @@ -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
{
Expand All @@ -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
{
Expand Down
2 changes: 1 addition & 1 deletion src/Forms/Controls/BaseControl.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Forms/Controls/UploadControl.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down