From e3cc399a9fce6d52f9961ab3d0496b73014a25e8 Mon Sep 17 00:00:00 2001 From: David Grudl Date: Mon, 16 Jun 2014 17:15:51 +0200 Subject: [PATCH] fixed in_array --- src/Bridges/FormsLatte/FormMacros.php | 2 +- src/Forms/Controls/CheckboxList.php | 2 +- src/Forms/Controls/RadioList.php | 2 +- src/Forms/Controls/TextInput.php | 6 +++--- src/Forms/Helpers.php | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Bridges/FormsLatte/FormMacros.php b/src/Bridges/FormsLatte/FormMacros.php index 0df8d3c44..9e22a7bff 100644 --- a/src/Bridges/FormsLatte/FormMacros.php +++ b/src/Bridges/FormsLatte/FormMacros.php @@ -154,7 +154,7 @@ public function macroNameAttr(MacroNode $node, PhpWriter $writer) } $name = array_shift($words); $tagName = strtolower($node->htmlNode->name); - $node->isEmpty = !in_array($tagName, array('form', 'select', 'textarea')); + $node->isEmpty = !in_array($tagName, array('form', 'select', 'textarea'), TRUE); if ($tagName === 'form') { return $writer->write( diff --git a/src/Forms/Controls/CheckboxList.php b/src/Forms/Controls/CheckboxList.php index f6c6c2111..008c38d25 100644 --- a/src/Forms/Controls/CheckboxList.php +++ b/src/Forms/Controls/CheckboxList.php @@ -84,7 +84,7 @@ public function getControlPart($key) { return parent::getControl()->addAttributes(array( 'id' => $this->getHtmlId() . '-' . $key, - 'checked' => in_array($key, (array) $this->value), + 'checked' => in_array($key, (array) $this->value, TRUE), 'disabled' => is_array($this->disabled) ? isset($this->disabled[$key]) : $this->disabled, 'required' => NULL, 'value' => $key, diff --git a/src/Forms/Controls/RadioList.php b/src/Forms/Controls/RadioList.php index 22397b4d3..c6ced30d7 100644 --- a/src/Forms/Controls/RadioList.php +++ b/src/Forms/Controls/RadioList.php @@ -126,7 +126,7 @@ public function getControlPart($key) { return parent::getControl()->addAttributes(array( 'id' => $this->getHtmlId() . '-' . $key, - 'checked' => in_array($key, (array) $this->value), + 'checked' => in_array($key, (array) $this->value, TRUE), 'disabled' => is_array($this->disabled) ? isset($this->disabled[$key]) : $this->disabled, 'value' => $key, )); diff --git a/src/Forms/Controls/TextInput.php b/src/Forms/Controls/TextInput.php index 7f608b08d..d14535f4c 100644 --- a/src/Forms/Controls/TextInput.php +++ b/src/Forms/Controls/TextInput.php @@ -65,8 +65,8 @@ public function getControl() foreach ($this->getRules() as $rule) { if ($rule->isNegative || $rule->branch) { - } elseif (in_array($rule->validator, array(Form::MIN, Form::MAX, Form::RANGE)) - && in_array($input->type, array('number', 'range', 'datetime-local', 'datetime', 'date', 'month', 'week', 'time')) + } elseif (in_array($rule->validator, array(Form::MIN, Form::MAX, Form::RANGE), TRUE) + && in_array($input->type, array('number', 'range', 'datetime-local', 'datetime', 'date', 'month', 'week', 'time'), TRUE) ) { if ($rule->validator === Form::MIN) { $range = array($rule->arg, NULL); @@ -83,7 +83,7 @@ public function getControl() } } elseif ($rule->validator === Form::PATTERN && is_scalar($rule->arg) - && in_array($input->type, array('text', 'search', 'tel', 'url', 'email', 'password')) + && in_array($input->type, array('text', 'search', 'tel', 'url', 'email', 'password'), TRUE) ) { $input->pattern = $rule->arg; } diff --git a/src/Forms/Helpers.php b/src/Forms/Helpers.php index 3956c1add..8a768b66b 100644 --- a/src/Forms/Helpers.php +++ b/src/Forms/Helpers.php @@ -85,7 +85,7 @@ public static function generateHtmlName($id) if ($count) { $name = substr_replace($name, '', strpos($name, ']'), 1) . ']'; } - if (is_numeric($name) || in_array($name, self::$unsafeNames)) { + if (is_numeric($name) || in_array($name, self::$unsafeNames, TRUE)) { $name = '_' . $name; } return $name;