Commit edda2d41 authored by lucasvanlierop's avatar lucasvanlierop

Reduced nested complexity

parent 59a5f5c0
...@@ -729,20 +729,22 @@ class PostgreSqlPlatform extends AbstractPlatform ...@@ -729,20 +729,22 @@ class PostgreSqlPlatform extends AbstractPlatform
return $callback($value ? true : false); return $callback($value ? true : false);
} }
if (is_string($value)) { if (!is_string($value)) {
/** return $callback(true);
* Better safe than sorry: http://php.net/in_array#106319 }
*/
if (in_array(trim(strtolower($value)), $this->booleanLiterals['false'], true)) { /**
return $callback(false); * Better safe than sorry: http://php.net/in_array#106319
} elseif (in_array(trim(strtolower($value)), $this->booleanLiterals['true'], true)) { */
return $callback(true); if (in_array(trim(strtolower($value)), $this->booleanLiterals['false'], true)) {
} else { return $callback(false);
throw new \UnexpectedValueException("Unrecognized boolean literal '${value}'"); }
}
if (in_array(trim(strtolower($value)), $this->booleanLiterals['true'], true)) {
return $callback(true);
} }
return $callback(true); throw new \UnexpectedValueException("Unrecognized boolean literal '${value}'");
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment