Skip to content

Commit 9746da5

Browse files
+ applied vendor/bin/phpcbf
1 parent a9b8dd6 commit 9746da5

19 files changed

+90
-70
lines changed

lib/Doctrine/ODM/MongoDB/DocumentManager.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -279,9 +279,10 @@ public function getClassNameResolver(): ClassNameResolver
279279
* Returns the metadata for a class.
280280
*
281281
* @param string $className The class name.
282-
*
283282
* @psalm-param class-string<T> $className
283+
*
284284
* @psalm-return ClassMetadata<T>
285+
*
285286
* @template T of object
286287
* @psalm-suppress InvalidReturnType, InvalidReturnStatement see https://github.com/vimeo/psalm/issues/5788
287288
*/
@@ -547,11 +548,11 @@ public function unlock(object $document): void
547548
* Gets the repository for a document class.
548549
*
549550
* @param string $className The name of the Document.
551+
* @psalm-param class-string<T> $className
550552
*
551553
* @return DocumentRepository|GridFSRepository|ViewRepository The repository.
552-
*
553-
* @psalm-param class-string<T> $className
554554
* @psalm-return DocumentRepository<T>|GridFSRepository<T>|ViewRepository<T>
555+
*
555556
* @template T of object
556557
*/
557558
public function getRepository($className)
@@ -565,10 +566,9 @@ public function getRepository($className)
565566
* database.
566567
*
567568
* @param array $options Array of options to be used with batchInsert(), update() and remove()
569+
* @psalm-param CommitOptions $options
568570
*
569571
* @throws MongoDBException
570-
*
571-
* @psalm-param CommitOptions $options
572572
*/
573573
public function flush(array $options = [])
574574
{
@@ -585,9 +585,10 @@ public function flush(array $options = [])
585585
* loads itself on first access.
586586
*
587587
* @param mixed $identifier
588-
*
589588
* @psalm-param class-string<T> $documentName
589+
*
590590
* @psalm-return T|(T&GhostObjectInterface<T>)
591+
*
591592
* @template T of object
592593
*/
593594
public function getReference(string $documentName, $identifier): object
@@ -655,9 +656,10 @@ public function getPartialReference(string $documentName, $identifier): object
655656
* @param mixed $id
656657
* @param int $lockMode
657658
* @param int $lockVersion
658-
*
659659
* @psalm-param class-string<T> $className
660+
*
660661
* @psalm-return T|null
662+
*
661663
* @template T of object
662664
*/
663665
public function find($className, $id, $lockMode = LockMode::NONE, $lockVersion = null): ?object

lib/Doctrine/ODM/MongoDB/Hydrator/HydratorFactory.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,10 +446,9 @@ public function hydrate(object \$document, array \$data, array \$hints = array()
446446
* Hydrate array of MongoDB document data into the given document object.
447447
*
448448
* @param array<string, mixed> $data
449+
* @psalm-param Hints $hints Any hints to account for during reconstitution/lookup of the document.
449450
*
450451
* @return array<string, mixed>
451-
*
452-
* @psalm-param Hints $hints Any hints to account for during reconstitution/lookup of the document.
453452
*/
454453
public function hydrate(object $document, array $data, array $hints = []): array
455454
{

lib/Doctrine/ODM/MongoDB/Hydrator/HydratorInterface.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,9 @@ interface HydratorInterface
1515
* Hydrate array of MongoDB document data into the given document object.
1616
*
1717
* @param array<string, mixed> $data
18+
* @psalm-param Hints $hints
1819
*
1920
* @return array<string, mixed>
20-
*
21-
* @psalm-param Hints $hints
2221
*/
2322
public function hydrate(object $document, array $data, array $hints = []): array;
2423
}

lib/Doctrine/ODM/MongoDB/Iterator/HydratingIterator.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ final class HydratingIterator implements Iterator
4141
/**
4242
* @param Traversable<mixed, TValue> $traversable
4343
* @param ClassMetadata<TDocument> $class
44-
*
4544
* @psalm-param Hints $unitOfWorkHints
4645
*/
4746
public function __construct(Traversable $traversable, UnitOfWork $unitOfWork, ClassMetadata $class, array $unitOfWorkHints = [])

lib/Doctrine/ODM/MongoDB/Mapping/Driver/XmlDriver.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,6 @@ public function loadMetadataForClass($className, \Doctrine\Persistence\Mapping\C
341341

342342
/**
343343
* @param ClassMetadata<object> $class
344-
*
345344
* @psalm-param FieldMappingConfig $mapping
346345
*/
347346
private function addFieldMapping(ClassMetadata $class, array $mapping): void

lib/Doctrine/ODM/MongoDB/PersistentCollection/PersistentCollectionInterface.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ public function setDirty($dirty);
9292
* Sets the collection's owning document together with the AssociationMapping that
9393
* describes the association between the owner and the elements of the collection.
9494
*
95-
* @return void
96-
*
9795
* @psalm-param FieldMapping $mapping
96+
*
97+
* @return void
9898
*/
9999
public function setOwner(object $document, array $mapping);
100100

@@ -154,17 +154,15 @@ public function getOwner(): ?object;
154154

155155
/**
156156
* @return array
157-
*
158157
* @psalm-return FieldMapping
159158
*/
160159
public function getMapping();
161160

162161
/**
163162
* @return ClassMetadata
163+
* @psalm-return ClassMetadata<T>
164164
*
165165
* @throws MongoDBException
166-
*
167-
* @psalm-return ClassMetadata<T>
168166
*/
169167
public function getTypeClass();
170168

lib/Doctrine/ODM/MongoDB/Proxy/Factory/ProxyFactory.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ public function generateProxyClasses(array $classes): int;
1919
* the given identifier.
2020
*
2121
* @param mixed $identifier
22-
*
2322
* @psalm-param ClassMetadata<T> $metadata
23+
*
2424
* @psalm-return T&GhostObjectInterface<T>
25+
*
2526
* @template T of object
2627
*/
2728
public function getProxy(ClassMetadata $metadata, $identifier): GhostObjectInterface;

lib/Doctrine/ODM/MongoDB/Proxy/Resolver/ProxyManagerClassNameResolver.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ public function getRealClass(string $class): string
2828

2929
/**
3030
* @psalm-param class-string<RealClassName>|class-string<ProxyInterface<RealClassName>> $className
31+
*
3132
* @psalm-return class-string<RealClassName>
33+
*
3234
* @psalm-template RealClassName of object
3335
*/
3436
public function resolveClassName(string $className): string

lib/Doctrine/ODM/MongoDB/Query/Builder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -515,10 +515,10 @@ public function expr(): Expr
515515
/**
516516
* Specify $expr criteria for the current field.
517517
*
518-
* @param array|Aggregation\Expr $expression
519518
* @see https://docs.mongodb.com/manual/reference/operator/query/expr/
520-
*
521519
* @see Aggregation\Expr::aggregationExpression()
520+
*
521+
* @param array|Aggregation\Expr $expression
522522
*/
523523
public function aggregationExpression($expression): self
524524
{

lib/Doctrine/ODM/MongoDB/Repository/AbstractRepositoryFactory.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ abstract class AbstractRepositoryFactory implements RepositoryFactory
2727

2828
/**
2929
* @psalm-param class-string<T> $documentName
30+
*
3031
* @psalm-return DocumentRepository<T>|GridFSRepository<T>|ViewRepository<T>
32+
*
3133
* @template T of object
3234
*/
3335
public function getRepository(DocumentManager $documentManager, string $documentName): ObjectRepository
@@ -49,10 +51,11 @@ public function getRepository(DocumentManager $documentManager, string $document
4951
/**
5052
* Create a new repository instance for a document class.
5153
*
52-
* @return DocumentRepository|GridFSRepository|ViewRepository
53-
*
5454
* @psalm-param class-string<T> $documentName
55+
*
56+
* @return DocumentRepository|GridFSRepository|ViewRepository
5557
* @psalm-return DocumentRepository<T>|GridFSRepository<T>|ViewRepository<T>
58+
*
5659
* @template T of object
5760
*/
5861
protected function createRepository(DocumentManager $documentManager, string $documentName): ObjectRepository
@@ -101,10 +104,10 @@ protected function createRepository(DocumentManager $documentManager, string $do
101104
* Instantiates requested repository.
102105
*
103106
* @param ClassMetadata<T> $metadata
107+
* @psalm-param class-string<T> $repositoryClassName
104108
*
105109
* @return ObjectRepository<T>
106110
*
107-
* @psalm-param class-string<T> $repositoryClassName
108111
* @template T of object
109112
*/
110113
abstract protected function instantiateRepository(string $repositoryClassName, DocumentManager $documentManager, ClassMetadata $metadata): ObjectRepository;

lib/Doctrine/ODM/MongoDB/Repository/DocumentRepository.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ class DocumentRepository implements ObjectRepository, Selectable
6161
* @param DocumentManager $dm The DocumentManager to use.
6262
* @param UnitOfWork $uow The UnitOfWork to use.
6363
* @param ClassMetadata $classMetadata The class metadata.
64-
*
6564
* @psalm-param ClassMetadata<T> $classMetadata The class metadata.
6665
*/
6766
public function __construct(DocumentManager $dm, UnitOfWork $uow, ClassMetadata $classMetadata)
@@ -102,10 +101,10 @@ public function clear(): void
102101
*
103102
* @param mixed $id Identifier.
104103
*
104+
* @psalm-return T|null
105+
*
105106
* @throws MappingException
106107
* @throws LockException
107-
*
108-
* @psalm-return T|null
109108
*/
110109
public function find($id, int $lockMode = LockMode::NONE, ?int $lockVersion = null): ?object
111110
{
@@ -182,7 +181,6 @@ public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $
182181
* @param array<string, mixed> $criteria
183182
*
184183
* @return object|null The object.
185-
*
186184
* @psalm-return T|null
187185
*/
188186
public function findOneBy(array $criteria, ?array $sort = null): ?object

lib/Doctrine/ODM/MongoDB/Repository/RepositoryFactory.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ interface RepositoryFactory
1616
* Gets the repository for a document class.
1717
*
1818
* @psalm-param class-string<T> $documentName
19+
*
1920
* @psalm-return ObjectRepository<T>
21+
*
2022
* @template T of object
2123
*/
2224
public function getRepository(DocumentManager $documentManager, string $documentName): ObjectRepository;

lib/Doctrine/ODM/MongoDB/SchemaManager.php

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,9 @@ public function updateIndexes(?int $maxTimeMs = null, ?WriteConcern $writeConcer
104104
* Indexes that exist in MongoDB but not the document metadata will be
105105
* deleted.
106106
*
107-
* @throws InvalidArgumentException
108-
*
109107
* @psalm-param class-string $documentName
108+
*
109+
* @throws InvalidArgumentException
110110
*/
111111
public function updateDocumentIndexes(string $documentName, ?int $maxTimeMs = null, ?WriteConcern $writeConcern = null): void
112112
{
@@ -152,6 +152,7 @@ public function updateDocumentIndexes(string $documentName, ?int $maxTimeMs = nu
152152

153153
/**
154154
* @psalm-param class-string $documentName
155+
*
155156
* @psalm-return IndexMapping[]
156157
*/
157158
public function getDocumentIndexes(string $documentName): array
@@ -164,6 +165,7 @@ public function getDocumentIndexes(string $documentName): array
164165
/**
165166
* @psalm-param class-string $documentName
166167
* @psalm-param array<class-string, bool> $visited
168+
*
167169
* @psalm-return IndexMapping[]
168170
*/
169171
private function doGetDocumentIndexes(string $documentName, array &$visited): array
@@ -265,9 +267,9 @@ private function prepareIndexes(ClassMetadata $class): array
265267
/**
266268
* Ensure the given document's indexes are created.
267269
*
268-
* @throws InvalidArgumentException
269-
*
270270
* @psalm-param class-string $documentName
271+
*
272+
* @throws InvalidArgumentException
271273
*/
272274
public function ensureDocumentIndexes(string $documentName, ?int $maxTimeMs = null, ?WriteConcern $writeConcern = null, bool $background = false): void
273275
{
@@ -310,9 +312,9 @@ public function deleteIndexes(?int $maxTimeMs = null, ?WriteConcern $writeConcer
310312
/**
311313
* Delete the given document's indexes.
312314
*
313-
* @throws InvalidArgumentException
314-
*
315315
* @psalm-param class-string $documentName
316+
*
317+
* @throws InvalidArgumentException
316318
*/
317319
public function deleteDocumentIndexes(string $documentName, ?int $maxTimeMs = null, ?WriteConcern $writeConcern = null): void
318320
{
@@ -412,9 +414,9 @@ public function createCollections(?int $maxTimeMs = null, ?WriteConcern $writeCo
412414
/**
413415
* Create the document collection for a mapped class.
414416
*
415-
* @throws InvalidArgumentException
416-
*
417417
* @psalm-param class-string $documentName
418+
*
419+
* @throws InvalidArgumentException
418420
*/
419421
public function createDocumentCollection(string $documentName, ?int $maxTimeMs = null, ?WriteConcern $writeConcern = null): void
420422
{
@@ -491,9 +493,9 @@ public function dropCollections(?int $maxTimeMs = null, ?WriteConcern $writeConc
491493
/**
492494
* Drop the document collection for a mapped class.
493495
*
494-
* @throws InvalidArgumentException
495-
*
496496
* @psalm-param class-string $documentName
497+
*
498+
* @throws InvalidArgumentException
497499
*/
498500
public function dropDocumentCollection(string $documentName, ?int $maxTimeMs = null, ?WriteConcern $writeConcern = null): void
499501
{
@@ -531,9 +533,9 @@ public function dropDatabases(?int $maxTimeMs = null, ?WriteConcern $writeConcer
531533
/**
532534
* Drop the document database for a mapped class.
533535
*
534-
* @throws InvalidArgumentException
535-
*
536536
* @psalm-param class-string $documentName
537+
*
538+
* @throws InvalidArgumentException
537539
*/
538540
public function dropDocumentDatabase(string $documentName, ?int $maxTimeMs = null, ?WriteConcern $writeConcern = null): void
539541
{
@@ -753,9 +755,9 @@ public function ensureSharding(?WriteConcern $writeConcern = null): void
753755
/**
754756
* Ensure sharding for collection by document name.
755757
*
756-
* @throws MongoDBException
757-
*
758758
* @psalm-param class-string $documentName
759+
*
760+
* @throws MongoDBException
759761
*/
760762
public function ensureDocumentSharding(string $documentName, ?WriteConcern $writeConcern = null): void
761763
{
@@ -780,9 +782,9 @@ public function ensureDocumentSharding(string $documentName, ?WriteConcern $writ
780782
/**
781783
* Enable sharding for database which contains documents with given name.
782784
*
783-
* @throws MongoDBException
784-
*
785785
* @psalm-param class-string $documentName
786+
*
787+
* @throws MongoDBException
786788
*/
787789
public function enableShardingForDbByDocumentName(string $documentName): void
788790
{

lib/Doctrine/ODM/MongoDB/Tools/ResolveTargetDocumentListener.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ public function loadClassMetadata(LoadClassMetadataEventArgs $args): void
9090

9191
/**
9292
* @param ClassMetadata<object> $classMetadata
93-
*
9493
* @psalm-param AssociationFieldMapping $mapping
9594
*/
9695
private function remapAssociation(ClassMetadata $classMetadata, array $mapping): void

lib/Doctrine/ODM/MongoDB/Types/Type.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,10 @@ public static function convertPHPToDatabaseValue($value)
200200
/**
201201
* Adds a custom type to the type map.
202202
*
203+
* @psalm-param class-string $className
204+
*
203205
* @throws MappingException
204206
*
205-
* @psalm-param class-string $className
206207
* @static
207208
*/
208209
public static function addType(string $name, string $className): void
@@ -227,9 +228,10 @@ public static function hasType(string $name): bool
227228
/**
228229
* Overrides an already defined type to use a different implementation.
229230
*
231+
* @psalm-param class-string $className
232+
*
230233
* @throws MappingException
231234
*
232-
* @psalm-param class-string $className
233235
* @static
234236
*/
235237
public static function overrideType(string $name, string $className): void

0 commit comments

Comments
 (0)