Skip to content

Commit

Permalink
Add some generic information
Browse files Browse the repository at this point in the history
  • Loading branch information
franmomu committed May 8, 2022
1 parent cdb60e2 commit 5b3b728
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 11 deletions.
12 changes: 6 additions & 6 deletions lib/Doctrine/ODM/MongoDB/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ class Configuration
* autoGeneratePersistentCollectionClasses?: self::AUTOGENERATE_*,
* classMetadataFactoryName?: class-string<ClassMetadataFactory>,
* defaultCommitOptions?: CommitOptions,
* defaultDocumentRepositoryClassName?: class-string<ObjectRepository>,
* defaultGridFSRepositoryClassName?: class-string<GridFSRepository>,
* defaultDocumentRepositoryClassName?: class-string<ObjectRepository<object>>,
* defaultGridFSRepositoryClassName?: class-string<GridFSRepository<object>>,
* defaultDB?: string,
* documentNamespaces?: array<string, string>,
* filters?: array<string, array{
Expand Down Expand Up @@ -488,7 +488,7 @@ public function getFilterParameters(string $name): array
}

/**
* @psalm-param class-string<ObjectRepository> $className
* @psalm-param class-string<ObjectRepository<object>> $className
*
* @throws MongoDBException If not is a ObjectRepository.
*/
Expand All @@ -504,15 +504,15 @@ public function setDefaultDocumentRepositoryClassName(string $className): void
}

/**
* @psalm-return class-string<ObjectRepository>
* @psalm-return class-string<ObjectRepository<object>>
*/
public function getDefaultDocumentRepositoryClassName(): string
{
return $this->attributes['defaultDocumentRepositoryClassName'] ?? DocumentRepository::class;
}

/**
* @psalm-param class-string<GridFSRepository> $className
* @psalm-param class-string<GridFSRepository<object>> $className
*
* @throws MongoDBException If the class does not implement the GridFSRepository interface.
*/
Expand All @@ -528,7 +528,7 @@ public function setDefaultGridFSRepositoryClassName(string $className): void
}

/**
* @psalm-return class-string<GridFSRepository>
* @psalm-return class-string<GridFSRepository<object>>
*/
public function getDefaultGridFSRepositoryClassName(): string
{
Expand Down
4 changes: 2 additions & 2 deletions lib/Doctrine/ODM/MongoDB/DocumentManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -817,8 +817,8 @@ public function createReference(object $document, array $referenceMapping)
/**
* Build discriminator portion of reference for specified reference mapping and class metadata.
*
* @param array $referenceMapping Mappings of reference for which discriminator data is created.
* @param ClassMetadata $class Metadata of reference document class.
* @param array $referenceMapping Mappings of reference for which discriminator data is created.
* @param ClassMetadata<object> $class Metadata of reference document class.
* @psalm-param FieldMapping $referenceMapping
*
* @return array with next structure [{discriminator field} => {discriminator value}]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ interface PersistentCollectionFactory
* Creates specified persistent collection to work with given collection class.
*
* @psalm-param FieldMapping $mapping
* @psalm-param BaseCollection<array-key, object>|null $coll
*
* @psalm-return PersistentCollectionInterface<array-key, object>
*/
public function create(DocumentManager $dm, array $mapping, ?BaseCollection $coll = null): PersistentCollectionInterface;
}
3 changes: 2 additions & 1 deletion lib/Doctrine/ODM/MongoDB/Persisters/PersistenceBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,8 @@ public function prepareAssociatedDocumentValue(array $mapping, $document, $inclu
/**
* Returns the collection representation to be stored and unschedules it afterwards.
*
* @param bool $includeNestedCollections
* @param PersistentCollectionInterface<array-key, object> $coll
* @param bool $includeNestedCollections
*
* @return mixed[]
*/
Expand Down
2 changes: 2 additions & 0 deletions lib/Doctrine/ODM/MongoDB/Query/FilterCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ public function isEnabled(string $name): bool
/**
* Gets enabled filter criteria.
*
* @param ClassMetadata<object> $class
*
* @return array<string, mixed>
*/
public function getFilterCriteria(ClassMetadata $class): array
Expand Down
6 changes: 4 additions & 2 deletions lib/Doctrine/ODM/MongoDB/Query/ReferencePrimer.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public function __construct(DocumentManager $dm, UnitOfWork $uow)
* the default primer defined in the constructor. If $primer is not
* callable, the default primer will be used.
*
* @param ClassMetadata $class Class metadata for the document
* @param ClassMetadata<object> $class Class metadata for the document
* @param array<object>|Traversable<object> $documents Documents containing references to prime
* @param string $fieldName Field name containing references to prime
* @param array $hints UnitOfWork hints for priming queries
Expand Down Expand Up @@ -167,10 +167,11 @@ public function primeReferences(ClassMetadata $class, $documents, string $fieldN
* ... but you cannot prime this: myDocument.embeddedDocument.referencedDocuments.referencedDocument(s)
* This addresses Issue #624.
*
* @param ClassMetadata<object> $class
* @param array<object>|Traversable<object> $documents
* @param FieldMapping|null $mapping
*
* @return array{fieldName: string, class: ClassMetadata, documents: array<object>|Traversable<object>, mapping: FieldMapping}
* @return array{fieldName: string, class: ClassMetadata<object>, documents: array<object>|Traversable<object>, mapping: FieldMapping}
*/
private function parseDotSyntaxForPrimer(string $fieldName, ClassMetadata $class, $documents, ?array $mapping = null): array
{
Expand Down Expand Up @@ -245,6 +246,7 @@ private function parseDotSyntaxForPrimer(string $fieldName, ClassMetadata $class
* have a target document class defined. Without that, there is no way to
* infer the class of the referenced documents.
*
* @param PersistentCollectionInterface<array-key, object> $persistentCollection
* @psalm-param array<class-string, array<string, mixed>> $groupedIds
*/
private function addManyReferences(PersistentCollectionInterface $persistentCollection, array &$groupedIds): void
Expand Down

0 comments on commit 5b3b728

Please sign in to comment.