Skip to content

Commit

Permalink
Merge pull request #1762 from malarzm/csfix-quotes
Browse files Browse the repository at this point in the history
Stop ignoring DoubleQuoteUsage.ContainsVar
  • Loading branch information
alcaeus authored Mar 25, 2018
2 parents 6947e9f + 73fde7a commit 587912c
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 55 deletions.
3 changes: 2 additions & 1 deletion lib/Doctrine/ODM/MongoDB/Aggregation/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use function array_merge;
use function array_unshift;
use function is_array;
use function sprintf;

/**
* Fluent interface for building aggregation pipelines.
Expand Down Expand Up @@ -249,7 +250,7 @@ function (Stage $stage) {
public function getStage($index)
{
if (! isset($this->stages[$index])) {
throw new \OutOfRangeException("Could not find stage with index {$index}.");
throw new \OutOfRangeException(sprintf('Could not find stage with index %d.', $index));
}

return $this->stages[$index];
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ODM/MongoDB/DocumentManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ public function createReference($document, array $referenceMapping)
break;

default:
throw new \InvalidArgumentException("Reference type {$storeAs} is invalid.");
throw new \InvalidArgumentException(sprintf('Reference type %s is invalid.', $storeAs));
}

/* If the class has a discriminator (field and value), use it. A child
Expand Down
80 changes: 39 additions & 41 deletions lib/Doctrine/ODM/MongoDB/Mapping/MappingException.php

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions lib/Doctrine/ODM/MongoDB/MongoDBException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Doctrine\ODM\MongoDB;

use Doctrine\Common\Persistence\ObjectRepository;
use function array_slice;
use function end;
use function get_class;
Expand Down Expand Up @@ -58,7 +59,7 @@ public static function documentManagerClosed()
*/
public static function unknownDocumentNamespace($documentNamespaceAlias)
{
return new self("Unknown Document namespace alias '$documentNamespaceAlias'.");
return new self(sprintf("Unknown Document namespace alias '%s'.", $documentNamespaceAlias));
}

/**
Expand All @@ -76,7 +77,7 @@ public static function cannotPersistMappedSuperclass($className)
*/
public static function invalidDocumentRepository($className)
{
return new self("Invalid repository class '" . $className . "'. It must be a Doctrine\Common\Persistence\ObjectRepository.");
return new self(sprintf("Invalid repository class '%s'. It must be a %s.", $className, ObjectRepository::class));
}

/**
Expand Down
3 changes: 2 additions & 1 deletion lib/Doctrine/ODM/MongoDB/Persisters/CollectionPersister.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use function array_values;
use function get_class;
use function implode;
use function sprintf;

/**
* The CollectionPersister is responsible for persisting collections of embedded
Expand Down Expand Up @@ -199,7 +200,7 @@ private function insertElements(PersistentCollectionInterface $coll, array $opti
break;

default:
throw new \LogicException("Invalid strategy {$mapping['strategy']} given for insertElements");
throw new \LogicException(sprintf('Invalid strategy %s given for insertElements', $mapping['strategy']));
}

list($propertyPath, $parent) = $this->getPathAndParent($coll);
Expand Down
5 changes: 3 additions & 2 deletions lib/Doctrine/ODM/MongoDB/Persisters/DocumentPersister.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
use function is_scalar;
use function max;
use function spl_object_hash;
use function sprintf;
use function strpos;
use function strtolower;

Expand Down Expand Up @@ -870,7 +871,7 @@ public function createReferenceManyWithRepositoryMethodCursor(PersistentCollecti
->$repositoryMethod($collection->getOwner());

if (! $cursor instanceof Iterator) {
throw new \BadMethodCallException("Expected repository method {$repositoryMethod} to return an iterable object");
throw new \BadMethodCallException(sprintf('Expected repository method %s to return an iterable object', $repositoryMethod));
}

if (! empty($mapping['prime'])) {
Expand Down Expand Up @@ -1475,7 +1476,7 @@ private function prepareReference($fieldName, $value, array $mapping, $inNewObj)
break;

default:
throw new \InvalidArgumentException("Reference type {$mapping['storeAs']} is invalid.");
throw new \InvalidArgumentException(sprintf('Reference type %s is invalid.', $mapping['storeAs']));
}

if ($mapping['type'] === 'many') {
Expand Down
5 changes: 3 additions & 2 deletions lib/Doctrine/ODM/MongoDB/Query/Expr.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
use function is_array;
use function is_string;
use function key;
use function sprintf;
use function strpos;
use function strtolower;

Expand Down Expand Up @@ -724,7 +725,7 @@ public function includesReferenceTo($document)
break;

default:
throw new \InvalidArgumentException("Reference type {$storeAs} is invalid.");
throw new \InvalidArgumentException(sprintf('Reference type %s is invalid.', $storeAs));
}

foreach ($keys as $key => $value) {
Expand Down Expand Up @@ -1122,7 +1123,7 @@ public function references($document)
break;

default:
throw new \InvalidArgumentException("Reference type {$storeAs} is invalid.");
throw new \InvalidArgumentException(sprintf('Reference type %s is invalid.', $storeAs));
}

foreach ($keys as $key => $value) {
Expand Down
4 changes: 0 additions & 4 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@
<exclude name="SlevomatCodingStandard.Classes.SuperfluousAbstractClassNaming" />
<exclude name="SlevomatCodingStandard.Classes.SuperfluousExceptionNaming" />
<exclude name="SlevomatCodingStandard.Classes.SuperfluousInterfaceNaming" />

<!-- The following rules are intended to be enabled one-by-one to have reviewable diffs -->

<exclude name="Squiz.Strings.DoubleQuoteUsage.ContainsVar" />
</rule>

<!-- Require no space around colon in return types -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Doctrine\ODM\MongoDB\Mapping\Driver\AnnotationDriver;
use Doctrine\ODM\MongoDB\Tests\BaseTest;
use Doctrine\ODM\MongoDB\Tests\Mocks\DocumentManagerMock;
use function sprintf;

class ClassMetadataFactoryTest extends BaseTest
{
Expand Down Expand Up @@ -91,7 +92,7 @@ protected function _newClassMetadataInstance($className)
{
$this->_requestedClasses[] = $className;
if (! isset($this->_mockMetadata[$className])) {
throw new InvalidArgumentException("No mock metadata found for class $className.");
throw new \InvalidArgumentException(sprintf('No mock metadata found for class %s.', $className));
}
return $this->_mockMetadata[$className];
}
Expand Down

0 comments on commit 587912c

Please sign in to comment.