Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve phpdoc specification #2312

Merged
merged 1 commit into from
May 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/Doctrine/ODM/MongoDB/DocumentManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
use Doctrine\ODM\MongoDB\Proxy\Resolver\ProxyManagerClassNameResolver;
use Doctrine\ODM\MongoDB\Query\FilterCollection;
use Doctrine\ODM\MongoDB\Repository\DocumentRepository;
use Doctrine\ODM\MongoDB\Repository\GridFSRepository;
use Doctrine\ODM\MongoDB\Repository\RepositoryFactory;
use Doctrine\ODM\MongoDB\Repository\ViewRepository;
use Doctrine\Persistence\ObjectManager;
use Doctrine\Persistence\ObjectRepository;
use InvalidArgumentException;
Expand Down Expand Up @@ -563,8 +565,8 @@ public function unlock(object $document): void
* @param string $documentName The name of the Document.
* @psalm-param class-string<T> $documentName
*
* @return ObjectRepository The repository.
* @psalm-return ObjectRepository<T>
* @return ObjectRepository|DocumentRepository|GridFSRepository|ViewRepository The repository.
* @psalm-return DocumentRepository<T>|GridFSRepository<T>|ViewRepository<T>
*
* @template T of object
*/
Expand Down
4 changes: 4 additions & 0 deletions lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadataFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
* to a document database.
*
* @internal
*
* @method ClassMetadata[] getAllMetadata()
* @method ClassMetadata[] getLoadedMetadata()
* @method ClassMetadata getMetadataFor($className)
*/
final class ClassMetadataFactory extends AbstractClassMetadataFactory
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ abstract class AbstractRepositoryFactory implements RepositoryFactory
*/
private $repositoryList = [];

/**
* @psalm-param class-string<T> $documentName
*
* @psalm-return DocumentRepository<T>|GridFSRepository<T>|ViewRepository<T>
*
* @template T of object
*/
public function getRepository(DocumentManager $documentManager, string $documentName): ObjectRepository
{
$metadata = $documentManager->getClassMetadata($documentName);
Expand All @@ -45,7 +52,12 @@ public function getRepository(DocumentManager $documentManager, string $document
/**
* Create a new repository instance for a document class.
*
* @return ObjectRepository|GridFSRepository|ViewRepository
* @psalm-param class-string<T> $documentName
*
* @return ObjectRepository|DocumentRepository|GridFSRepository|ViewRepository
* @psalm-return DocumentRepository<T>|GridFSRepository<T>|ViewRepository<T>
*
* @template T of object
*/
protected function createRepository(DocumentManager $documentManager, string $documentName): ObjectRepository
{
Expand Down