Skip to content
This repository has been archived by the owner on Nov 11, 2020. It is now read-only.

Commit

Permalink
Merge pull request #294 from alcaeus/fix-coding-style
Browse files Browse the repository at this point in the history
Fix spacing around ! operator
  • Loading branch information
alcaeus authored Jun 29, 2017
2 parents 6f63da8 + a800155 commit 5a49c04
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 15 deletions.
8 changes: 4 additions & 4 deletions lib/Doctrine/MongoDB/Aggregation/Expr.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class Expr
public function __call($method, $args)
{
$internalMethodName = $method . 'Internal';
if (!is_callable([$this, $internalMethodName])) {
if (! is_callable([$this, $internalMethodName])) {
throw new \BadMethodCallException('The method ' . $method . ' does not exist.');
}

Expand Down Expand Up @@ -1203,10 +1203,10 @@ private function requiresSwitchStatement($method = null)
$message = ($method ?: 'This method') . ' requires a valid switch statement (call switch() first).';

if ($this->currentField) {
if (!isset($this->expr[$this->currentField]['$switch'])) {
if (! isset($this->expr[$this->currentField]['$switch'])) {
throw new \BadMethodCallException($message);
}
} elseif (!isset($this->expr['$switch'])) {
} elseif (! isset($this->expr['$switch'])) {
throw new \BadMethodCallException($message);
}
}
Expand Down Expand Up @@ -1612,7 +1612,7 @@ protected function switchInternal()
*/
protected function thenInternal($expression)
{
if (!is_array($this->switchBranch)) {
if (! is_array($this->switchBranch)) {
throw new \BadMethodCallException(static::class . '::then requires a valid case statement (call case() first).');
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/MongoDB/Aggregation/Stage/Bucket.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function defaultBucket($default)
*/
public function output()
{
if (!$this->output) {
if (! $this->output) {
$this->output = new Stage\Bucket\BucketOutput($this->builder, $this);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/MongoDB/Aggregation/Stage/BucketAuto.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function granularity($granularity)
*/
public function output()
{
if (!$this->output) {
if (! $this->output) {
$this->output = new Stage\Bucket\BucketAutoOutput($this->builder, $this);
}

Expand Down
4 changes: 2 additions & 2 deletions lib/Doctrine/MongoDB/Aggregation/Stage/Facet.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,15 @@ public function field($field)
*/
public function pipeline($builder)
{
if (!$this->field) {
if (! $this->field) {
throw new \LogicException(__METHOD__ . ' requires you set a current field using field().');
}

if ($builder instanceof Stage) {
$builder = $builder->builder;
}

if (!$builder instanceof Builder) {
if (! $builder instanceof Builder) {
throw new \InvalidArgumentException(__METHOD__ . ' expects either an aggregation builder or an aggregation stage.');
}

Expand Down
8 changes: 4 additions & 4 deletions lib/Doctrine/MongoDB/GridFS.php
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ protected function doUpdate(array $query, array $newObj, array $options = [])
/* If findAndRemove() returned nothing (no match or removal), create
* a new document with the query's "_id" if available.
*/
if (!isset($document)) {
if (! isset($document)) {
/* If $newObj had modifiers, we'll need to do an update later,
* so default to an empty array for now. Otherwise, we can do
* without that update and store $newObj now.
Expand All @@ -279,19 +279,19 @@ protected function doUpdate(array $query, array $newObj, array $options = [])
* or $newObj, we can use that instead of having storeFile()
* generate one.
*/
if (!isset($document['_id']) && isset($query['_id'])) {
if (! isset($document['_id']) && isset($query['_id'])) {
$document['_id'] = $query['_id'];
}

if (!isset($document['_id']) && isset($newObj['_id'])) {
if (! isset($document['_id']) && isset($newObj['_id'])) {
$document['_id'] = $newObj['_id'];
}
}

// Document will definitely have an "_id" after storing the file.
$this->storeFile($file, $document);

if (!$newObjHasModifiers) {
if (! $newObjHasModifiers) {
/* TODO: MongoCollection::update() would return a boolean if
* $newObj was not empty, or an array describing the update
* operation. Improvise, since we only stored the file and that
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/MongoDB/Query/Expr.php
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ public function comment($comment)
*/
public function currentDate($type = 'date')
{
if (!in_array($type, ['date', 'timestamp'])) {
if (! in_array($type, ['date', 'timestamp'])) {
throw new InvalidArgumentException('Type for currentDate operator must be date or timestamp.');
}

Expand Down
4 changes: 2 additions & 2 deletions lib/Doctrine/MongoDB/Util/ReadPreference.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ private function __construct() {}
*/
public static function convertNumericType($type)
{
if (!isset(self::$types[$type])) {
if (! isset(self::$types[$type])) {
throw new \InvalidArgumentException('Unknown numeric read preference type: ' . $type);
}

Expand Down Expand Up @@ -118,7 +118,7 @@ public static function convertTagSets(array $tagSets)
* does not contain a colon character, we can assume this tag set is
* already in the format expected by setReadPreference().
*/
if (!isset($tagSet[0]) || false === strpos($tagSet[0], ':')) {
if (! isset($tagSet[0]) || false === strpos($tagSet[0], ':')) {
return $tagSet;
}

Expand Down

0 comments on commit 5a49c04

Please sign in to comment.