Skip to content

Commit

Permalink
Replace all is_null($value) calls with null === $value
Browse files Browse the repository at this point in the history
or alternativly null !== $value
for consistency in the framework
  • Loading branch information
prolic committed Jan 22, 2013
1 parent 960e722 commit 3f83037
Show file tree
Hide file tree
Showing 12 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion library/Zend/Db/Sql/Delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public function where($predicate, $combination = Predicate\PredicateSet::OP_AND)
} elseif (is_string($pkey)) {
// Otherwise, if still a string, do something intelligent with the PHP type provided

if (is_null($pvalue)) {
if (null === $pvalue) {
// map PHP null to SQL IS NULL expression
$predicate = new Predicate\IsNull($pkey, $pvalue);
} elseif (is_array($pvalue)) {
Expand Down
2 changes: 1 addition & 1 deletion library/Zend/Db/Sql/Insert.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ public function getSqlString(PlatformInterface $adapterPlatform = null)
if ($value instanceof Expression) {
$exprData = $this->processExpression($value, $adapterPlatform);
$values[] = $exprData->getSql();
} elseif (is_null($value)) {
} elseif (null === $value) {
$values[] = 'NULL';
} else {
$values[] = $adapterPlatform->quoteValue($value);
Expand Down
4 changes: 2 additions & 2 deletions library/Zend/Db/Sql/Predicate/Between.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ public function __construct($identifier = null, $minValue = null, $maxValue = nu
if ($identifier) {
$this->setIdentifier($identifier);
}
if (!is_null($minValue)) {
if (null !== $minValue) {
$this->setMinValue($minValue);
}
if (!is_null($maxValue)) {
if (null !== $maxValue) {
$this->setMaxValue($maxValue);
}
}
Expand Down
2 changes: 1 addition & 1 deletion library/Zend/Db/Sql/Select.php
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ public function where($predicate, $combination = Predicate\PredicateSet::OP_AND)
} elseif (is_string($pkey)) {
// Otherwise, if still a string, do something intelligent with the PHP type provided

if (is_null($pvalue)) {
if (null === $pvalue) {
// map PHP null to SQL IS NULL expression
$predicate = new Predicate\IsNull($pkey, $pvalue);
} elseif (is_array($pvalue)) {
Expand Down
6 changes: 3 additions & 3 deletions library/Zend/Db/Sql/Update.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public function set(array $values, $flag = self::VALUES_SET)
*/
public function where($predicate, $combination = Predicate\PredicateSet::OP_AND)
{
if (is_null($predicate)) {
if (null === $predicate) {
throw new Exception\InvalidArgumentException('Predicate cannot be null');
}

Expand All @@ -149,7 +149,7 @@ public function where($predicate, $combination = Predicate\PredicateSet::OP_AND)
} elseif (is_string($pkey)) {
// Otherwise, if still a string, do something intelligent with the PHP type provided

if (is_null($pvalue)) {
if (null === $pvalue) {
// map PHP null to SQL IS NULL expression
$predicate = new Predicate\IsNull($pkey, $pvalue);
} elseif (is_array($pvalue)) {
Expand Down Expand Up @@ -249,7 +249,7 @@ public function getSqlString(PlatformInterface $adapterPlatform = null)
if ($value instanceof Expression) {
$exprData = $this->processExpression($value, $adapterPlatform);
$setSql[] = $adapterPlatform->quoteIdentifier($column) . ' = ' . $exprData->getSql();
} elseif (is_null($value)) {
} elseif (null === $value) {
$setSql[] = $adapterPlatform->quoteIdentifier($column) . ' = NULL';
} else {
$setSql[] = $adapterPlatform->quoteIdentifier($column) . ' = ' . $adapterPlatform->quoteValue($value);
Expand Down
2 changes: 1 addition & 1 deletion library/Zend/Form/Element/Select.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function setValueOptions(array $options)
$this->valueOptions = $options;

// Update InArrayValidator validator haystack
if (!is_null($this->validator)) {
if (null !== $this->validator) {
if ($this->validator instanceof InArrayValidator){
$validator = $this->validator;
}
Expand Down
2 changes: 1 addition & 1 deletion library/Zend/Http/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ public function setStream($streamfile = true)
*/
public function getStream()
{
if (!is_null($this->streamName)) {
if (null !== $this->streamName) {
return $this->streamName;
}

Expand Down
2 changes: 1 addition & 1 deletion library/Zend/Http/Response/Stream.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ public function getRawBody()
*/
protected function readStream()
{
if (!is_null($this->contentLength)) {
if (null !== $this->contentLength) {
$bytes = $this->contentLength - $this->contentStreamed;
} else {
$bytes = -1; //Read the whole buffer
Expand Down
2 changes: 1 addition & 1 deletion library/Zend/View/Helper/Escaper/AbstractHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function getEscaper()
*/
public function setEncoding($encoding)
{
if (!is_null($this->escaper)) {
if (null !== $this->escaper) {
throw new Exception\InvalidArgumentException(
'Character encoding settings cannot be changed once the Helper has been used or '
. ' if a Zend\Escaper\Escaper object (with preset encoding option) is set.'
Expand Down
2 changes: 1 addition & 1 deletion library/Zend/View/Model/JsonModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function serialize()
$variables = ArrayUtils::iteratorToArray($variables);
}

if (!is_null($this->jsonpCallback)) {
if (null !== $this->jsonpCallback) {
return $this->jsonpCallback.'('.Json::encode($variables).');';
}
return Json::encode($variables);
Expand Down
2 changes: 1 addition & 1 deletion library/Zend/View/Renderer/JsonRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public function setJsonpCallback($callback)
*/
public function hasJsonpCallback()
{
return !is_null($this->jsonpCallback);
return null !== $this->jsonpCallback;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion library/Zend/XmlRpc/AbstractValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ public static function getXmlRpcTypeByValue($value)
return self::XMLRPC_TYPE_DOUBLE;
} elseif (is_bool($value)) {
return self::XMLRPC_TYPE_BOOLEAN;
} elseif (is_null($value)) {
} elseif (null === $value) {
return self::XMLRPC_TYPE_NIL;
} elseif (is_string($value)) {
return self::XMLRPC_TYPE_STRING;
Expand Down

0 comments on commit 3f83037

Please sign in to comment.