Skip to content

Commit

Permalink
fixed in_array
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Jun 20, 2014
1 parent 72c32a2 commit e3cc399
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/Bridges/FormsLatte/FormMacros.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion src/Forms/Controls/CheckboxList.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/Forms/Controls/RadioList.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
));
Expand Down
6 changes: 3 additions & 3 deletions src/Forms/Controls/TextInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Forms/Helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit e3cc399

Please sign in to comment.