Skip to content

Commit

Permalink
fixed several scrutinizer bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
hiqsol committed May 12, 2016
1 parent 16fe6bc commit 26679da
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/ActiveQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface
const EVENT_INIT = 'init';

/**
* @var array a list of relations that this query should be joined with
* @var array|null a list of relations that this query should be joined with
*/
public $joinWith = [];

Expand All @@ -43,7 +43,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface
/**
* Constructor.
*
* @param array $modelClass the model class associated with this query
* @param string $modelClass the model class associated with this query
* @param array $config configurations to be applied to the newly created query object
*/
public function __construct($modelClass, $config = [])
Expand Down
12 changes: 5 additions & 7 deletions src/ActiveRecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ public function getPrimaryValue()
{
$primaryValue = $this->primaryValue();

$result = null;
if ($primaryValue instanceof \Closure) {
return call_user_func($primaryValue, [$this]);
} elseif (is_array($primaryValue)) {
Expand Down Expand Up @@ -281,6 +280,9 @@ public function insert($runValidation = true, $attributes = null, $options = [])
return true;
}

/**
* {@inheritdoc}
*/
public function delete($options = [])
{
if (!$this->beforeDelete()) {
Expand All @@ -295,11 +297,7 @@ public function delete($options = [])
$this->setOldAttributes(null);
$this->afterDelete();

if ($result === false) {
return 0;
} else {
return 1;
}
return $result === false ? false : true;
}

public function update($runValidation = true, $attributeNames = null, $options = [])
Expand Down Expand Up @@ -338,7 +336,7 @@ protected function updateInternal($attributes = null, $options = [])

$this->afterSave(false, $changedAttributes);

return $result;
return $result === false ? false : true;
}

/**
Expand Down

0 comments on commit 26679da

Please sign in to comment.