diff --git a/lib/Doctrine/ODM/MongoDB/DocumentManager.php b/lib/Doctrine/ODM/MongoDB/DocumentManager.php index de17d0dee8..ac4637d825 100644 --- a/lib/Doctrine/ODM/MongoDB/DocumentManager.php +++ b/lib/Doctrine/ODM/MongoDB/DocumentManager.php @@ -443,18 +443,18 @@ public function createAggregationBuilder(string $documentName): Aggregation\Buil * NOTE: The persist operation always considers documents that are not yet known to * this DocumentManager as NEW. Do not pass detached documents to the persist operation. * - * @param object $document The instance to make managed and persistent. + * @param object $object The instance to make managed and persistent. * - * @throws InvalidArgumentException When the given $document param is not an object. + * @throws InvalidArgumentException When the given $object param is not an object. */ - public function persist($document) + public function persist($object) { - if (! is_object($document)) { - throw new InvalidArgumentException(gettype($document)); + if (! is_object($object)) { + throw new InvalidArgumentException(gettype($object)); } $this->errorIfClosed(); - $this->unitOfWork->persist($document); + $this->unitOfWork->persist($object); } /** @@ -463,36 +463,36 @@ public function persist($document) * A removed document will be removed from the database at or before transaction commit * or as a result of the flush operation. * - * @param object $document The document instance to remove. + * @param object $object The document instance to remove. * - * @throws InvalidArgumentException When the $document param is not an object. + * @throws InvalidArgumentException When the $object param is not an object. */ - public function remove($document) + public function remove($object) { - if (! is_object($document)) { - throw new InvalidArgumentException(gettype($document)); + if (! is_object($object)) { + throw new InvalidArgumentException(gettype($object)); } $this->errorIfClosed(); - $this->unitOfWork->remove($document); + $this->unitOfWork->remove($object); } /** * Refreshes the persistent state of a document from the database, * overriding any local changes that have not yet been persisted. * - * @param object $document The document to refresh. + * @param object $object The document to refresh. * - * @throws InvalidArgumentException When the given $document param is not an object. + * @throws InvalidArgumentException When the given $object param is not an object. */ - public function refresh($document) + public function refresh($object) { - if (! is_object($document)) { - throw new InvalidArgumentException(gettype($document)); + if (! is_object($object)) { + throw new InvalidArgumentException(gettype($object)); } $this->errorIfClosed(); - $this->unitOfWork->refresh($document); + $this->unitOfWork->refresh($object); } /** @@ -502,17 +502,17 @@ public function refresh($document) * Documents which previously referenced the detached document will continue to * reference it. * - * @param object $document The document to detach. + * @param object $object The document to detach. * - * @throws InvalidArgumentException When the $document param is not an object. + * @throws InvalidArgumentException When the $object param is not an object. */ - public function detach($document) + public function detach($object) { - if (! is_object($document)) { - throw new InvalidArgumentException(gettype($document)); + if (! is_object($object)) { + throw new InvalidArgumentException(gettype($object)); } - $this->unitOfWork->detach($document); + $this->unitOfWork->detach($object); } /** @@ -520,22 +520,22 @@ public function detach($document) * of this DocumentManager and returns the managed copy of the document. * The document passed to merge will not become associated/managed with this DocumentManager. * - * @param object $document The detached document to merge into the persistence context. + * @param object $object The detached document to merge into the persistence context. * * @return object The managed copy of the document. * * @throws LockException - * @throws InvalidArgumentException If the $document param is not an object. + * @throws InvalidArgumentException If the $object param is not an object. */ - public function merge($document) + public function merge($object) { - if (! is_object($document)) { - throw new InvalidArgumentException(gettype($document)); + if (! is_object($object)) { + throw new InvalidArgumentException(gettype($object)); } $this->errorIfClosed(); - return $this->unitOfWork->merge($document); + return $this->unitOfWork->merge($object); } /** @@ -560,17 +560,17 @@ public function unlock(object $document): void /** * Gets the repository for a document class. * - * @param string $documentName The name of the Document. - * @psalm-param class-string $documentName + * @param string $className The name of the Document. + * @psalm-param class-string $className * * @return ObjectRepository The repository. * @psalm-return ObjectRepository * * @template T of object */ - public function getRepository($documentName) + public function getRepository($className) { - return $this->repositoryFactory->getRepository($this, $documentName); + return $this->repositoryFactory->getRepository($this, $className); } /** @@ -682,11 +682,11 @@ public function find($className, $id, $lockMode = LockMode::NONE, $lockVersion = * All documents that are currently managed by this DocumentManager become * detached. * - * @param string|null $documentName if given, only documents of this type will get detached + * @param string|null $objectName if given, only documents of this type will get detached */ - public function clear($documentName = null) + public function clear($objectName = null) { - $this->unitOfWork->clear($documentName); + $this->unitOfWork->clear($objectName); } /** @@ -703,21 +703,21 @@ public function close() /** * Determines whether a document instance is managed in this DocumentManager. * - * @param object $document + * @param object $object * * @return bool TRUE if this DocumentManager currently manages the given document, FALSE otherwise. * - * @throws InvalidArgumentException When the $document param is not an object. + * @throws InvalidArgumentException When the $object param is not an object. */ - public function contains($document) + public function contains($object) { - if (! is_object($document)) { - throw new InvalidArgumentException(gettype($document)); + if (! is_object($object)) { + throw new InvalidArgumentException(gettype($object)); } - return $this->unitOfWork->isScheduledForInsert($document) || - $this->unitOfWork->isInIdentityMap($document) && - ! $this->unitOfWork->isScheduledForDelete($document); + return $this->unitOfWork->isScheduledForInsert($object) || + $this->unitOfWork->isInIdentityMap($object) && + ! $this->unitOfWork->isScheduledForDelete($object); } /** diff --git a/lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadata.php b/lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadata.php index b4c0cc88b2..3b272aaee6 100644 --- a/lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadata.php +++ b/lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadata.php @@ -1835,7 +1835,7 @@ public function getAssociationCollectionClass(string $assocName): string /** * {@inheritDoc} */ - public function isAssociationInverseSide($fieldName): bool + public function isAssociationInverseSide($assocName): bool { throw new BadMethodCallException(__METHOD__ . '() is not implemented yet.'); } @@ -1843,7 +1843,7 @@ public function isAssociationInverseSide($fieldName): bool /** * {@inheritDoc} */ - public function getAssociationMappedByTargetField($fieldName) + public function getAssociationMappedByTargetField($assocName) { throw new BadMethodCallException(__METHOD__ . '() is not implemented yet.'); } diff --git a/lib/Doctrine/ODM/MongoDB/PersistentCollection/PersistentCollectionTrait.php b/lib/Doctrine/ODM/MongoDB/PersistentCollection/PersistentCollectionTrait.php index 29133d39b4..5e2a8af86d 100644 --- a/lib/Doctrine/ODM/MongoDB/PersistentCollection/PersistentCollectionTrait.php +++ b/lib/Doctrine/ODM/MongoDB/PersistentCollection/PersistentCollectionTrait.php @@ -473,9 +473,9 @@ public function set($key, $value) /** * {@inheritdoc} */ - public function add($value) + public function add($element) { - return $this->doAdd($value, false); + return $this->doAdd($element, false); } /** diff --git a/lib/Doctrine/ODM/MongoDB/Query/QueryExpressionVisitor.php b/lib/Doctrine/ODM/MongoDB/Query/QueryExpressionVisitor.php index 251b797867..a14005d119 100644 --- a/lib/Doctrine/ODM/MongoDB/Query/QueryExpressionVisitor.php +++ b/lib/Doctrine/ODM/MongoDB/Query/QueryExpressionVisitor.php @@ -93,20 +93,20 @@ public function walkComparison(Comparison $comparison): Expr * * @see ExpressionVisitor::walkCompositeExpression() */ - public function walkCompositeExpression(CompositeExpression $compositeExpr): Expr + public function walkCompositeExpression(CompositeExpression $expr): Expr { - if (! isset(self::$compositeMethods[$compositeExpr->getType()])) { - throw new RuntimeException('Unknown composite ' . $compositeExpr->getType()); + if (! isset(self::$compositeMethods[$expr->getType()])) { + throw new RuntimeException('Unknown composite ' . $expr->getType()); } - $method = self::$compositeMethods[$compositeExpr->getType()]; - $expr = $this->builder->expr(); + $method = self::$compositeMethods[$expr->getType()]; + $outputExpr = $this->builder->expr(); - foreach ($compositeExpr->getExpressionList() as $child) { - $expr->{$method}($this->dispatch($child)); + foreach ($expr->getExpressionList() as $child) { + $outputExpr->{$method}($this->dispatch($child)); } - return $expr; + return $outputExpr; } /**