diff --git a/examples/basic-example.php b/examples/basic-example.php
index d54b5ee67..cc870d835 100644
--- a/examples/basic-example.php
+++ b/examples/basic-example.php
@@ -48,7 +48,7 @@
// group Shipping address
$form->addGroup('Shipping address')
- ->setOption('embedNext', TRUE);
+ ->setOption('embedNext', true);
$form->addCheckbox('send', 'Ship to address')
->addCondition($form::FILLED) // conditional rule: if is checkbox checked...
@@ -91,7 +91,7 @@
->addRule($form::EQUAL, 'Passwords do not match', $form['password']);
$form->addUpload('avatar', 'Picture:')
- ->setRequired(FALSE)
+ ->setRequired(false)
->addRule($form::IMAGE, 'Uploaded file is not image');
$form->addHidden('userid');
@@ -112,7 +112,7 @@
if ($form->isSuccess()) {
echo '
Form was submitted and successfully validated
';
- Dumper::dump($form->getValues(), [Dumper::COLLAPSE => FALSE]);
+ Dumper::dump($form->getValues(), [Dumper::COLLAPSE => false]);
exit;
}
diff --git a/examples/bootstrap2-rendering.php b/examples/bootstrap2-rendering.php
index 602ecca09..c16fb05ec 100644
--- a/examples/bootstrap2-rendering.php
+++ b/examples/bootstrap2-rendering.php
@@ -19,7 +19,7 @@
function makeBootstrap2(Form $form)
{
$renderer = $form->getRenderer();
- $renderer->wrappers['controls']['container'] = NULL;
+ $renderer->wrappers['controls']['container'] = null;
$renderer->wrappers['pair']['container'] = 'div class=control-group';
$renderer->wrappers['pair']['.error'] = 'error';
$renderer->wrappers['control']['container'] = 'div class=controls';
@@ -33,9 +33,9 @@ function makeBootstrap2(Form $form)
$type = $control->getOption('type');
if ($type === 'button') {
$control->getControlPrototype()->addClass(empty($usedPrimary) ? 'btn btn-primary' : 'btn');
- $usedPrimary = TRUE;
+ $usedPrimary = true;
- } elseif (in_array($type, ['checkbox', 'radio'], TRUE)) {
+ } elseif (in_array($type, ['checkbox', 'radio'], true)) {
$control->getSeparatorPrototype()->setName('div')->addClass($type);
}
}
diff --git a/examples/bootstrap3-rendering.php b/examples/bootstrap3-rendering.php
index b5dc871de..9e8baadb2 100644
--- a/examples/bootstrap3-rendering.php
+++ b/examples/bootstrap3-rendering.php
@@ -19,7 +19,7 @@
function makeBootstrap3(Form $form)
{
$renderer = $form->getRenderer();
- $renderer->wrappers['controls']['container'] = NULL;
+ $renderer->wrappers['controls']['container'] = null;
$renderer->wrappers['pair']['container'] = 'div class=form-group';
$renderer->wrappers['pair']['.error'] = 'has-error';
$renderer->wrappers['control']['container'] = 'div class=col-sm-9';
@@ -33,12 +33,12 @@ function makeBootstrap3(Form $form)
$type = $control->getOption('type');
if ($type === 'button') {
$control->getControlPrototype()->addClass(empty($usedPrimary) ? 'btn btn-primary' : 'btn btn-default');
- $usedPrimary = TRUE;
+ $usedPrimary = true;
- } elseif (in_array($type, ['text', 'textarea', 'select'], TRUE)) {
+ } elseif (in_array($type, ['text', 'textarea', 'select'], true)) {
$control->getControlPrototype()->addClass('form-control');
- } elseif (in_array($type, ['checkbox', 'radio'], TRUE)) {
+ } elseif (in_array($type, ['checkbox', 'radio'], true)) {
$control->getSeparatorPrototype()->setName('div')->addClass($type);
}
}
diff --git a/examples/bootstrap4-rendering.php b/examples/bootstrap4-rendering.php
index 3bda476a2..35791d8b5 100644
--- a/examples/bootstrap4-rendering.php
+++ b/examples/bootstrap4-rendering.php
@@ -19,7 +19,7 @@
function makeBootstrap4(Form $form)
{
$renderer = $form->getRenderer();
- $renderer->wrappers['controls']['container'] = NULL;
+ $renderer->wrappers['controls']['container'] = null;
$renderer->wrappers['pair']['container'] = 'div class="form-group row"';
$renderer->wrappers['pair']['.error'] = 'has-danger';
$renderer->wrappers['control']['container'] = 'div class=col-sm-9';
@@ -32,15 +32,15 @@ function makeBootstrap4(Form $form)
$type = $control->getOption('type');
if ($type === 'button') {
$control->getControlPrototype()->addClass(empty($usedPrimary) ? 'btn btn-primary' : 'btn btn-secondary');
- $usedPrimary = TRUE;
+ $usedPrimary = true;
- } elseif (in_array($type, ['text', 'textarea', 'select'], TRUE)) {
+ } elseif (in_array($type, ['text', 'textarea', 'select'], true)) {
$control->getControlPrototype()->addClass('form-control');
} elseif ($type === 'file') {
$control->getControlPrototype()->addClass('form-control-file');
- } elseif (in_array($type, ['checkbox', 'radio'], TRUE)) {
+ } elseif (in_array($type, ['checkbox', 'radio'], true)) {
if ($control instanceof Nette\Forms\Controls\Checkbox) {
$control->getLabelPrototype()->addClass('form-check-label');
} else {
diff --git a/examples/custom-control.php b/examples/custom-control.php
index 7ced594a9..ef968e9d7 100644
--- a/examples/custom-control.php
+++ b/examples/custom-control.php
@@ -23,17 +23,17 @@ class DateInput extends Nette\Forms\Controls\BaseControl
$year = '';
- public function __construct($label = NULL)
+ public function __construct($label = null)
{
parent::__construct($label);
- $this->setRequired(FALSE)
+ $this->setRequired(false)
->addRule([__CLASS__, 'validateDate'], 'Date is invalid.');
}
public function setValue($value)
{
- if ($value === NULL) {
+ if ($value === null) {
$this->day = $this->month = $this->year = '';
} else {
$date = Nette\Utils\DateTime::from($value);
@@ -46,13 +46,13 @@ public function setValue($value)
/**
- * @return DateTimeImmutable|NULL
+ * @return DateTimeImmutable|null
*/
public function getValue()
{
return self::validateDate($this)
? (new DateTimeImmutable)->setDate((int) $this->year, (int) $this->month, (int) $this->day)->setTime(0, 0)
- : NULL;
+ : null;
}
@@ -86,7 +86,7 @@ public function getControl()
'type' => 'number',
'min' => 1,
'max' => 31,
- 'data-nette-rules' => Helpers::exportRules($this->getRules()) ?: NULL,
+ 'data-nette-rules' => Helpers::exportRules($this->getRules()) ?: null,
])
. Helpers::createSelectBox(
diff --git a/examples/custom-rendering.php b/examples/custom-rendering.php
index ba4214750..b98022406 100644
--- a/examples/custom-rendering.php
+++ b/examples/custom-rendering.php
@@ -21,9 +21,9 @@
// setup custom rendering
$renderer = $form->getRenderer();
$renderer->wrappers['form']['container'] = Html::el('div')->id('form');
-$renderer->wrappers['group']['container'] = NULL;
+$renderer->wrappers['group']['container'] = null;
$renderer->wrappers['group']['label'] = 'h3';
-$renderer->wrappers['pair']['container'] = NULL;
+$renderer->wrappers['pair']['container'] = null;
$renderer->wrappers['controls']['container'] = 'dl';
$renderer->wrappers['control']['container'] = 'dd';
$renderer->wrappers['control']['.odd'] = 'odd';
diff --git a/examples/localization.php b/examples/localization.php
index 9a6be0b97..d4da0beb3 100644
--- a/examples/localization.php
+++ b/examples/localization.php
@@ -31,7 +31,7 @@ function __construct(array $table)
/**
* Translates the given string.
*/
- public function translate($message, $count = NULL)
+ public function translate($message, $count = null)
{
return isset($this->table[$message]) ? $this->table[$message] : $message;
}
diff --git a/examples/manual-rendering.php b/examples/manual-rendering.php
index bb0596aaa..8c91820c0 100644
--- a/examples/manual-rendering.php
+++ b/examples/manual-rendering.php
@@ -23,13 +23,13 @@
$form->addText('age')
->setRequired('Enter your age');
-$form->addRadioList('gender', NULL, [
+$form->addRadioList('gender', null, [
'm' => 'male',
'f' => 'female',
]);
$form->addText('email')
- ->setRequired(FALSE)
+ ->setRequired(false)
->addRule($form::EMAIL, 'Incorrect email address');
$form->addSubmit('submit');
diff --git a/src/Bridges/FormsLatte/FormMacros.php b/src/Bridges/FormsLatte/FormMacros.php
index 51510bc8d..077a98327 100644
--- a/src/Bridges/FormsLatte/FormMacros.php
+++ b/src/Bridges/FormsLatte/FormMacros.php
@@ -32,7 +32,7 @@ public static function install(Latte\Compiler $compiler)
$me = new static($compiler);
$me->addMacro('form', [$me, 'macroForm'], 'echo Nette\Bridges\FormsLatte\Runtime::renderFormEnd(array_pop($this->global->formsStack));');
$me->addMacro('formContainer', [$me, 'macroFormContainer'], 'array_pop($this->global->formsStack); $formContainer = $_form = end($this->global->formsStack)');
- $me->addMacro('label', [$me, 'macroLabel'], [$me, 'macroLabelEnd'], NULL, self::AUTO_EMPTY);
+ $me->addMacro('label', [$me, 'macroLabel'], [$me, 'macroLabelEnd'], null, self::AUTO_EMPTY);
$me->addMacro('input', [$me, 'macroInput']);
$me->addMacro('name', [$me, 'macroName'], [$me, 'macroNameEnd'], [$me, 'macroNameAttr']);
$me->addMacro('inputError', [$me, 'macroInputError']);
@@ -54,10 +54,10 @@ public function macroForm(MacroNode $node, PhpWriter $writer)
throw new CompileException('Did you mean
global->formsStack[] = is_object($this->global->uiControl['myForm']) ? $this->global->uiControl['myForm'] : $this->global->uiControl[$this->global->uiControl['myForm']];
?>
diff --git a/tests/Forms.Latte/expected/FormMacros.get.phtml b/tests/Forms.Latte/expected/FormMacros.get.phtml
index 56285d782..98454dcc7 100644
--- a/tests/Forms.Latte/expected/FormMacros.get.phtml
+++ b/tests/Forms.Latte/expected/FormMacros.get.phtml
@@ -9,8 +9,8 @@
$form = $_form = $this->global->formsStack[] = $this->global->uiControl["myForm"];
?>
%A%
diff --git a/tests/Forms/Container.validate().phpt b/tests/Forms/Container.validate().phpt
index 61ae8af54..7a2773c26 100644
--- a/tests/Forms/Container.validate().phpt
+++ b/tests/Forms/Container.validate().phpt
@@ -36,6 +36,6 @@ Assert::same([
Assert::exception(function () {
$form = new Form;
- $form->onValidate = TRUE;
+ $form->onValidate = true;
$form->validate();
}, Nette\UnexpectedValueException::class, 'Property Form::$onValidate must be array or Traversable, boolean given.');
diff --git a/tests/Forms/Container.values.phpt b/tests/Forms/Container.values.phpt
index 5ef2a7109..89890d79d 100644
--- a/tests/Forms/Container.values.phpt
+++ b/tests/Forms/Container.values.phpt
@@ -23,7 +23,7 @@ $_POST = [
'name' => 'david',
],
],
- 'invalid' => TRUE,
+ 'invalid' => true,
];
diff --git a/tests/Forms/Controls.BaseControl.phpt b/tests/Forms/Controls.BaseControl.phpt
index 8245be901..99a826f34 100644
--- a/tests/Forms/Controls.BaseControl.phpt
+++ b/tests/Forms/Controls.BaseControl.phpt
@@ -45,7 +45,7 @@ test(function () { // validators
Assert::true(Validator::validateFilled($input));
Assert::true(Validator::validateValid($input));
- Assert::false(Validator::validateLength($input, NULL));
+ Assert::false(Validator::validateLength($input, null));
Assert::false(Validator::validateLength($input, 2));
Assert::true(Validator::validateLength($input, 3));
@@ -55,9 +55,9 @@ test(function () { // validators
Assert::true(Validator::validateMaxLength($input, 3));
Assert::false(Validator::validateMaxLength($input, 2));
- Assert::false(Validator::validateRange($input, [NULL, NULL]));
+ Assert::false(Validator::validateRange($input, [null, null]));
Assert::true(Validator::validateRange($input, [100, 1000]));
- Assert::false(Validator::validateRange($input, [1000, NULL]));
+ Assert::false(Validator::validateRange($input, [1000, null]));
Assert::true(Validator::validateMin($input, 122));
Assert::true(Validator::validateMin($input, 123));
@@ -71,7 +71,7 @@ test(function () { // validators
test(function () { // validators for array
$form = new Form;
- $input = $form->addMultiSelect('select', NULL, ['a', 'b', 'c', 'd']);
+ $input = $form->addMultiSelect('select', null, ['a', 'b', 'c', 'd']);
$input->setValue([1, 2, 3]);
Assert::true(Validator::validateEqual($input, [1, 2, 3, 4]));
@@ -81,7 +81,7 @@ test(function () { // validators for array
Assert::true(Validator::validateFilled($input));
Assert::true(Validator::validateValid($input));
- Assert::false(Validator::validateLength($input, NULL));
+ Assert::false(Validator::validateLength($input, null));
Assert::false(Validator::validateLength($input, 2));
Assert::true(Validator::validateLength($input, 3));
diff --git a/tests/Forms/Controls.Button.render.phpt b/tests/Forms/Controls.Button.render.phpt
index 9135be760..d02cf0ac6 100644
--- a/tests/Forms/Controls.Button.render.phpt
+++ b/tests/Forms/Controls.Button.render.phpt
@@ -14,7 +14,7 @@ require __DIR__ . '/../bootstrap.php';
class Translator implements Nette\Localization\ITranslator
{
- function translate($s, $plural = NULL)
+ function translate($s, $plural = null)
{
return strtoupper($s);
}
@@ -82,7 +82,7 @@ test(function () { // SubmitButton
test(function () { // SubmitButton with scope
$form = new Form;
- $input = $form->addSubmit('button', 'Caption')->setValidationScope(FALSE);
+ $input = $form->addSubmit('button', 'Caption')->setValidationScope(false);
Assert::same('', (string) $input->getControl());
});
diff --git a/tests/Forms/Controls.Checkbox.loadData.phpt b/tests/Forms/Controls.Checkbox.loadData.phpt
index f9919dea5..394319dac 100644
--- a/tests/Forms/Controls.Checkbox.loadData.phpt
+++ b/tests/Forms/Controls.Checkbox.loadData.phpt
@@ -37,7 +37,7 @@ test(function () {
test(function () { // malformed data
- $_POST = ['malformed' => [NULL]];
+ $_POST = ['malformed' => [null]];
$form = new Form;
$input = $form->addCheckbox('malformed');
@@ -50,9 +50,9 @@ test(function () { // malformed data
test(function () { // setValue() and invalid argument
$form = new Form;
$input = $form->addCheckbox('checkbox');
- $input->setValue(NULL);
+ $input->setValue(null);
Assert::exception(function () use ($input) {
$input->setValue([]);
- }, Nette\InvalidArgumentException::class, "Value must be scalar or NULL, array given in field 'checkbox'.");
+ }, Nette\InvalidArgumentException::class, "Value must be scalar or null, array given in field 'checkbox'.");
});
diff --git a/tests/Forms/Controls.Checkbox.render.phpt b/tests/Forms/Controls.Checkbox.render.phpt
index c60cacad4..2bc746cdc 100644
--- a/tests/Forms/Controls.Checkbox.render.phpt
+++ b/tests/Forms/Controls.Checkbox.render.phpt
@@ -14,7 +14,7 @@ require __DIR__ . '/../bootstrap.php';
class Translator implements Nette\Localization\ITranslator
{
- function translate($s, $plural = NULL)
+ function translate($s, $plural = null)
{
return strtoupper($s);
}
@@ -36,7 +36,7 @@ test(function () {
Assert::type(Html::class, $input->getControlPart());
Assert::same('', (string) $input->getControlPart());
- $input->setValue(TRUE);
+ $input->setValue(true);
Assert::same('', (string) $input->getControl());
Assert::same('', (string) $input->getControlPart());
});
diff --git a/tests/Forms/Controls.CheckboxList.loadData.phpt b/tests/Forms/Controls.CheckboxList.loadData.phpt
index 29274ef2c..d9be6ccea 100644
--- a/tests/Forms/Controls.CheckboxList.loadData.phpt
+++ b/tests/Forms/Controls.CheckboxList.loadData.phpt
@@ -31,7 +31,7 @@ test(function () use ($series) { // invalid input
$_POST = ['list' => 'red-dwarf'];
$form = new Form;
- $input = $form->addCheckboxList('list', NULL, $series);
+ $input = $form->addCheckboxList('list', null, $series);
Assert::true($form->isValid());
Assert::same([], $input->getValue());
@@ -44,7 +44,7 @@ test(function () use ($series) { // multiple selected items, zero item
$_POST = ['multi' => ['red-dwarf', 'unknown', 0]];
$form = new Form;
- $input = $form->addCheckboxList('multi', NULL, $series);
+ $input = $form->addCheckboxList('multi', null, $series);
Assert::true($form->isValid());
Assert::same(['red-dwarf', 0], $input->getValue());
@@ -58,7 +58,7 @@ test(function () use ($series) { // empty key
$_POST = ['empty' => ['']];
$form = new Form;
- $input = $form->addCheckboxList('empty', NULL, $series);
+ $input = $form->addCheckboxList('empty', null, $series);
Assert::true($form->isValid());
Assert::same([''], $input->getValue());
@@ -69,7 +69,7 @@ test(function () use ($series) { // empty key
test(function () use ($series) { // missing key
$form = new Form;
- $input = $form->addCheckboxList('missing', NULL, $series);
+ $input = $form->addCheckboxList('missing', null, $series);
Assert::true($form->isValid());
Assert::same([], $input->getValue());
@@ -82,7 +82,7 @@ test(function () use ($series) { // disabled key
$_POST = ['disabled' => 'red-dwarf'];
$form = new Form;
- $input = $form->addCheckboxList('disabled', NULL, $series)
+ $input = $form->addCheckboxList('disabled', null, $series)
->setDisabled();
Assert::true($form->isValid());
@@ -91,10 +91,10 @@ test(function () use ($series) { // disabled key
test(function () use ($series) { // malformed data
- $_POST = ['malformed' => [[NULL]]];
+ $_POST = ['malformed' => [[null]]];
$form = new Form;
- $input = $form->addCheckboxList('malformed', NULL, $series);
+ $input = $form->addCheckboxList('malformed', null, $series);
Assert::true($form->isValid());
Assert::same([], $input->getValue());
@@ -107,7 +107,7 @@ test(function () use ($series) { // validateLength
$_POST = ['multi' => ['red-dwarf', 'unknown', 0]];
$form = new Form;
- $input = $form->addCheckboxList('multi', NULL, $series);
+ $input = $form->addCheckboxList('multi', null, $series);
Assert::true(Validator::validateLength($input, 2));
Assert::false(Validator::validateLength($input, 3));
@@ -120,7 +120,7 @@ test(function () use ($series) { // validateEqual
$_POST = ['multi' => ['red-dwarf', 'unknown', 0]];
$form = new Form;
- $input = $form->addCheckboxList('multi', NULL, $series);
+ $input = $form->addCheckboxList('multi', null, $series);
Assert::true(Validator::validateEqual($input, ['red-dwarf', 0]));
Assert::false(Validator::validateEqual($input, 'unknown'));
@@ -131,8 +131,8 @@ test(function () use ($series) { // validateEqual
test(function () use ($series) { // setValue() and invalid argument
$form = new Form;
- $input = $form->addCheckboxList('list', NULL, $series);
- $input->setValue(NULL);
+ $input = $form->addCheckboxList('list', null, $series);
+ $input->setValue(null);
Assert::exception(function () use ($input) {
$input->setValue('unknown');
@@ -142,7 +142,7 @@ test(function () use ($series) { // setValue() and invalid argument
test(function () { // object as value
$form = new Form;
- $input = $form->addCheckboxList('list', NULL, ['2013-07-05 00:00:00' => 1])
+ $input = $form->addCheckboxList('list', null, ['2013-07-05 00:00:00' => 1])
->setValue([new DateTime('2013-07-05')]);
Assert::same(['2013-07-05 00:00:00'], $input->getValue());
@@ -152,7 +152,7 @@ test(function () { // object as value
test(function () { // object as item
$form = new Form;
$input = $form->addCheckboxList('list')
- ->setItems([new DateTime('2013-07-05')], FALSE)
+ ->setItems([new DateTime('2013-07-05')], false)
->setValue('2013-07-05 00:00:00');
Assert::equal(['2013-07-05 00:00:00' => new DateTime('2013-07-05')], $input->getSelectedItems());
@@ -163,13 +163,13 @@ test(function () use ($series) { // disabled one
$_POST = ['list' => ['red-dwarf', 0]];
$form = new Form;
- $input = $form->addCheckboxList('list', NULL, $series)
+ $input = $form->addCheckboxList('list', null, $series)
->setDisabled(['red-dwarf']);
Assert::same([0], $input->getValue());
unset($form['list']);
- $input = new Nette\Forms\Controls\CheckboxList(NULL, $series);
+ $input = new Nette\Forms\Controls\CheckboxList(null, $series);
$input->setDisabled(['red-dwarf']);
$form['list'] = $input;
diff --git a/tests/Forms/Controls.CheckboxList.render.phpt b/tests/Forms/Controls.CheckboxList.render.phpt
index 8e6f8e4d6..fbf4c5e19 100644
--- a/tests/Forms/Controls.CheckboxList.render.phpt
+++ b/tests/Forms/Controls.CheckboxList.render.phpt
@@ -14,7 +14,7 @@ require __DIR__ . '/../bootstrap.php';
class Translator implements Nette\Localization\ITranslator
{
- function translate($s, $plural = NULL)
+ function translate($s, $plural = null)
{
return strtoupper($s);
}
@@ -112,7 +112,7 @@ test(function () { // container
test(function () { // separator prototype
$form = new Form;
- $input = $form->addCheckboxList('list', NULL, [
+ $input = $form->addCheckboxList('list', null, [
'a' => 'b',
]);
$input->getSeparatorPrototype()->setName('div');
@@ -126,7 +126,7 @@ test(function () { // disabled all
$input = $form->addCheckboxList('list', 'Label', [
'a' => 'First',
0 => 'Second',
- ])->setDisabled(TRUE);
+ ])->setDisabled(true);
Assert::same('
', (string) $input->getControl());
});
@@ -157,7 +157,7 @@ test(function () { // numeric key as string & getControlPart
test(function () { // container prototype
$form = new Form;
- $input = $form->addCheckboxList('list', NULL, [
+ $input = $form->addCheckboxList('list', null, [
'a' => 'b',
]);
$input->getSeparatorPrototype()->setName('hr');
@@ -181,7 +181,7 @@ test(function () { // rendering options
test(function () { // item label prototype
$form = new Form;
- $input = $form->addCheckboxList('list', NULL, [
+ $input = $form->addCheckboxList('list', null, [
'a' => 'b',
]);
$input->getItemLabelPrototype()->class('foo');
@@ -194,7 +194,7 @@ test(function () { // item label prototype
test(function () { // item label prototype (back compatiblity)
$form = new Form;
- $input = $form->addCheckboxList('list', NULL, [
+ $input = $form->addCheckboxList('list', null, [
'a' => 'b',
]);
$input->getLabelPrototype()->class('foo');
diff --git a/tests/Forms/Controls.ChoiceControl.loadData.phpt b/tests/Forms/Controls.ChoiceControl.loadData.phpt
index 0fd7059fb..11ae394fb 100644
--- a/tests/Forms/Controls.ChoiceControl.loadData.phpt
+++ b/tests/Forms/Controls.ChoiceControl.loadData.phpt
@@ -35,7 +35,7 @@ test(function () use ($series) { // Select
$_POST = ['select' => 'red-dwarf'];
$form = new Form;
- $input = $form['select'] = new ChoiceControl(NULL, $series);
+ $input = $form['select'] = new ChoiceControl(null, $series);
Assert::true($form->isValid());
Assert::same('red-dwarf', $input->getValue());
@@ -48,7 +48,7 @@ test(function () use ($series) { // Select with invalid input
$_POST = ['select' => 'days-of-our-lives'];
$form = new Form;
- $input = $form['select'] = new ChoiceControl(NULL, $series);
+ $input = $form['select'] = new ChoiceControl(null, $series);
Assert::true($form->isValid());
Assert::null($input->getValue());
@@ -61,7 +61,7 @@ test(function () use ($series) { // Indexed arrays
$_POST = ['zero' => 0];
$form = new Form;
- $input = $form['zero'] = new ChoiceControl(NULL, $series);
+ $input = $form['zero'] = new ChoiceControl(null, $series);
Assert::true($form->isValid());
Assert::same(0, $input->getValue());
@@ -75,7 +75,7 @@ test(function () use ($series) { // empty key
$_POST = ['empty' => ''];
$form = new Form;
- $input = $form['empty'] = new ChoiceControl(NULL, $series);
+ $input = $form['empty'] = new ChoiceControl(null, $series);
Assert::true($form->isValid());
Assert::same('', $input->getValue());
@@ -86,7 +86,7 @@ test(function () use ($series) { // empty key
test(function () use ($series) { // missing key
$form = new Form;
- $input = $form['missing'] = new ChoiceControl(NULL, $series);
+ $input = $form['missing'] = new ChoiceControl(null, $series);
Assert::true($form->isValid());
Assert::null($input->getValue());
@@ -99,7 +99,7 @@ test(function () use ($series) { // disabled key
$_POST = ['disabled' => 'red-dwarf'];
$form = new Form;
- $input = $form['disabled'] = new ChoiceControl(NULL, $series);
+ $input = $form['disabled'] = new ChoiceControl(null, $series);
$input->setDisabled();
Assert::true($form->isValid());
@@ -109,10 +109,10 @@ test(function () use ($series) { // disabled key
test(function () use ($series) { // malformed data
- $_POST = ['malformed' => [NULL]];
+ $_POST = ['malformed' => [null]];
$form = new Form;
- $input = $form['malformed'] = new ChoiceControl(NULL, $series);
+ $input = $form['malformed'] = new ChoiceControl(null, $series);
Assert::true($form->isValid());
Assert::null($input->getValue());
@@ -126,7 +126,7 @@ test(function () use ($series) { // setItems without keys
$form = new Form;
$input = $form['select'] = new ChoiceControl;
- $input->setItems(array_keys($series), FALSE);
+ $input->setItems(array_keys($series), false);
Assert::same([
'red-dwarf' => 'red-dwarf',
'the-simpsons' => 'the-simpsons',
@@ -143,8 +143,8 @@ test(function () use ($series) { // setItems without keys
test(function () use ($series) { // setValue() and invalid argument
$form = new Form;
- $input = $form['select'] = new ChoiceControl(NULL, $series);
- $input->setValue(NULL);
+ $input = $form['select'] = new ChoiceControl(null, $series);
+ $input->setValue(null);
Assert::exception(function () use ($input) {
$input->setValue('unknown');
@@ -154,8 +154,8 @@ test(function () use ($series) { // setValue() and invalid argument
test(function () use ($series) { // setValue() and disabled $checkAllowedValues
$form = new Form;
- $input = $form['select'] = new ChoiceControl(NULL, $series);
- $input->checkAllowedValues = FALSE;
+ $input = $form['select'] = new ChoiceControl(null, $series);
+ $input->checkAllowedValues = false;
$input->setValue('unknown');
Assert::null($input->getValue());
});
@@ -163,7 +163,7 @@ test(function () use ($series) { // setValue() and disabled $checkAllowedValues
test(function () { // object as value
$form = new Form;
- $input = $form['select'] = new ChoiceControl(NULL, ['2013-07-05 00:00:00' => 1]);
+ $input = $form['select'] = new ChoiceControl(null, ['2013-07-05 00:00:00' => 1]);
$input->setValue(new DateTime('2013-07-05'));
Assert::same('2013-07-05 00:00:00', $input->getValue());
@@ -173,7 +173,7 @@ test(function () { // object as value
test(function () { // object as item
$form = new Form;
$input = $form['select'] = new ChoiceControl;
- $input->setItems([new DateTime('2013-07-05')], FALSE)
+ $input->setItems([new DateTime('2013-07-05')], false)
->setValue(new DateTime('2013-07-05'));
Assert::same('2013-07-05 00:00:00', $input->getValue());
@@ -184,13 +184,13 @@ test(function () use ($series) { // disabled one
$_POST = ['select' => 'red-dwarf'];
$form = new Form;
- $input = $form['select'] = new ChoiceControl(NULL, $series);
+ $input = $form['select'] = new ChoiceControl(null, $series);
$input->setDisabled(['red-dwarf']);
Assert::null($input->getValue());
unset($form['select']);
- $input = new ChoiceControl(NULL, $series);
+ $input = new ChoiceControl(null, $series);
$input->setDisabled(['red-dwarf']);
$form['select'] = $input;
@@ -201,9 +201,9 @@ test(function () {
$_POST = ['select' => 1];
$form = new Form;
- $input = $form['select'] = new ChoiceControl(NULL);
+ $input = $form['select'] = new ChoiceControl(null);
$input->setItems([
- 1 => NULL,
+ 1 => null,
2 => 'Red dwarf',
]);
diff --git a/tests/Forms/Controls.CsrfProtection.breachAttack.phpt b/tests/Forms/Controls.CsrfProtection.breachAttack.phpt
index e1fae299c..85c6b6bab 100644
--- a/tests/Forms/Controls.CsrfProtection.breachAttack.phpt
+++ b/tests/Forms/Controls.CsrfProtection.breachAttack.phpt
@@ -31,13 +31,13 @@ for ($a = 0; $a < $charCount; $a++) {
for ($i = 3; $i <= strlen($token); $i++) {
$code = (string) $input->getControl();
- $shortest = NULL;
+ $shortest = null;
$adepts = [];
foreach ($strings as $string) {
for ($j = 0; $j < $charCount; $j++) {
$try = $string . $charlist[$j];
$length = strlen(gzdeflate($code . $try));
- if ($shortest === NULL || $length < $shortest) {
+ if ($shortest === null || $length < $shortest) {
$shortest = $length;
$adepts = [];
}
diff --git a/tests/Forms/Controls.CsrfProtection.phpt b/tests/Forms/Controls.CsrfProtection.phpt
index 5c239a636..0d6737367 100644
--- a/tests/Forms/Controls.CsrfProtection.phpt
+++ b/tests/Forms/Controls.CsrfProtection.phpt
@@ -27,7 +27,7 @@ Assert::match('', (string) $inpu
Assert::true($input->getOption('rendered'));
Assert::same('hidden', $input->getOption('type'));
-$input->setValue(NULL);
+$input->setValue(null);
Assert::false(CsrfProtection::validateCsrf($input));
call_user_func([$input, 'Nette\Forms\Controls\BaseControl::setValue'], '12345678901234567890123456789012345678');
diff --git a/tests/Forms/Controls.HiddenField.loadData.phpt b/tests/Forms/Controls.HiddenField.loadData.phpt
index 86779c090..ca3c8a6e7 100644
--- a/tests/Forms/Controls.HiddenField.loadData.phpt
+++ b/tests/Forms/Controls.HiddenField.loadData.phpt
@@ -35,7 +35,7 @@ test(function () {
test(function () { // invalid data
- $_POST = ['malformed' => [NULL]];
+ $_POST = ['malformed' => [null]];
$form = new Form;
$input = $form->addHidden('malformed');
Assert::same('', $input->getValue());
@@ -55,11 +55,11 @@ test(function () { // errors are moved to form
test(function () { // setValue() and invalid argument
$form = new Form;
$input = $form->addHidden('hidden');
- $input->setValue(NULL);
+ $input->setValue(null);
Assert::exception(function () use ($input) {
$input->setValue([]);
- }, Nette\InvalidArgumentException::class, "Value must be scalar or NULL, array given in field 'hidden'.");
+ }, Nette\InvalidArgumentException::class, "Value must be scalar or null, array given in field 'hidden'.");
});
diff --git a/tests/Forms/Controls.HiddenField.render.phpt b/tests/Forms/Controls.HiddenField.render.phpt
index ca1204473..e0cb362c0 100644
--- a/tests/Forms/Controls.HiddenField.render.phpt
+++ b/tests/Forms/Controls.HiddenField.render.phpt
@@ -14,7 +14,7 @@ require __DIR__ . '/../bootstrap.php';
class Translator implements Nette\Localization\ITranslator
{
- function translate($s, $plural = NULL)
+ function translate($s, $plural = null)
{
return strtoupper($s);
}
diff --git a/tests/Forms/Controls.ImageButton.loadData.phpt b/tests/Forms/Controls.ImageButton.loadData.phpt
index cb7fb24a6..bbceff44a 100644
--- a/tests/Forms/Controls.ImageButton.loadData.phpt
+++ b/tests/Forms/Controls.ImageButton.loadData.phpt
@@ -46,7 +46,7 @@ test(function () { // missing data
test(function () { // malformed data
$_POST = [
'malformed1' => [1],
- 'malformed2' => [[NULL]],
+ 'malformed2' => [[null]],
];
$form = new Form;
diff --git a/tests/Forms/Controls.ImageButton.render.phpt b/tests/Forms/Controls.ImageButton.render.phpt
index 92d5016ba..7451fe249 100644
--- a/tests/Forms/Controls.ImageButton.render.phpt
+++ b/tests/Forms/Controls.ImageButton.render.phpt
@@ -14,7 +14,7 @@ require __DIR__ . '/../bootstrap.php';
class Translator implements Nette\Localization\ITranslator
{
- function translate($s, $plural = NULL)
+ function translate($s, $plural = null)
{
return strtoupper($s);
}
diff --git a/tests/Forms/Controls.MultiChoiceControl.loadData.phpt b/tests/Forms/Controls.MultiChoiceControl.loadData.phpt
index 3ea783697..730093417 100644
--- a/tests/Forms/Controls.MultiChoiceControl.loadData.phpt
+++ b/tests/Forms/Controls.MultiChoiceControl.loadData.phpt
@@ -36,7 +36,7 @@ test(function () use ($series) { // invalid input
$_POST = ['select' => 'red-dwarf'];
$form = new Form;
- $input = $form['select'] = new MultiChoiceControl(NULL, $series);
+ $input = $form['select'] = new MultiChoiceControl(null, $series);
Assert::true($form->isValid());
Assert::same([], $input->getValue());
@@ -49,7 +49,7 @@ test(function () use ($series) { // multiple selected items, zero item
$_POST = ['multi' => ['red-dwarf', 'unknown', 0]];
$form = new Form;
- $input = $form['multi'] = new MultiChoiceControl(NULL, $series);
+ $input = $form['multi'] = new MultiChoiceControl(null, $series);
Assert::true($form->isValid());
Assert::same(['red-dwarf', 0], $input->getValue());
@@ -63,7 +63,7 @@ test(function () use ($series) { // empty key
$_POST = ['empty' => ['']];
$form = new Form;
- $input = $form['empty'] = new MultiChoiceControl(NULL, $series);
+ $input = $form['empty'] = new MultiChoiceControl(null, $series);
Assert::true($form->isValid());
Assert::same([''], $input->getValue());
@@ -74,7 +74,7 @@ test(function () use ($series) { // empty key
test(function () use ($series) { // missing key
$form = new Form;
- $input = $form['missing'] = new MultiChoiceControl(NULL, $series);
+ $input = $form['missing'] = new MultiChoiceControl(null, $series);
Assert::true($form->isValid());
Assert::same([], $input->getValue());
@@ -87,7 +87,7 @@ test(function () use ($series) { // disabled key
$_POST = ['disabled' => 'red-dwarf'];
$form = new Form;
- $input = $form['disabled'] = new MultiChoiceControl(NULL, $series);
+ $input = $form['disabled'] = new MultiChoiceControl(null, $series);
$input->setDisabled();
Assert::true($form->isValid());
@@ -96,10 +96,10 @@ test(function () use ($series) { // disabled key
test(function () use ($series) { // malformed data
- $_POST = ['malformed' => [[NULL]]];
+ $_POST = ['malformed' => [[null]]];
$form = new Form;
- $input = $form['malformed'] = new MultiChoiceControl(NULL, $series);
+ $input = $form['malformed'] = new MultiChoiceControl(null, $series);
Assert::true($form->isValid());
Assert::same([], $input->getValue());
@@ -113,7 +113,7 @@ test(function () use ($series) { // setItems without keys
$form = new Form;
$input = $form['multi'] = new MultiChoiceControl;
- $input->setItems(array_keys($series), FALSE);
+ $input->setItems(array_keys($series), false);
Assert::same([
'red-dwarf' => 'red-dwarf',
'the-simpsons' => 'the-simpsons',
@@ -132,7 +132,7 @@ test(function () use ($series) { // validateLength
$_POST = ['multi' => ['red-dwarf', 'unknown', 0]];
$form = new Form;
- $input = $form['multi'] = new MultiChoiceControl(NULL, $series);
+ $input = $form['multi'] = new MultiChoiceControl(null, $series);
Assert::true(Validator::validateLength($input, 2));
Assert::false(Validator::validateLength($input, 3));
@@ -145,7 +145,7 @@ test(function () use ($series) { // validateEqual
$_POST = ['multi' => ['red-dwarf', 'unknown', 0]];
$form = new Form;
- $input = $form['multi'] = new MultiChoiceControl(NULL, $series);
+ $input = $form['multi'] = new MultiChoiceControl(null, $series);
Assert::true(Validator::validateEqual($input, ['red-dwarf', 0]));
Assert::false(Validator::validateEqual($input, 'unknown'));
@@ -156,8 +156,8 @@ test(function () use ($series) { // validateEqual
test(function () use ($series) { // setValue() and invalid argument
$form = new Form;
- $input = $form['select'] = new MultiChoiceControl(NULL, $series);
- $input->setValue(NULL);
+ $input = $form['select'] = new MultiChoiceControl(null, $series);
+ $input->setValue(null);
Assert::exception(function () use ($input) {
$input->setValue('unknown');
@@ -165,7 +165,7 @@ test(function () use ($series) { // setValue() and invalid argument
Assert::exception(function () use ($input) {
$input->setValue(new stdClass);
- }, Nette\InvalidArgumentException::class, "Value must be array or NULL, object given in field 'select'.");
+ }, Nette\InvalidArgumentException::class, "Value must be array or null, object given in field 'select'.");
Assert::exception(function () use ($input) {
$input->setValue([new stdClass]);
@@ -175,14 +175,14 @@ test(function () use ($series) { // setValue() and invalid argument
test(function () use ($series) { // setValue() and disabled $checkAllowedValues
$form = new Form;
- $input = $form['select'] = new MultiChoiceControl(NULL, $series);
- $input->checkAllowedValues = FALSE;
+ $input = $form['select'] = new MultiChoiceControl(null, $series);
+ $input->checkAllowedValues = false;
$input->setValue('unknown');
Assert::same([], $input->getValue());
Assert::exception(function () use ($input) {
$input->setValue(new stdClass);
- }, Nette\InvalidArgumentException::class, "Value must be array or NULL, object given in field 'select'.");
+ }, Nette\InvalidArgumentException::class, "Value must be array or null, object given in field 'select'.");
Assert::exception(function () use ($input) {
$input->setValue([new stdClass]);
@@ -192,7 +192,7 @@ test(function () use ($series) { // setValue() and disabled $checkAllowedValues
test(function () { // object as value
$form = new Form;
- $input = $form['select'] = new MultiChoiceControl(NULL, ['2013-07-05 00:00:00' => 1]);
+ $input = $form['select'] = new MultiChoiceControl(null, ['2013-07-05 00:00:00' => 1]);
$input->setValue([new DateTime('2013-07-05')]);
Assert::same(['2013-07-05 00:00:00'], $input->getValue());
@@ -203,13 +203,13 @@ test(function () use ($series) { // disabled one
$_POST = ['select' => ['red-dwarf', 0]];
$form = new Form;
- $input = $form['select'] = new MultiChoiceControl(NULL, $series);
+ $input = $form['select'] = new MultiChoiceControl(null, $series);
$input->setDisabled(['red-dwarf']);
Assert::same([0], $input->getValue());
unset($form['select']);
- $input = new Nette\Forms\Controls\MultiSelectBox(NULL, $series);
+ $input = new Nette\Forms\Controls\MultiSelectBox(null, $series);
$input->setDisabled(['red-dwarf']);
$form['select'] = $input;
diff --git a/tests/Forms/Controls.MultiSelectBox.loadData.phpt b/tests/Forms/Controls.MultiSelectBox.loadData.phpt
index b868ddd7d..dd0398906 100644
--- a/tests/Forms/Controls.MultiSelectBox.loadData.phpt
+++ b/tests/Forms/Controls.MultiSelectBox.loadData.phpt
@@ -31,7 +31,7 @@ test(function () use ($series) { // Select with optgroups
$_POST = ['multi' => ['red-dwarf']];
$form = new Form;
- $input = $form->addMultiSelect('multi', NULL, [
+ $input = $form->addMultiSelect('multi', null, [
'usa' => [
'the-simpsons' => 'The Simpsons',
0 => 'South Park',
@@ -52,7 +52,7 @@ test(function () use ($series) { // invalid input
$_POST = ['select' => 'red-dwarf'];
$form = new Form;
- $input = $form->addMultiSelect('select', NULL, $series);
+ $input = $form->addMultiSelect('select', null, $series);
Assert::true($form->isValid());
Assert::same([], $input->getValue());
@@ -65,7 +65,7 @@ test(function () use ($series) { // multiple selected items, zero item
$_POST = ['multi' => ['red-dwarf', 'unknown', 0]];
$form = new Form;
- $input = $form->addMultiSelect('multi', NULL, $series);
+ $input = $form->addMultiSelect('multi', null, $series);
Assert::true($form->isValid());
Assert::same(['red-dwarf', 0], $input->getValue());
@@ -79,7 +79,7 @@ test(function () use ($series) { // empty key
$_POST = ['empty' => ['']];
$form = new Form;
- $input = $form->addMultiSelect('empty', NULL, $series);
+ $input = $form->addMultiSelect('empty', null, $series);
Assert::true($form->isValid());
Assert::same([''], $input->getValue());
@@ -90,7 +90,7 @@ test(function () use ($series) { // empty key
test(function () use ($series) { // missing key
$form = new Form;
- $input = $form->addMultiSelect('missing', NULL, $series);
+ $input = $form->addMultiSelect('missing', null, $series);
Assert::true($form->isValid());
Assert::same([], $input->getValue());
@@ -103,7 +103,7 @@ test(function () use ($series) { // disabled key
$_POST = ['disabled' => 'red-dwarf'];
$form = new Form;
- $input = $form->addMultiSelect('disabled', NULL, $series)
+ $input = $form->addMultiSelect('disabled', null, $series)
->setDisabled();
Assert::true($form->isValid());
@@ -112,10 +112,10 @@ test(function () use ($series) { // disabled key
test(function () use ($series) { // malformed data
- $_POST = ['malformed' => [[NULL]]];
+ $_POST = ['malformed' => [[null]]];
$form = new Form;
- $input = $form->addMultiSelect('malformed', NULL, $series);
+ $input = $form->addMultiSelect('malformed', null, $series);
Assert::true($form->isValid());
Assert::same([], $input->getValue());
@@ -128,7 +128,7 @@ test(function () use ($series) { // validateLength
$_POST = ['multi' => ['red-dwarf', 'unknown', 0]];
$form = new Form;
- $input = $form->addMultiSelect('multi', NULL, $series);
+ $input = $form->addMultiSelect('multi', null, $series);
Assert::true(Validator::validateLength($input, 2));
Assert::false(Validator::validateLength($input, 3));
@@ -141,7 +141,7 @@ test(function () use ($series) { // validateEqual
$_POST = ['multi' => ['red-dwarf', 'unknown', 0]];
$form = new Form;
- $input = $form->addMultiSelect('multi', NULL, $series);
+ $input = $form->addMultiSelect('multi', null, $series);
Assert::true(Validator::validateEqual($input, ['red-dwarf', 0]));
Assert::false(Validator::validateEqual($input, 'unknown'));
@@ -154,7 +154,7 @@ test(function () use ($series) { // setItems without keys
$_POST = ['multi' => ['red-dwarf']];
$form = new Form;
- $input = $form->addMultiSelect('multi')->setItems(array_keys($series), FALSE);
+ $input = $form->addMultiSelect('multi')->setItems(array_keys($series), false);
Assert::same([
'red-dwarf' => 'red-dwarf',
'the-simpsons' => 'the-simpsons',
@@ -171,7 +171,7 @@ test(function () use ($series) { // setItems without keys
test(function () use ($series) { // setItems without keys
$form = new Form;
- $input = $form->addMultiSelect('select')->setItems(range(1, 5), FALSE);
+ $input = $form->addMultiSelect('select')->setItems(range(1, 5), false);
Assert::same([1 => 1, 2, 3, 4, 5], $input->getItems());
});
@@ -183,7 +183,7 @@ test(function () { // setItems without keys with optgroups
$input = $form->addMultiSelect('multi')->setItems([
'usa' => ['the-simpsons', 0],
'uk' => ['red-dwarf'],
- ], FALSE);
+ ], false);
Assert::true($form->isValid());
Assert::same(['red-dwarf'], $input->getValue());
@@ -194,8 +194,8 @@ test(function () { // setItems without keys with optgroups
test(function () use ($series) { // setValue() and invalid argument
$form = new Form;
- $input = $form->addMultiSelect('select', NULL, $series);
- $input->setValue(NULL);
+ $input = $form->addMultiSelect('select', null, $series);
+ $input->setValue(null);
Assert::exception(function () use ($input) {
$input->setValue('unknown');
@@ -205,7 +205,7 @@ test(function () use ($series) { // setValue() and invalid argument
test(function () { // object as value
$form = new Form;
- $input = $form->addMultiSelect('select', NULL, ['2013-07-05 00:00:00' => 1])
+ $input = $form->addMultiSelect('select', null, ['2013-07-05 00:00:00' => 1])
->setValue([new DateTime('2013-07-05')]);
Assert::same(['2013-07-05 00:00:00'], $input->getValue());
@@ -218,7 +218,7 @@ test(function () { // object as item
->setItems([
'group' => [new DateTime('2013-07-05')],
new DateTime('2013-07-06'),
- ], FALSE)
+ ], false)
->setValue('2013-07-05 00:00:00');
Assert::equal(['2013-07-05 00:00:00' => new DateTime('2013-07-05')], $input->getSelectedItems());
@@ -229,13 +229,13 @@ test(function () use ($series) { // disabled one
$_POST = ['select' => ['red-dwarf', 0]];
$form = new Form;
- $input = $form->addMultiSelect('select', NULL, $series)
+ $input = $form->addMultiSelect('select', null, $series)
->setDisabled(['red-dwarf']);
Assert::same([0], $input->getValue());
unset($form['select']);
- $input = new Nette\Forms\Controls\MultiSelectBox(NULL, $series);
+ $input = new Nette\Forms\Controls\MultiSelectBox(null, $series);
$input->setDisabled(['red-dwarf']);
$form['select'] = $input;
diff --git a/tests/Forms/Controls.MultiSelectBox.render.phpt b/tests/Forms/Controls.MultiSelectBox.render.phpt
index e2a7efe97..d60ce3631 100644
--- a/tests/Forms/Controls.MultiSelectBox.render.phpt
+++ b/tests/Forms/Controls.MultiSelectBox.render.phpt
@@ -14,7 +14,7 @@ require __DIR__ . '/../bootstrap.php';
class Translator implements Nette\Localization\ITranslator
{
- function translate($s, $plural = NULL)
+ function translate($s, $plural = null)
{
return strtoupper($s);
}
@@ -115,7 +115,7 @@ test(function () { // disabled all
$input = $form->addMultiSelect('list', 'Label', [
'a' => 'First',
0 => 'Second',
- ])->setDisabled(TRUE);
+ ])->setDisabled(true);
Assert::same('', (string) $input->getControl());
});
diff --git a/tests/Forms/Controls.RadioList.loadData.phpt b/tests/Forms/Controls.RadioList.loadData.phpt
index 36a8a078b..3fba57c82 100644
--- a/tests/Forms/Controls.RadioList.loadData.phpt
+++ b/tests/Forms/Controls.RadioList.loadData.phpt
@@ -30,7 +30,7 @@ test(function () use ($series) { // Radio list
$_POST = ['radio' => 'red-dwarf'];
$form = new Form;
- $input = $form->addRadioList('radio', NULL, $series);
+ $input = $form->addRadioList('radio', null, $series);
Assert::true($form->isValid());
Assert::same('red-dwarf', $input->getValue());
@@ -43,7 +43,7 @@ test(function () use ($series) { // Radio list with invalid input
$_POST = ['radio' => 'days-of-our-lives'];
$form = new Form;
- $input = $form->addRadioList('radio', NULL, $series);
+ $input = $form->addRadioList('radio', null, $series);
Assert::true($form->isValid());
Assert::null($input->getValue());
@@ -56,7 +56,7 @@ test(function () use ($series) { // Indexed arrays
$_POST = ['zero' => 0];
$form = new Form;
- $input = $form->addRadioList('zero', NULL, $series);
+ $input = $form->addRadioList('zero', null, $series);
Assert::true($form->isValid());
Assert::same(0, $input->getValue());
@@ -70,7 +70,7 @@ test(function () use ($series) { // empty key
$_POST = ['empty' => ''];
$form = new Form;
- $input = $form->addRadioList('empty', NULL, $series);
+ $input = $form->addRadioList('empty', null, $series);
Assert::true($form->isValid());
Assert::same('', $input->getValue());
@@ -81,7 +81,7 @@ test(function () use ($series) { // empty key
test(function () use ($series) { // missing key
$form = new Form;
- $input = $form->addRadioList('missing', NULL, $series);
+ $input = $form->addRadioList('missing', null, $series);
Assert::true($form->isValid());
Assert::null($input->getValue());
@@ -94,7 +94,7 @@ test(function () use ($series) { // disabled key
$_POST = ['disabled' => 'red-dwarf'];
$form = new Form;
- $input = $form->addRadioList('disabled', NULL, $series)
+ $input = $form->addRadioList('disabled', null, $series)
->setDisabled();
Assert::true($form->isValid());
@@ -104,10 +104,10 @@ test(function () use ($series) { // disabled key
test(function () use ($series) { // malformed data
- $_POST = ['malformed' => [NULL]];
+ $_POST = ['malformed' => [null]];
$form = new Form;
- $input = $form->addRadioList('malformed', NULL, $series);
+ $input = $form->addRadioList('malformed', null, $series);
Assert::true($form->isValid());
Assert::null($input->getValue());
@@ -120,7 +120,7 @@ test(function () use ($series) { // setItems without keys
$_POST = ['select' => 'red-dwarf'];
$form = new Form;
- $input = $form->addRadioList('select')->setItems(array_keys($series), FALSE);
+ $input = $form->addRadioList('select')->setItems(array_keys($series), false);
Assert::true($form->isValid());
Assert::same('red-dwarf', $input->getValue());
@@ -131,8 +131,8 @@ test(function () use ($series) { // setItems without keys
test(function () use ($series) { // setValue() and invalid argument
$form = new Form;
- $input = $form->addRadioList('radio', NULL, $series);
- $input->setValue(NULL);
+ $input = $form->addRadioList('radio', null, $series);
+ $input->setValue(null);
Assert::exception(function () use ($input) {
$input->setValue('unknown');
@@ -142,7 +142,7 @@ test(function () use ($series) { // setValue() and invalid argument
test(function () { // object as value
$form = new Form;
- $input = $form->addRadioList('radio', NULL, ['2013-07-05 00:00:00' => 1])
+ $input = $form->addRadioList('radio', null, ['2013-07-05 00:00:00' => 1])
->setValue(new DateTime('2013-07-05'));
Assert::same('2013-07-05 00:00:00', $input->getValue());
@@ -152,7 +152,7 @@ test(function () { // object as value
test(function () { // object as item
$form = new Form;
$input = $form->addRadioList('radio')
- ->setItems([new DateTime('2013-07-05')], FALSE)
+ ->setItems([new DateTime('2013-07-05')], false)
->setValue(new DateTime('2013-07-05'));
Assert::same('2013-07-05 00:00:00', $input->getValue());
@@ -163,13 +163,13 @@ test(function () use ($series) { // disabled one
$_POST = ['radio' => 'red-dwarf'];
$form = new Form;
- $input = $form->addRadioList('radio', NULL, $series)
+ $input = $form->addRadioList('radio', null, $series)
->setDisabled(['red-dwarf']);
Assert::null($input->getValue());
unset($form['radio']);
- $input = new Nette\Forms\Controls\RadioList(NULL, $series);
+ $input = new Nette\Forms\Controls\RadioList(null, $series);
$input->setDisabled(['red-dwarf']);
$form['radio'] = $input;
diff --git a/tests/Forms/Controls.RadioList.render.phpt b/tests/Forms/Controls.RadioList.render.phpt
index 6a34aa0d9..352ac30a4 100644
--- a/tests/Forms/Controls.RadioList.render.phpt
+++ b/tests/Forms/Controls.RadioList.render.phpt
@@ -14,7 +14,7 @@ require __DIR__ . '/../bootstrap.php';
class Translator implements Nette\Localization\ITranslator
{
- function translate($s, $plural = NULL)
+ function translate($s, $plural = null)
{
return strtoupper($s);
}
@@ -112,7 +112,7 @@ test(function () { // container
test(function () { // container prototype
$form = new Form;
- $input = $form->addRadioList('list', NULL, [
+ $input = $form->addRadioList('list', null, [
'a' => 'b',
]);
$input->getSeparatorPrototype()->setName('hr');
@@ -127,7 +127,7 @@ test(function () { // disabled all
$input = $form->addRadioList('list', 'Label', [
'a' => 'First',
0 => 'Second',
- ])->setDisabled(TRUE);
+ ])->setDisabled(true);
Assert::same('
', (string) $input->getControl());
});
@@ -147,7 +147,7 @@ test(function () { // disabled one
test(function () { // item label prototype
$form = new Form;
- $input = $form->addRadioList('list', NULL, [
+ $input = $form->addRadioList('list', null, [
'a' => 'b',
]);
$input->getItemLabelPrototype()->class('foo');
@@ -164,7 +164,7 @@ test(function () { // forced ID
'a' => 'First',
0 => 'Second',
]);
- $input->generateId = TRUE;
+ $input->generateId = true;
Assert::same('
', (string) $input->getControl());
});
diff --git a/tests/Forms/Controls.SelectBox.isOk.phpt b/tests/Forms/Controls.SelectBox.isOk.phpt
index 0018c837f..eae9eeca7 100644
--- a/tests/Forms/Controls.SelectBox.isOk.phpt
+++ b/tests/Forms/Controls.SelectBox.isOk.phpt
@@ -13,21 +13,21 @@ require __DIR__ . '/../bootstrap.php';
$form = new Form;
-$select = $form->addSelect('foo', NULL, ['bar' => 'Bar']);
+$select = $form->addSelect('foo', null, ['bar' => 'Bar']);
Assert::false($select->isOk());
-$select->setDisabled(TRUE);
+$select->setDisabled(true);
Assert::true($select->isOk());
-$select->setDisabled(FALSE);
+$select->setDisabled(false);
$select->setPrompt('Empty');
Assert::true($select->isOk());
-$select->setPrompt(FALSE);
+$select->setPrompt(false);
$select->setValue('bar');
Assert::true($select->isOk());
-$select->setValue(NULL);
+$select->setValue(null);
$select->setItems([]);
Assert::true($select->isOk());
diff --git a/tests/Forms/Controls.SelectBox.loadData.phpt b/tests/Forms/Controls.SelectBox.loadData.phpt
index 8fcf0e7ec..13b6ad3bb 100644
--- a/tests/Forms/Controls.SelectBox.loadData.phpt
+++ b/tests/Forms/Controls.SelectBox.loadData.phpt
@@ -30,7 +30,7 @@ test(function () use ($series) { // Select
$_POST = ['select' => 'red-dwarf'];
$form = new Form;
- $input = $form->addSelect('select', NULL, $series);
+ $input = $form->addSelect('select', null, $series);
Assert::true($form->isValid());
Assert::same('red-dwarf', $input->getValue());
@@ -46,8 +46,8 @@ test(function () { // Empty select
$input = $form->addSelect('select');
Assert::true($form->isValid());
- Assert::same(NULL, $input->getValue());
- Assert::same(NULL, $input->getSelectedItem());
+ Assert::same(null, $input->getValue());
+ Assert::same(null, $input->getSelectedItem());
Assert::false($input->isFilled());
});
@@ -56,7 +56,7 @@ test(function () use ($series) { // Select with prompt
$_POST = ['select' => 'red-dwarf'];
$form = new Form;
- $input = $form->addSelect('select', NULL, $series)->setPrompt('Select series');
+ $input = $form->addSelect('select', null, $series)->setPrompt('Select series');
Assert::true($form->isValid());
Assert::same('red-dwarf', $input->getValue());
@@ -67,12 +67,12 @@ test(function () use ($series) { // Select with prompt
test(function () use ($series) { // Select with more visible options and no input
$form = new Form;
- $input = $form->addSelect('select', NULL, $series);
+ $input = $form->addSelect('select', null, $series);
$input->getControlPrototype()->size = 2;
Assert::true($form->isValid());
- Assert::same(NULL, $input->getValue());
- Assert::same(NULL, $input->getSelectedItem());
+ Assert::same(null, $input->getValue());
+ Assert::same(null, $input->getSelectedItem());
Assert::false($input->isFilled());
});
@@ -81,7 +81,7 @@ test(function () { // Select with optgroups
$_POST = ['select' => 'red-dwarf'];
$form = new Form;
- $input = $form->addSelect('select', NULL, [
+ $input = $form->addSelect('select', null, [
'usa' => [
'the-simpsons' => 'The Simpsons',
0 => 'South Park',
@@ -102,7 +102,7 @@ test(function () use ($series) { // Select with invalid input
$_POST = ['select' => 'days-of-our-lives'];
$form = new Form;
- $input = $form->addSelect('select', NULL, $series);
+ $input = $form->addSelect('select', null, $series);
Assert::false($form->isValid());
Assert::null($input->getValue());
@@ -113,7 +113,7 @@ test(function () use ($series) { // Select with invalid input
test(function () use ($series) { // Select with prompt and invalid input
$form = new Form;
- $input = $form->addSelect('select', NULL, $series)->setPrompt('Select series');
+ $input = $form->addSelect('select', null, $series)->setPrompt('Select series');
Assert::true($form->isValid());
Assert::null($input->getValue());
@@ -126,7 +126,7 @@ test(function () use ($series) { // Indexed arrays
$_POST = ['zero' => 0];
$form = new Form;
- $input = $form->addSelect('zero', NULL, $series);
+ $input = $form->addSelect('zero', null, $series);
Assert::true($form->isValid());
Assert::same(0, $input->getValue());
@@ -140,7 +140,7 @@ test(function () use ($series) { // empty key
$_POST = ['empty' => ''];
$form = new Form;
- $input = $form->addSelect('empty', NULL, $series);
+ $input = $form->addSelect('empty', null, $series);
Assert::true($form->isValid());
Assert::same('', $input->getValue());
@@ -151,7 +151,7 @@ test(function () use ($series) { // empty key
test(function () use ($series) { // missing key
$form = new Form;
- $input = $form->addSelect('missing', NULL, $series);
+ $input = $form->addSelect('missing', null, $series);
Assert::false($form->isValid());
Assert::null($input->getValue());
@@ -164,7 +164,7 @@ test(function () use ($series) { // disabled key
$_POST = ['disabled' => 'red-dwarf'];
$form = new Form;
- $input = $form->addSelect('disabled', NULL, $series)
+ $input = $form->addSelect('disabled', null, $series)
->setDisabled();
Assert::true($form->isValid());
@@ -173,10 +173,10 @@ test(function () use ($series) { // disabled key
test(function () use ($series) { // malformed data
- $_POST = ['malformed' => [NULL]];
+ $_POST = ['malformed' => [null]];
$form = new Form;
- $input = $form->addSelect('malformed', NULL, $series);
+ $input = $form->addSelect('malformed', null, $series);
Assert::false($form->isValid());
Assert::null($input->getValue());
@@ -189,7 +189,7 @@ test(function () use ($series) { // setItems without keys
$_POST = ['select' => 'red-dwarf'];
$form = new Form;
- $input = $form->addSelect('select')->setItems(array_keys($series), FALSE);
+ $input = $form->addSelect('select')->setItems(array_keys($series), false);
Assert::same([
'red-dwarf' => 'red-dwarf',
'the-simpsons' => 'the-simpsons',
@@ -206,7 +206,7 @@ test(function () use ($series) { // setItems without keys
test(function () { // setItems without keys
$form = new Form;
- $input = $form->addSelect('select')->setItems(range(1, 5), FALSE);
+ $input = $form->addSelect('select')->setItems(range(1, 5), false);
Assert::same([1 => 1, 2, 3, 4, 5], $input->getItems());
});
@@ -218,7 +218,7 @@ test(function () { // setItems without keys with optgroups
$input = $form->addSelect('select')->setItems([
'usa' => ['the-simpsons', 0],
'uk' => ['red-dwarf'],
- ], FALSE);
+ ], false);
Assert::true($form->isValid());
Assert::same('red-dwarf', $input->getValue());
@@ -229,8 +229,8 @@ test(function () { // setItems without keys with optgroups
test(function () use ($series) { // setValue() and invalid argument
$form = new Form;
- $input = $form->addSelect('select', NULL, $series);
- $input->setValue(NULL);
+ $input = $form->addSelect('select', null, $series);
+ $input->setValue(null);
Assert::exception(function () use ($input) {
$input->setValue('unknown');
@@ -240,7 +240,7 @@ test(function () use ($series) { // setValue() and invalid argument
test(function () { // object as value
$form = new Form;
- $input = $form->addSelect('select', NULL, ['2013-07-05 00:00:00' => 1])
+ $input = $form->addSelect('select', null, ['2013-07-05 00:00:00' => 1])
->setValue(new DateTime('2013-07-05'));
Assert::same('2013-07-05 00:00:00', $input->getValue());
@@ -253,7 +253,7 @@ test(function () { // object as item
->setItems([
'group' => [new DateTime('2013-07-05')],
new DateTime('2013-07-06'),
- ], FALSE)
+ ], false)
->setValue('2013-07-05 00:00:00');
Assert::equal(new DateTime('2013-07-05'), $input->getSelectedItem());
@@ -264,13 +264,13 @@ test(function () use ($series) { // disabled one
$_POST = ['select' => 'red-dwarf'];
$form = new Form;
- $input = $form->addSelect('select', NULL, $series)
+ $input = $form->addSelect('select', null, $series)
->setDisabled(['red-dwarf']);
Assert::null($input->getValue());
unset($form['select']);
- $input = new Nette\Forms\Controls\SelectBox(NULL, $series);
+ $input = new Nette\Forms\Controls\SelectBox(null, $series);
$input->setDisabled(['red-dwarf']);
$form['select'] = $input;
@@ -281,8 +281,8 @@ test(function () {
$_POST = ['select' => 1];
$form = new Form;
- $input = $form->addSelect('select', NULL, [
- 1 => NULL,
+ $input = $form->addSelect('select', null, [
+ 1 => null,
2 => 'Red dwarf',
]);
diff --git a/tests/Forms/Controls.SelectBox.render.phpt b/tests/Forms/Controls.SelectBox.render.phpt
index 3fee947d4..4c784ddde 100644
--- a/tests/Forms/Controls.SelectBox.render.phpt
+++ b/tests/Forms/Controls.SelectBox.render.phpt
@@ -14,7 +14,7 @@ require __DIR__ . '/../bootstrap.php';
class Translator implements Nette\Localization\ITranslator
{
- function translate($s, $plural = NULL)
+ function translate($s, $plural = null)
{
return strtoupper($s);
}
@@ -115,7 +115,7 @@ test(function () { // disabled all
$input = $form->addSelect('list', 'Label', [
'a' => 'First',
0 => 'Second',
- ])->setDisabled(TRUE);
+ ])->setDisabled(true);
Assert::same('', (string) $input->getControl());
});
diff --git a/tests/Forms/Controls.TextArea.render.phpt b/tests/Forms/Controls.TextArea.render.phpt
index c36980094..e6b38cb3a 100644
--- a/tests/Forms/Controls.TextArea.render.phpt
+++ b/tests/Forms/Controls.TextArea.render.phpt
@@ -14,7 +14,7 @@ require __DIR__ . '/../bootstrap.php';
class Translator implements Nette\Localization\ITranslator
{
- function translate($s, $plural = NULL)
+ function translate($s, $plural = null)
{
return strtoupper($s);
}
@@ -62,7 +62,7 @@ test(function () { // Html with translator
test(function () { // validation rule LENGTH
$form = new Form;
$input = $form->addTextArea('text')
- ->addRule($form::LENGTH, NULL, [10, 20]);
+ ->addRule($form::LENGTH, null, [10, 20]);
Assert::same('', (string) $input->getControl());
});
@@ -71,8 +71,8 @@ test(function () { // validation rule LENGTH
test(function () { // validation rule MAX_LENGTH
$form = new Form;
$input = $form->addTextArea('text')
- ->addRule($form::MAX_LENGTH, NULL, 30)
- ->addRule($form::MAX_LENGTH, NULL, 10);
+ ->addRule($form::MAX_LENGTH, null, 30)
+ ->addRule($form::MAX_LENGTH, null, 10);
Assert::same('', (string) $input->getControl());
});
diff --git a/tests/Forms/Controls.TextBase.loadData.phpt b/tests/Forms/Controls.TextBase.loadData.phpt
index b5a77a420..4eddb8372 100644
--- a/tests/Forms/Controls.TextBase.loadData.phpt
+++ b/tests/Forms/Controls.TextBase.loadData.phpt
@@ -79,7 +79,7 @@ test(function () { // missing data
test(function () { // malformed data
- $_POST = ['malformed' => [NULL]];
+ $_POST = ['malformed' => [null]];
$form = new Form;
$input = $form->addText('malformed');
@@ -94,11 +94,11 @@ test(function () { // setValue() and invalid argument
$form = new Form;
$input = $form->addText('text');
- $input->setValue(NULL);
+ $input->setValue(null);
Assert::exception(function () use ($input) {
$input->setValue([]);
- }, Nette\InvalidArgumentException::class, "Value must be scalar or NULL, array given in field 'text'.");
+ }, Nette\InvalidArgumentException::class, "Value must be scalar or null, array given in field 'text'.");
});
diff --git a/tests/Forms/Controls.TextInput.render.phpt b/tests/Forms/Controls.TextInput.render.phpt
index aa0e80d4c..039c2c28e 100644
--- a/tests/Forms/Controls.TextInput.render.phpt
+++ b/tests/Forms/Controls.TextInput.render.phpt
@@ -14,7 +14,7 @@ require __DIR__ . '/../bootstrap.php';
class Translator implements Nette\Localization\ITranslator
{
- function translate($s, $plural = NULL)
+ function translate($s, $plural = null)
{
return strtoupper($s);
}
@@ -110,7 +110,7 @@ test(function () { // validation rule LENGTH
$form = new Form;
$input = $form->addText('text')
->setMaxLength(30)
- ->addRule($form::LENGTH, NULL, [10, 20]);
+ ->addRule($form::LENGTH, null, [10, 20]);
Assert::same('', (string) $input->getControl());
});
@@ -118,8 +118,8 @@ test(function () { // validation rule LENGTH
test(function () { // validation rule MAX_LENGTH
$form = new Form;
- $input = $form->addText('text', NULL, NULL, 30)
- ->addRule($form::MAX_LENGTH, NULL, 10);
+ $input = $form->addText('text', null, null, 30)
+ ->addRule($form::MAX_LENGTH, null, 10);
Assert::same('', (string) $input->getControl());
});
diff --git a/tests/Forms/Controls.UploadControl.loadData.phpt b/tests/Forms/Controls.UploadControl.loadData.phpt
index 5c9edcf6b..c271cf475 100644
--- a/tests/Forms/Controls.UploadControl.loadData.phpt
+++ b/tests/Forms/Controls.UploadControl.loadData.phpt
@@ -45,11 +45,11 @@ $_FILES = [
'size' => [0],
],
'invalid1' => [
- 'name' => [NULL],
- 'type' => [NULL],
- 'tmp_name' => [NULL],
- 'error' => [NULL],
- 'size' => [NULL],
+ 'name' => [null],
+ 'type' => [null],
+ 'tmp_name' => [null],
+ 'error' => [null],
+ 'size' => [null],
],
'invalid2' => '',
'partial' => [
@@ -199,7 +199,7 @@ test(function () { // partial uploaded (error)
test(function () { // validators
$form = new Form;
$input = $form->addUpload('avatar')
- ->addRule($form::MAX_FILE_SIZE, NULL, 3000);
+ ->addRule($form::MAX_FILE_SIZE, null, 3000);
Assert::false(Validator::validateFileSize($input, 3012));
Assert::true(Validator::validateFileSize($input, 3013));
@@ -218,7 +218,7 @@ test(function () { // validators
test(function () { // validators on multiple files
$form = new Form;
$input = $form->addContainer('multiple')->addMultiUpload('avatar')
- ->addRule($form::MAX_FILE_SIZE, NULL, 3000);
+ ->addRule($form::MAX_FILE_SIZE, null, 3000);
Assert::false(Validator::validateFileSize($input, 150));
Assert::true(Validator::validateFileSize($input, 300));
diff --git a/tests/Forms/Controls.UploadControl.render.phpt b/tests/Forms/Controls.UploadControl.render.phpt
index 67b6731f7..d7f34b312 100644
--- a/tests/Forms/Controls.UploadControl.render.phpt
+++ b/tests/Forms/Controls.UploadControl.render.phpt
@@ -14,7 +14,7 @@ require __DIR__ . '/../bootstrap.php';
class Translator implements Nette\Localization\ITranslator
{
- function translate($s, $plural = NULL)
+ function translate($s, $plural = null)
{
return strtoupper($s);
}
@@ -36,7 +36,7 @@ test(function () {
test(function () { // multiple
$form = new Form;
- $input = $form->addUpload('file', 'Label', TRUE);
+ $input = $form->addUpload('file', 'Label', true);
Assert::same('', (string) $input->getControl());
});
diff --git a/tests/Forms/Controls.translate().phpt b/tests/Forms/Controls.translate().phpt
index 10393666f..60cb7a878 100644
--- a/tests/Forms/Controls.translate().phpt
+++ b/tests/Forms/Controls.translate().phpt
@@ -13,7 +13,7 @@ require __DIR__ . '/../bootstrap.php';
class Translator implements \Nette\Localization\ITranslator
{
- function translate($message, $count = NULL)
+ function translate($message, $count = null)
{
return is_object($message) ? get_class($message) : $message;
}
diff --git a/tests/Forms/Forms.callbackParameters.phpt b/tests/Forms/Forms.callbackParameters.phpt
index b0e78c2d2..b311cdc19 100644
--- a/tests/Forms/Forms.callbackParameters.phpt
+++ b/tests/Forms/Forms.callbackParameters.phpt
@@ -59,5 +59,5 @@ $form->onValidate = [$f1, $f2, $f1, $f4, $f5];
$form['btn']->onClick = [$b1, $b2, $b1, $f4, $f5];
$form->fireEvents();
-Assert::same([TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE], $types);
-Assert::same([TRUE, TRUE, TRUE], $arrayHashIsImmutable);
+Assert::same([true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true], $types);
+Assert::same([true, true, true], $arrayHashIsImmutable);
diff --git a/tests/Forms/Forms.getHttpData.get.2.phpt b/tests/Forms/Forms.getHttpData.get.2.phpt
index 16dcec2f6..b589be865 100644
--- a/tests/Forms/Forms.getHttpData.get.2.phpt
+++ b/tests/Forms/Forms.getHttpData.get.2.phpt
@@ -27,5 +27,5 @@ test(function () {
Assert::truthy($form->isSubmitted());
Assert::same(['item'], $form->getHttpData());
- Assert::same([], $form->getValues(TRUE));
+ Assert::same([], $form->getValues(true));
});
diff --git a/tests/Forms/Forms.getHttpData.get.phpt b/tests/Forms/Forms.getHttpData.get.phpt
index 97935e23a..776c7482b 100644
--- a/tests/Forms/Forms.getHttpData.get.phpt
+++ b/tests/Forms/Forms.getHttpData.get.phpt
@@ -25,7 +25,7 @@ test(function () {
Assert::false($form->isSubmitted());
Assert::false($form->isSuccess());
Assert::same([], $form->getHttpData());
- Assert::same([], $form->getValues(TRUE));
+ Assert::same([], $form->getValues(true));
});
@@ -35,7 +35,7 @@ test(function () {
Assert::false($form->isSubmitted());
Assert::same([], $form->getHttpData());
- Assert::same([], $form->getValues(TRUE));
+ Assert::same([], $form->getValues(true));
});
@@ -50,6 +50,6 @@ test(function () {
Assert::truthy($form->isSubmitted());
Assert::same([Form::TRACKER_ID => $name], $form->getHttpData());
- Assert::same([], $form->getValues(TRUE));
+ Assert::same([], $form->getValues(true));
Assert::same($name, $form[Form::TRACKER_ID]->getValue());
});
diff --git a/tests/Forms/Forms.getHttpData.post.phpt b/tests/Forms/Forms.getHttpData.post.phpt
index 7193480be..39ff8b5cc 100644
--- a/tests/Forms/Forms.getHttpData.post.phpt
+++ b/tests/Forms/Forms.getHttpData.post.phpt
@@ -25,7 +25,7 @@ test(function () {
Assert::truthy($form->isSubmitted());
Assert::true($form->isSuccess());
Assert::same([], $form->getHttpData());
- Assert::same([], $form->getValues(TRUE));
+ Assert::same([], $form->getValues(true));
});
@@ -37,7 +37,7 @@ test(function () {
Assert::false($form->isSubmitted());
Assert::false($form->isSuccess());
Assert::same([], $form->getHttpData());
- Assert::same([], $form->getValues(TRUE));
+ Assert::same([], $form->getValues(true));
});
@@ -50,7 +50,7 @@ test(function () {
Assert::truthy($form->isSubmitted());
Assert::same([Form::TRACKER_ID => $name], $form->getHttpData());
- Assert::same([], $form->getValues(TRUE));
+ Assert::same([], $form->getValues(true));
Assert::same($name, $form[Form::TRACKER_ID]->getValue());
});
diff --git a/tests/Forms/Forms.omittedValue.phpt b/tests/Forms/Forms.omittedValue.phpt
index eb846aa80..edad6816f 100644
--- a/tests/Forms/Forms.omittedValue.phpt
+++ b/tests/Forms/Forms.omittedValue.phpt
@@ -18,9 +18,9 @@ $form->addText('input');
$form->addText('omittedInput')
->setOmitted();
-Assert::same(['input' => ''], $form->getValues(TRUE));
+Assert::same(['input' => ''], $form->getValues(true));
Assert::true((new TextInput)->setDisabled()->isOmitted());
-Assert::false((new TextInput)->setDisabled()->setDisabled(FALSE)->isOmitted());
-Assert::false((new TextInput)->setDisabled()->setOmitted(FALSE)->isOmitted());
+Assert::false((new TextInput)->setDisabled()->setDisabled(false)->isOmitted());
+Assert::false((new TextInput)->setDisabled()->setOmitted(false)->isOmitted());
diff --git a/tests/Forms/Forms.onClick.phpt b/tests/Forms/Forms.onClick.phpt
index 8a2dbc9d2..1a25f37fa 100644
--- a/tests/Forms/Forms.onClick.phpt
+++ b/tests/Forms/Forms.onClick.phpt
@@ -69,6 +69,6 @@ test(function () { // invalid
Assert::exception(function () {
$form = new Form;
- $form->addSubmit('btn')->onClick = TRUE;
+ $form->addSubmit('btn')->onClick = true;
$form->fireEvents();
}, Nette\UnexpectedValueException::class, "Property \$onClick in button 'btn' must be iterable, boolean given.");
diff --git a/tests/Forms/Forms.onSuccess.phpt b/tests/Forms/Forms.onSuccess.phpt
index 6c9ed8797..c2a76f4c0 100644
--- a/tests/Forms/Forms.onSuccess.phpt
+++ b/tests/Forms/Forms.onSuccess.phpt
@@ -87,6 +87,6 @@ test(function () { // invalid
Assert::exception(function () {
$form = new Form;
- $form->onSuccess = TRUE;
+ $form->onSuccess = true;
$form->fireEvents();
}, Nette\UnexpectedValueException::class, 'Property Form::$onSuccess must be array or Traversable, boolean given.');
diff --git a/tests/Forms/Forms.renderer.1.phpt b/tests/Forms/Forms.renderer.1.phpt
index 1a35deeb5..7827c8518 100644
--- a/tests/Forms/Forms.renderer.1.phpt
+++ b/tests/Forms/Forms.renderer.1.phpt
@@ -54,10 +54,10 @@ $form->addEmail('email', 'Email:')
$form->addGroup('Shipping address')
- ->setOption('embedNext', TRUE);
+ ->setOption('embedNext', true);
$form->addCheckbox('send', 'Ship to address')
- ->addCondition(Form::EQUAL, FALSE)
+ ->addCondition(Form::EQUAL, false)
->elseCondition()
->toggle('sendBox');
@@ -68,12 +68,12 @@ $form->addGroup()
$form->addText('street', 'Street:');
$form->addText('city', 'City:')
- ->addConditionOn($form['send'], Form::EQUAL, TRUE)
+ ->addConditionOn($form['send'], Form::EQUAL, true)
->addRule(Form::FILLED, 'Enter your shipping address');
$form->addSelect('country', 'Country:', $countries)
->setPrompt('Select your country')
- ->addConditionOn($form['send'], Form::EQUAL, TRUE)
+ ->addConditionOn($form['send'], Form::EQUAL, true)
->addRule(Form::FILLED, 'Select your country');
$form->addSelect('countrySetItems', 'Country:')
@@ -119,4 +119,4 @@ $defaults = [
$form->setDefaults($defaults);
$form->fireEvents();
-Assert::matchFile(__DIR__ . '/Forms.renderer.1.expect', $form->__toString(TRUE));
+Assert::matchFile(__DIR__ . '/Forms.renderer.1.expect', $form->__toString(true));
diff --git a/tests/Forms/Forms.renderer.2.phpt b/tests/Forms/Forms.renderer.2.phpt
index 532b41396..2f69cc7ef 100644
--- a/tests/Forms/Forms.renderer.2.phpt
+++ b/tests/Forms/Forms.renderer.2.phpt
@@ -37,14 +37,14 @@ $form = new Form;
$renderer = $form->renderer;
$renderer->wrappers['form']['container'] = Html::el('div')->id('form');
-$renderer->wrappers['form']['errors'] = FALSE;
-$renderer->wrappers['group']['container'] = NULL;
+$renderer->wrappers['form']['errors'] = false;
+$renderer->wrappers['group']['container'] = null;
$renderer->wrappers['group']['label'] = 'h3';
-$renderer->wrappers['pair']['container'] = NULL;
+$renderer->wrappers['pair']['container'] = null;
$renderer->wrappers['controls']['container'] = 'dl';
$renderer->wrappers['control']['container'] = 'dd';
$renderer->wrappers['control']['.odd'] = 'odd';
-$renderer->wrappers['control']['errors'] = TRUE;
+$renderer->wrappers['control']['errors'] = true;
$renderer->wrappers['label']['container'] = 'dt';
$renderer->wrappers['label']['suffix'] = ':';
$renderer->wrappers['control']['requiredsuffix'] = " \xE2\x80\xA2";
@@ -68,10 +68,10 @@ $form->addText('email', 'Email')
$form->addGroup('Shipping address')
- ->setOption('embedNext', TRUE);
+ ->setOption('embedNext', true);
$form->addCheckbox('send', 'Ship to address')
- ->addCondition(Form::EQUAL, TRUE)
+ ->addCondition(Form::EQUAL, true)
->toggle('sendBox');
@@ -81,12 +81,12 @@ $form->addGroup()
$form->addText('street', 'Street');
$form->addText('city', 'City')
- ->addConditionOn($form['send'], Form::EQUAL, TRUE)
+ ->addConditionOn($form['send'], Form::EQUAL, true)
->addRule(Form::FILLED, 'Enter your shipping address');
$form->addSelect('country', 'Country', $countries)
->setPrompt('Select your country')
- ->addConditionOn($form['send'], Form::EQUAL, TRUE)
+ ->addConditionOn($form['send'], Form::EQUAL, true)
->addRule(Form::FILLED, 'Select your country');
@@ -123,4 +123,4 @@ $defaults = [
$form->setDefaults($defaults);
$form->fireEvents();
-Assert::matchFile(__DIR__ . '/Forms.renderer.2.expect', $form->__toString(TRUE));
+Assert::matchFile(__DIR__ . '/Forms.renderer.2.expect', $form->__toString(true));
diff --git a/tests/Forms/Forms.renderer.3.phpt b/tests/Forms/Forms.renderer.3.phpt
index adf1ddff0..86002900c 100644
--- a/tests/Forms/Forms.renderer.3.phpt
+++ b/tests/Forms/Forms.renderer.3.phpt
@@ -28,4 +28,4 @@ Assert::match('', $form->__toString(TRUE));
+', $form->__toString(true));
diff --git a/tests/Forms/Forms.renderer.4.phpt b/tests/Forms/Forms.renderer.4.phpt
index 3115cfa80..59e52a2be 100644
--- a/tests/Forms/Forms.renderer.4.phpt
+++ b/tests/Forms/Forms.renderer.4.phpt
@@ -29,6 +29,6 @@ Assert::match('', $form->__toString(TRUE));
+', $form->__toString(true));
Assert::same('link?a=b&c[]=d', $form->getAction());
diff --git a/tests/Forms/Forms.renderer.5.phpt b/tests/Forms/Forms.renderer.5.phpt
index 1e4685f0e..c240300e8 100644
--- a/tests/Forms/Forms.renderer.5.phpt
+++ b/tests/Forms/Forms.renderer.5.phpt
@@ -46,4 +46,4 @@ $form->addSubmit('submit', 'Order');
$form->fireEvents();
-Assert::matchFile(__DIR__ . '/Forms.renderer.5.expect', $form->__toString(TRUE));
+Assert::matchFile(__DIR__ . '/Forms.renderer.5.expect', $form->__toString(true));
diff --git a/tests/Forms/Forms.renderer.translate.phpt b/tests/Forms/Forms.renderer.translate.phpt
index 7f2e60be1..a26f323b5 100644
--- a/tests/Forms/Forms.renderer.translate.phpt
+++ b/tests/Forms/Forms.renderer.translate.phpt
@@ -15,7 +15,7 @@ require __DIR__ . '/../bootstrap.php';
class Translator implements ITranslator
{
- function translate($message, $count = NULL)
+ function translate($message, $count = null)
{
return strtoupper($message);
}
@@ -31,10 +31,10 @@ $form->addText('username', 'Username')
->setOption('description', 'or email')
->setRequired('Please enter your username');
$form->addPassword('password', 'Password')
- ->setRequired(TRUE)
+ ->setRequired(true)
->addRule(Form::MIN_LENGTH, 'Minimal length is %d chars', 8)
->addError('Weak password');
$form->addSubmit('submit', 'Send');
-Assert::matchFile(__DIR__ . '/Forms.renderer.translate.expect', $form->__toString(TRUE));
+Assert::matchFile(__DIR__ . '/Forms.renderer.translate.expect', $form->__toString(true));
diff --git a/tests/Forms/Forms.toggle.phpt b/tests/Forms/Forms.toggle.phpt
index 005905405..0f08d5974 100644
--- a/tests/Forms/Forms.toggle.phpt
+++ b/tests/Forms/Forms.toggle.phpt
@@ -22,8 +22,8 @@ test(function () { // AND
->toggle('b');
Assert::same([
- 'a' => FALSE,
- 'b' => FALSE,
+ 'a' => false,
+ 'b' => false,
], $form->getToggles());
});
@@ -39,8 +39,8 @@ test(function () {
->toggle('b');
Assert::same([
- 'a' => FALSE,
- 'b' => FALSE,
+ 'a' => false,
+ 'b' => false,
], $form->getToggles());
});
@@ -56,8 +56,8 @@ test(function () {
->toggle('b');
Assert::same([
- 'a' => TRUE,
- 'b' => FALSE,
+ 'a' => true,
+ 'b' => false,
], $form->getToggles());
});
@@ -73,8 +73,8 @@ test(function () {
->toggle('b');
Assert::same([
- 'a' => TRUE,
- 'b' => TRUE,
+ 'a' => true,
+ 'b' => true,
], $form->getToggles());
});
@@ -91,8 +91,8 @@ test(function () { // OR
->toggle('b');
Assert::same([
- 'a' => FALSE,
- 'b' => FALSE,
+ 'a' => false,
+ 'b' => false,
], $form->getToggles());
});
@@ -109,8 +109,8 @@ test(function () {
->toggle('b');
Assert::same([
- 'a' => FALSE,
- 'b' => TRUE,
+ 'a' => false,
+ 'b' => true,
], $form->getToggles());
});
@@ -127,8 +127,8 @@ test(function () {
->toggle('b');
Assert::same([
- 'a' => TRUE,
- 'b' => FALSE,
+ 'a' => true,
+ 'b' => false,
], $form->getToggles());
});
@@ -145,8 +145,8 @@ test(function () {
->toggle('b');
Assert::same([
- 'a' => TRUE,
- 'b' => TRUE,
+ 'a' => true,
+ 'b' => true,
], $form->getToggles());
});
@@ -161,8 +161,8 @@ test(function () { // OR & two components
->toggle('b');
Assert::same([
- 'a' => FALSE,
- 'b' => FALSE,
+ 'a' => false,
+ 'b' => false,
], $form->getToggles());
});
@@ -177,8 +177,8 @@ test(function () {
->toggle('b');
Assert::same([
- 'a' => FALSE,
- 'b' => TRUE,
+ 'a' => false,
+ 'b' => true,
], $form->getToggles());
});
@@ -193,8 +193,8 @@ test(function () {
->toggle('b');
Assert::same([
- 'a' => TRUE,
- 'b' => FALSE,
+ 'a' => true,
+ 'b' => false,
], $form->getToggles());
});
@@ -209,8 +209,8 @@ test(function () {
->toggle('b');
Assert::same([
- 'a' => TRUE,
- 'b' => TRUE,
+ 'a' => true,
+ 'b' => true,
], $form->getToggles());
});
@@ -225,7 +225,7 @@ test(function () { // OR & multiple used ID
->toggle('a');
Assert::same([
- 'a' => FALSE,
+ 'a' => false,
], $form->getToggles());
});
@@ -240,7 +240,7 @@ test(function () {
->toggle('a');
Assert::same([
- 'a' => TRUE,
+ 'a' => true,
], $form->getToggles());
});
@@ -255,7 +255,7 @@ test(function () {
->toggle('a');
Assert::same([
- 'a' => TRUE,
+ 'a' => true,
], $form->getToggles());
});
@@ -270,7 +270,7 @@ test(function () {
->toggle('a');
Assert::same([
- 'a' => TRUE,
+ 'a' => true,
], $form->getToggles());
});
@@ -286,7 +286,7 @@ test(function () { // AND & multiple used ID
->toggle('a');
Assert::same([
- 'a' => FALSE,
+ 'a' => false,
], $form->getToggles());
});
@@ -302,7 +302,7 @@ test(function () {
->toggle('a');
Assert::same([
- 'a' => FALSE,
+ 'a' => false,
], $form->getToggles());
});
@@ -318,7 +318,7 @@ test(function () {
->toggle('a');
Assert::same([
- 'a' => TRUE,
+ 'a' => true,
], $form->getToggles());
});
@@ -334,24 +334,24 @@ test(function () {
->toggle('a');
Assert::same([
- 'a' => TRUE,
+ 'a' => true,
], $form->getToggles());
});
-test(function () { // $hide = FALSE
+test(function () { // $hide = false
$form = new Form;
$form->addText('1');
$form->addText('2');
$form->addText('3')
->addConditionOn($form['1'], Form::EQUAL, 'x')
- ->toggle('a', FALSE)
+ ->toggle('a', false)
->addConditionOn($form['2'], Form::NOT_EQUAL, 'x')
->toggle('b');
Assert::same([
- 'a' => TRUE,
- 'b' => FALSE,
+ 'a' => true,
+ 'b' => false,
], $form->getToggles());
});
@@ -362,13 +362,13 @@ test(function () {
$form->addText('2');
$form->addText('3')
->addConditionOn($form['1'], Form::EQUAL, 'x')
- ->toggle('a', FALSE)
+ ->toggle('a', false)
->addConditionOn($form['2'], Form::NOT_EQUAL, 'x')
- ->toggle('b', FALSE);
+ ->toggle('b', false);
Assert::same([
- 'a' => TRUE,
- 'b' => TRUE,
+ 'a' => true,
+ 'b' => true,
], $form->getToggles());
});
@@ -379,13 +379,13 @@ test(function () {
$form->addText('2');
$form->addText('3')
->addConditionOn($form['1'], Form::NOT_EQUAL, 'x')
- ->toggle('a', FALSE)
+ ->toggle('a', false)
->addConditionOn($form['2'], Form::EQUAL, 'x')
- ->toggle('b', FALSE);
+ ->toggle('b', false);
Assert::same([
- 'a' => FALSE,
- 'b' => TRUE,
+ 'a' => false,
+ 'b' => true,
], $form->getToggles());
});
@@ -394,14 +394,14 @@ test(function () {
$form = new Form;
$form->addText('1')
->addCondition(Form::EQUAL, 'x')
- ->toggle('a', FALSE);
+ ->toggle('a', false);
$form->addText('2')
->addCondition(Form::NOT_EQUAL, 'x')
->toggle('b');
Assert::same([
- 'a' => TRUE,
- 'b' => TRUE,
+ 'a' => true,
+ 'b' => true,
], $form->getToggles());
});
@@ -413,11 +413,11 @@ test(function () {
->toggle('a');
$form->addText('2')
->addCondition(Form::NOT_EQUAL, 'x')
- ->toggle('b', FALSE);
+ ->toggle('b', false);
Assert::same([
- 'a' => FALSE,
- 'b' => FALSE,
+ 'a' => false,
+ 'b' => false,
], $form->getToggles());
});
@@ -426,30 +426,30 @@ test(function () {
$form = new Form;
$form->addText('1')
->addCondition(Form::EQUAL, 'x')
- ->toggle('a', FALSE);
+ ->toggle('a', false);
$form->addText('2')
->addCondition(Form::EQUAL, 'x')
- ->toggle('b', FALSE);
+ ->toggle('b', false);
Assert::same([
- 'a' => TRUE,
- 'b' => TRUE,
+ 'a' => true,
+ 'b' => true,
], $form->getToggles());
});
-test(function () { // $hide = FALSE & multiple used ID
+test(function () { // $hide = false & multiple used ID
$form = new Form;
$form->addText('1');
$form->addText('2');
$form->addText('3')
->addConditionOn($form['1'], Form::EQUAL, 'x')
- ->toggle('a', FALSE)
+ ->toggle('a', false)
->addConditionOn($form['2'], Form::NOT_EQUAL, 'x')
->toggle('a');
Assert::same([
- 'a' => TRUE,
+ 'a' => true,
], $form->getToggles());
});
@@ -460,12 +460,12 @@ test(function () {
$form->addText('2');
$form->addText('3')
->addConditionOn($form['1'], Form::EQUAL, 'x')
- ->toggle('a', FALSE)
+ ->toggle('a', false)
->addConditionOn($form['2'], Form::NOT_EQUAL, 'x')
- ->toggle('a', FALSE);
+ ->toggle('a', false);
Assert::same([
- 'a' => TRUE,
+ 'a' => true,
], $form->getToggles());
});
@@ -476,12 +476,12 @@ test(function () {
$form->addText('2');
$form->addText('3')
->addConditionOn($form['1'], Form::NOT_EQUAL, 'x')
- ->toggle('a', FALSE)
+ ->toggle('a', false)
->addConditionOn($form['2'], Form::EQUAL, 'x')
- ->toggle('a', FALSE);
+ ->toggle('a', false);
Assert::same([
- 'a' => TRUE,
+ 'a' => true,
], $form->getToggles());
});
@@ -490,14 +490,14 @@ test(function () {
$form = new Form;
$form->addText('1')
->addCondition(Form::EQUAL, 'x')
- ->toggle('a', FALSE);
+ ->toggle('a', false);
$form->addText('2')
->addCondition(Form::NOT_EQUAL, 'x')
->toggle('b');
Assert::same([
- 'a' => TRUE,
- 'b' => TRUE,
+ 'a' => true,
+ 'b' => true,
], $form->getToggles());
});
@@ -509,11 +509,11 @@ test(function () {
->toggle('a');
$form->addText('2')
->addCondition(Form::NOT_EQUAL, 'x')
- ->toggle('b', FALSE);
+ ->toggle('b', false);
Assert::same([
- 'a' => FALSE,
- 'b' => FALSE,
+ 'a' => false,
+ 'b' => false,
], $form->getToggles());
});
@@ -522,13 +522,13 @@ test(function () {
$form = new Form;
$form->addText('1')
->addCondition(Form::EQUAL, 'x')
- ->toggle('a', FALSE);
+ ->toggle('a', false);
$form->addText('2')
->addCondition(Form::EQUAL, 'x')
- ->toggle('a', FALSE);
+ ->toggle('a', false);
Assert::same([
- 'a' => TRUE,
+ 'a' => true,
], $form->getToggles());
});
@@ -537,12 +537,12 @@ test(function () {
$form = new Form;
$form->addText('1')
->addCondition(Form::EQUAL, 'x')
- ->toggle('a', FALSE);
+ ->toggle('a', false);
$form->addText('2')
->addCondition(Form::NOT_EQUAL, 'x')
- ->toggle('a', FALSE);
+ ->toggle('a', false);
Assert::same([
- 'a' => TRUE,
+ 'a' => true,
], $form->getToggles());
});
diff --git a/tests/Forms/Forms.validationScope.phpt b/tests/Forms/Forms.validationScope.phpt
index 29350be8b..5ed28e7c8 100644
--- a/tests/Forms/Forms.validationScope.phpt
+++ b/tests/Forms/Forms.validationScope.phpt
@@ -35,7 +35,7 @@ foreach ($datasets as $case) {
$details->addText('age2')->setRequired('age2');
$form->addSubmit('send1');
- $form->addSubmit('send2')->setValidationScope(FALSE);
+ $form->addSubmit('send2')->setValidationScope(false);
$form->addSubmit('send3')->setValidationScope([$form['name']]);
$form->addSubmit('send4')->setValidationScope([$form['details']['age']]);
$form->addSubmit('send5')->setValidationScope([$form['details']]);
diff --git a/tests/Forms/Helpers.createInputList.phpt b/tests/Forms/Helpers.createInputList.phpt
index ee7896f7f..4ac36c4f3 100644
--- a/tests/Forms/Helpers.createInputList.phpt
+++ b/tests/Forms/Helpers.createInputList.phpt
@@ -59,8 +59,8 @@ test(function () {
'
',
Helpers::createInputList(
['a' => 'First', 'b' => 'Second'],
- NULL,
- NULL,
+ null,
+ null,
'
'
)
);
@@ -69,8 +69,8 @@ test(function () {
'',
Helpers::createInputList(
['a' => 'First', 'b' => 'Second'],
- NULL,
- NULL,
+ null,
+ null,
Html::el('div')
)
);
@@ -79,9 +79,9 @@ test(function () {
'',
Helpers::createInputList(
['a' => 'First', 'b' => 'Second'],
- NULL,
- NULL,
- Html::el(NULL)
+ null,
+ null,
+ Html::el(null)
)
);
});
diff --git a/tests/Forms/Helpers.createSelectBox.phpt b/tests/Forms/Helpers.createSelectBox.phpt
index 82f0e4d75..e617850e0 100644
--- a/tests/Forms/Helpers.createSelectBox.phpt
+++ b/tests/Forms/Helpers.createSelectBox.phpt
@@ -60,7 +60,7 @@ test(function () {
(string) Helpers::createSelectBox(
['a' => 'First', 'b' => 'Second'],
[
- 'disabled:' => ['b' => TRUE],
+ 'disabled:' => ['b' => true],
'selected?' => ['a'],
'title' => 'Hello',
'style' => ['color' => 'blue'],
@@ -72,7 +72,7 @@ test(function () {
'',
(string) Helpers::createSelectBox(
['a' => 'First', 'b' => 'Second'],
- ['disabled:' => TRUE, 'selected?' => 'b']
+ ['disabled:' => true, 'selected?' => 'b']
)
);
diff --git a/tests/Forms/Helpers.exportRules.phpt b/tests/Forms/Helpers.exportRules.phpt
index 9e45fdd4c..f89bfa501 100644
--- a/tests/Forms/Helpers.exportRules.phpt
+++ b/tests/Forms/Helpers.exportRules.phpt
@@ -15,7 +15,7 @@ require __DIR__ . '/../bootstrap.php';
test(function () {
$form = new Form;
$input = $form->addText('text');
- $input->addRule(Form::FILLED, NULL, []);
+ $input->addRule(Form::FILLED, null, []);
Assert::same([
[
'op' => ':filled',
@@ -39,7 +39,7 @@ test(function () {
test(function () {
$form = new Form;
$input = $form->addText('text');
- $input->setRequired(FALSE);
+ $input->setRequired(false);
$input->addRule(Form::EMAIL);
Assert::same([
['op' => 'optional'],
@@ -52,12 +52,12 @@ test(function () {
$form = new Form;
$input1 = $form->addText('text1');
$input2 = $form->addText('text2');
- $input2->setRequired(FALSE);
+ $input2->setRequired(false);
$input2->addConditionOn($input1, Form::EMAIL)
- ->setRequired(TRUE)
+ ->setRequired(true)
->addRule($form::EMAIL);
$input2->addConditionOn($input1, Form::INTEGER)
- ->setRequired(FALSE)
+ ->setRequired(false)
->addRule($form::EMAIL);
Assert::same([
diff --git a/tests/Forms/Helpers.extractHttpData.phpt b/tests/Forms/Helpers.extractHttpData.phpt
index 5e5135d2a..40b2630aa 100644
--- a/tests/Forms/Helpers.extractHttpData.phpt
+++ b/tests/Forms/Helpers.extractHttpData.phpt
@@ -58,7 +58,7 @@ test(function () { // multiple
test(function () { // files
$file = new Nette\Http\FileUpload([
'name' => 'license.txt',
- 'type' => NULL,
+ 'type' => null,
'size' => 3013,
'tmpName' => 'tmp',
'error' => 0,
@@ -67,15 +67,15 @@ test(function () { // files
Assert::equal($file, Helpers::extractHttpData(['avatar' => $file], 'avatar', Form::DATA_FILE));
Assert::null(Helpers::extractHttpData([], 'missing', Form::DATA_FILE));
- Assert::null(Helpers::extractHttpData(['invalid' => NULL], 'invalid', Form::DATA_FILE));
- Assert::null(Helpers::extractHttpData(['invalid' => [NULL]], 'invalid', Form::DATA_FILE));
+ Assert::null(Helpers::extractHttpData(['invalid' => null], 'invalid', Form::DATA_FILE));
+ Assert::null(Helpers::extractHttpData(['invalid' => [null]], 'invalid', Form::DATA_FILE));
Assert::null(Helpers::extractHttpData([
'multiple' => ['avatar' => [$file, $file]],
], 'multiple[avatar]', Form::DATA_FILE));
Assert::equal([$file, $file], Helpers::extractHttpData([
- 'multiple' => ['avatar' => ['x' => $file, NULL, $file]],
+ 'multiple' => ['avatar' => ['x' => $file, null, $file]],
], 'multiple[avatar][]', Form::DATA_FILE));
Assert::equal(['x' => $file, $file], Helpers::extractHttpData([
@@ -83,7 +83,7 @@ test(function () { // files
], 'multiple[avatar][]', Form::DATA_KEYS | Form::DATA_FILE));
Assert::same([], Helpers::extractHttpData([], 'missing[]', Form::DATA_FILE));
- Assert::same([], Helpers::extractHttpData(['invalid' => NULL], 'invalid[]', Form::DATA_FILE));
+ Assert::same([], Helpers::extractHttpData(['invalid' => null], 'invalid[]', Form::DATA_FILE));
Assert::same([], Helpers::extractHttpData(['invalid' => $file], 'invalid[]', Form::DATA_FILE));
- Assert::same([], Helpers::extractHttpData(['invalid' => [NULL]], 'invalid[]', Form::DATA_FILE));
+ Assert::same([], Helpers::extractHttpData(['invalid' => [null]], 'invalid[]', Form::DATA_FILE));
});
diff --git a/tests/Forms/Rules.dynamic.phpt b/tests/Forms/Rules.dynamic.phpt
index 27e688883..bc7bd0d40 100644
--- a/tests/Forms/Rules.dynamic.phpt
+++ b/tests/Forms/Rules.dynamic.phpt
@@ -12,10 +12,10 @@ require __DIR__ . '/../bootstrap.php';
$datasets = [
- [['min' => '10', 'max' => '20', 'value' => 5], FALSE],
- [['min' => '10', 'max' => '20', 'value' => 15], TRUE],
- [['min' => '10', 'max' => '', 'value' => 15], TRUE],
- [['min' => '10', 'max' => '', 'value' => 5], FALSE],
+ [['min' => '10', 'max' => '20', 'value' => 5], false],
+ [['min' => '10', 'max' => '20', 'value' => 15], true],
+ [['min' => '10', 'max' => '', 'value' => 15], true],
+ [['min' => '10', 'max' => '', 'value' => 5], false],
];
foreach ($datasets as $case) {
@@ -23,7 +23,7 @@ foreach ($datasets as $case) {
$form->addText('min');
$form->addText('max');
- $form->addText('value')->addRule(Form::RANGE, NULL, [$form['min'], $form['max']]);
+ $form->addText('value')->addRule(Form::RANGE, null, [$form['min'], $form['max']]);
$form->setValues($case[0]);
Assert::equal($case[1], $form->isValid());
diff --git a/tests/Forms/Rules.formatMessage.phpt b/tests/Forms/Rules.formatMessage.phpt
index 095031710..55a7d6e88 100644
--- a/tests/Forms/Rules.formatMessage.phpt
+++ b/tests/Forms/Rules.formatMessage.phpt
@@ -48,4 +48,4 @@ Assert::same(['1 '], $form['args3']->getErrors());
Assert::same(['Label xyz is invalid [field special] xyz'], $form['special']->getErrors());
-Assert::match('%A%data-nette-rules=\'%A%{"op":":email","msg":"Label %value is invalid [field special] %0"%A%', $form->__toString(TRUE));
+Assert::match('%A%data-nette-rules=\'%A%{"op":":email","msg":"Label %value is invalid [field special] %0"%A%', $form->__toString(true));
diff --git a/tests/Forms/Rules.required.phpt b/tests/Forms/Rules.required.phpt
index beb3f43ef..e5ad53810 100644
--- a/tests/Forms/Rules.required.phpt
+++ b/tests/Forms/Rules.required.phpt
@@ -65,14 +65,14 @@ test(function () { // 'required' is always the first rule
});
-test(function () { // setRequired(FALSE)
+test(function () { // setRequired(false)
$form = new Form;
$input = $form->addText('text');
$rules = $input->getRules();
$rules->addRule($form::EMAIL);
$rules->addRule($form::REQUIRED);
- $rules->setRequired(FALSE);
+ $rules->setRequired(false);
$items = iterator_to_array($rules);
Assert::count(1, $items);
@@ -83,13 +83,13 @@ test(function () { // setRequired(FALSE)
});
-test(function () { // setRequired(FALSE) and addConditionOn
+test(function () { // setRequired(false) and addConditionOn
$form = new Form;
$form->addCheckbox('checkbox');
$input = $form->addText('text');
- $input->setRequired(FALSE)
+ $input->setRequired(false)
->addRule($form::EMAIL)
- ->addConditionOn($form['checkbox'], $form::EQUAL, FALSE)
+ ->addConditionOn($form['checkbox'], $form::EQUAL, false)
->addRule($form::REQUIRED);
Assert::false($input->getRules()->validate());
diff --git a/tests/Forms/Rules.static.phpt b/tests/Forms/Rules.static.phpt
index af11271b7..72eb1d76e 100644
--- a/tests/Forms/Rules.static.phpt
+++ b/tests/Forms/Rules.static.phpt
@@ -11,7 +11,7 @@ require __DIR__ . '/../bootstrap.php';
test(function () {
$form = new Form;
$input = $form->addText('text');
- $input->addCondition(FALSE)
+ $input->addCondition(false)
->setRequired();
$rules = $input->getRules();
@@ -28,7 +28,7 @@ test(function () {
test(function () {
$form = new Form;
$input = $form->addText('text');
- $input->addCondition(TRUE)
+ $input->addCondition(true)
->setRequired();
$rules = $input->getRules();
diff --git a/tests/bootstrap.php b/tests/bootstrap.php
index 323e5a983..e5b866014 100644
--- a/tests/bootstrap.php
+++ b/tests/bootstrap.php
@@ -13,11 +13,11 @@
date_default_timezone_set('Europe/Prague');
-function before(\Closure $function = NULL)
+function before(\Closure $function = null)
{
static $val;
if (!func_num_args()) {
- return ($val ? $val() : NULL);
+ return ($val ? $val() : null);
}
$val = $function;
}