Commit d6104fc7 authored by Bas de Nooijer's avatar Bas de Nooijer

Strict compare of boolean values

parent 4f4fe388
...@@ -243,7 +243,7 @@ class Client extends Configurable ...@@ -243,7 +243,7 @@ class Client extends Configurable
if ($endpoint->getKey() !== null) { if ($endpoint->getKey() !== null) {
$this->addEndpoint($endpoint); $this->addEndpoint($endpoint);
if ($setAsDefault == true) { if ($setAsDefault === true) {
$this->setDefaultEndpoint($endpoint); $this->setDefaultEndpoint($endpoint);
} }
} }
......
...@@ -108,7 +108,7 @@ class Configurable implements ConfigurableInterface ...@@ -108,7 +108,7 @@ class Configurable implements ConfigurableInterface
} }
} }
if (true == $overwrite) { if (true === $overwrite) {
$this->options = $options; $this->options = $options;
} else { } else {
$this->options = array_merge($this->options, $options); $this->options = array_merge($this->options, $options);
......
...@@ -118,7 +118,7 @@ abstract class AbstractRequestBuilder implements RequestBuilderInterface ...@@ -118,7 +118,7 @@ abstract class AbstractRequestBuilder implements RequestBuilderInterface
public function boolAttrib($name, $value) public function boolAttrib($name, $value)
{ {
if (null !== $value) { if (null !== $value) {
$value = (true == $value) ? 'true' : 'false'; $value = (true === (bool)$value) ? 'true' : 'false';
return $this->attrib($name, $value); return $this->attrib($name, $value);
} else { } else {
......
...@@ -469,7 +469,7 @@ class Loadbalancer extends AbstractPlugin ...@@ -469,7 +469,7 @@ class Loadbalancer extends AbstractPlugin
$this->endpointExcludes = array(); // reset for each query $this->endpointExcludes = array(); // reset for each query
$adapter = $this->client->getAdapter(); $adapter = $this->client->getAdapter();
if ($this->getFailoverEnabled() == true) { if ($this->getFailoverEnabled() === true) {
$maxRetries = $this->getFailoverMaxRetries(); $maxRetries = $this->getFailoverMaxRetries();
for ($i = 0; $i <= $maxRetries; $i++) { for ($i = 0; $i <= $maxRetries; $i++) {
$endpoint = $this->getRandomEndpoint(); $endpoint = $this->getRandomEndpoint();
......
...@@ -80,7 +80,7 @@ class RequestBuilder extends BaseRequestBuilder ...@@ -80,7 +80,7 @@ class RequestBuilder extends BaseRequestBuilder
} }
// add document settings to request // add document settings to request
if (($doc = $query->getDocument()) != null) { if (($doc = $query->getDocument()) !== null) {
if ($doc->getBoost() !== null) { if ($doc->getBoost() !== null) {
throw new RuntimeException('Extract does not support document-level boosts, use field boosts instead.'); throw new RuntimeException('Extract does not support document-level boosts, use field boosts instead.');
} }
......
...@@ -71,7 +71,7 @@ class ResponseParser extends SelectResponseParser ...@@ -71,7 +71,7 @@ class ResponseParser extends SelectResponseParser
$parseResult['interestingTerms'] = $terms; $parseResult['interestingTerms'] = $terms;
} }
if (isset($data['match']['docs'][0]) && true == $query->getMatchInclude()) { if (isset($data['match']['docs'][0]) && true === $query->getMatchInclude()) {
$matchData = $data['match']['docs'][0]; $matchData = $data['match']['docs'][0];
$documentClass = $query->getOption('documentclass'); $documentClass = $query->getOption('documentclass');
......
...@@ -119,7 +119,7 @@ class Result extends SelectResult ...@@ -119,7 +119,7 @@ class Result extends SelectResult
public function getMatch() public function getMatch()
{ {
$query = $this->getQuery(); $query = $this->getQuery();
if (true != $query->getMatchInclude()) { if (true !== $query->getMatchInclude()) {
throw new UnexpectedValueException('matchinclude was disabled in the MLT query'); throw new UnexpectedValueException('matchinclude was disabled in the MLT query');
} }
$this->parseResponse(); $this->parseResponse();
......
...@@ -792,7 +792,7 @@ class Query extends BaseQuery ...@@ -792,7 +792,7 @@ class Query extends BaseQuery
if (isset($this->components[$key])) { if (isset($this->components[$key])) {
return $this->components[$key]; return $this->components[$key];
} else { } else {
if ($autoload == true) { if ($autoload === true) {
if (!isset($this->componentTypes[$key])) { if (!isset($this->componentTypes[$key])) {
throw new OutOfBoundsException('Cannot autoload unknown component: '.$key); throw new OutOfBoundsException('Cannot autoload unknown component: '.$key);
} }
......
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