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

Exact null comparisons

parent 17c59842
...@@ -140,7 +140,7 @@ class Zend2Http extends Configurable implements AdapterInterface ...@@ -140,7 +140,7 @@ class Zend2Http extends Configurable implements AdapterInterface
*/ */
public function getZendHttp() public function getZendHttp()
{ {
if (null == $this->zendHttp) { if (null === $this->zendHttp) {
$options = array(); $options = array();
// forward zendhttp options // forward zendhttp options
......
...@@ -142,7 +142,7 @@ class ZendHttp extends Configurable implements AdapterInterface ...@@ -142,7 +142,7 @@ class ZendHttp extends Configurable implements AdapterInterface
*/ */
public function getZendHttp() public function getZendHttp()
{ {
if (null == $this->zendHttp) { if (null === $this->zendHttp) {
$options = array(); $options = array();
// forward zendhttp options // forward zendhttp options
......
...@@ -283,7 +283,7 @@ class Client extends Configurable ...@@ -283,7 +283,7 @@ class Client extends Configurable
$this->endpoints[$key] = $endpoint; $this->endpoints[$key] = $endpoint;
// if no default endpoint is set do so now // if no default endpoint is set do so now
if (null == $this->defaultEndpoint) { if (null === $this->defaultEndpoint) {
$this->defaultEndpoint = $key; $this->defaultEndpoint = $key;
} }
} }
...@@ -323,7 +323,7 @@ class Client extends Configurable ...@@ -323,7 +323,7 @@ class Client extends Configurable
*/ */
public function getEndpoint($key = null) public function getEndpoint($key = null)
{ {
if (null == $key) { if (null === $key) {
$key = $this->defaultEndpoint; $key = $this->defaultEndpoint;
} }
......
...@@ -149,7 +149,7 @@ class Response ...@@ -149,7 +149,7 @@ class Response
} }
} }
if (null == $statusHeader) { if (null === $statusHeader) {
throw new HttpException("No HTTP status found"); throw new HttpException("No HTTP status found");
} }
......
...@@ -145,7 +145,7 @@ class Result implements ResultInterface ...@@ -145,7 +145,7 @@ class Result implements ResultInterface
*/ */
public function getData() public function getData()
{ {
if (null == $this->data) { if (null === $this->data) {
switch ($this->query->getResponseWriter()) { switch ($this->query->getResponseWriter()) {
case AbstractQuery::WT_PHPS: case AbstractQuery::WT_PHPS:
$this->data = unserialize($this->response->getBody()); $this->data = unserialize($this->response->getBody());
......
...@@ -227,7 +227,7 @@ class Customization extends Configurable ...@@ -227,7 +227,7 @@ class Customization extends Configurable
return false; return false;
} }
if (null == $this->getKey() || null == $this->getName() || null == $this->getValue()) { if (null === $this->getKey() || null === $this->getName() || null === $this->getValue()) {
return false; return false;
} }
......
...@@ -83,7 +83,7 @@ class QueryGroupResult extends StandardQueryGroupResult ...@@ -83,7 +83,7 @@ class QueryGroupResult extends StandardQueryGroupResult
$this->filterRatio = $query->getFilterRatio(); $this->filterRatio = $query->getFilterRatio();
// Use the maximumScore of the first group as maximum for all groups // Use the maximumScore of the first group as maximum for all groups
if (self::$overallMaximumScore == null) { if (self::$overallMaximumScore === null) {
self::$overallMaximumScore = $maximumScore; self::$overallMaximumScore = $maximumScore;
} }
......
...@@ -92,7 +92,7 @@ class ParallelExecution extends AbstractPlugin ...@@ -92,7 +92,7 @@ class ParallelExecution extends AbstractPlugin
$endpoint = $endpoint->getKey(); $endpoint = $endpoint->getKey();
} }
if ($endpoint == null) { if ($endpoint === null) {
$endpoint = $this->client->getEndpoint()->getKey(); $endpoint = $this->client->getEndpoint()->getKey();
} }
......
...@@ -179,7 +179,7 @@ class PrefetchIterator extends AbstractPlugin implements \Iterator, \Countable ...@@ -179,7 +179,7 @@ class PrefetchIterator extends AbstractPlugin implements \Iterator, \Countable
public function count() public function count()
{ {
// if no results are available yet, get them now // if no results are available yet, get them now
if (null == $this->result) { if (null === $this->result) {
$this->fetchNext(); $this->fetchNext();
} }
...@@ -239,7 +239,7 @@ class PrefetchIterator extends AbstractPlugin implements \Iterator, \Countable ...@@ -239,7 +239,7 @@ class PrefetchIterator extends AbstractPlugin implements \Iterator, \Countable
$adjustedIndex = $this->position % $this->options['prefetch']; $adjustedIndex = $this->position % $this->options['prefetch'];
// this condition prevent useless re-fetching of data if a count is done before the iterator is used // this condition prevent useless re-fetching of data if a count is done before the iterator is used
if ($adjustedIndex == 0 && ($this->position !== 0 || null == $this->result)) { if ($adjustedIndex === 0 && ($this->position !== 0 || null === $this->result)) {
$this->fetchNext(); $this->fetchNext();
} }
......
...@@ -111,7 +111,7 @@ class MoreLikeThis extends AbstractComponent ...@@ -111,7 +111,7 @@ class MoreLikeThis extends AbstractComponent
public function getFields() public function getFields()
{ {
$fields = $this->getOption('fields'); $fields = $this->getOption('fields');
if ($fields == null) { if ($fields === null) {
$fields = array(); $fields = array();
} }
...@@ -320,7 +320,7 @@ class MoreLikeThis extends AbstractComponent ...@@ -320,7 +320,7 @@ class MoreLikeThis extends AbstractComponent
public function getQueryFields() public function getQueryFields()
{ {
$queryfields = $this->getOption('queryfields'); $queryfields = $this->getOption('queryfields');
if ($queryfields == null) { if ($queryfields === null) {
$queryfields = array(); $queryfields = array();
} }
......
...@@ -225,7 +225,7 @@ class Document extends AbstractDocument implements DocumentInterface ...@@ -225,7 +225,7 @@ class Document extends AbstractDocument implements DocumentInterface
*/ */
public function setField($key, $value, $boost = null, $modifier = null) public function setField($key, $value, $boost = null, $modifier = null)
{ {
if ($value === null && $modifier == null) { if ($value === null && $modifier === null) {
$this->removeField($key); $this->removeField($key);
} else { } else {
if ($this->filterControlCharacters && is_string($value)) { if ($this->filterControlCharacters && is_string($value)) {
...@@ -435,7 +435,7 @@ class Document extends AbstractDocument implements DocumentInterface ...@@ -435,7 +435,7 @@ class Document extends AbstractDocument implements DocumentInterface
*/ */
public function getFields() public function getFields()
{ {
if (count($this->modifiers) > 0 && ($this->key == null || !isset($this->fields[$this->key]))) { if (count($this->modifiers) > 0 && ($this->key === null || !isset($this->fields[$this->key]))) {
throw new RuntimeException( throw new RuntimeException(
'A document that uses modifiers (atomic updates) must have a key defined before it is used' 'A document that uses modifiers (atomic updates) must have a key defined before it is used'
); );
......
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