Commit 099f57ca authored by Bas de Nooijer's avatar Bas de Nooijer

Merge pull request #348 from basdenooijer/develop

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