44
44
*
45
45
* $config = new Configuration();
46
46
* $dm = DocumentManager::create(new Connection(), $config);
47
+ *
48
+ * @psalm-import-type CommitOptions from UnitOfWork
47
49
*/
48
50
class Configuration
49
51
{
@@ -82,6 +84,25 @@ class Configuration
82
84
* Array of attributes for this configuration instance.
83
85
*
84
86
* @var array
87
+ * @psalm-var array{
88
+ * autoGenerateHydratorClasses?: self::AUTOGENERATE_*,
89
+ * autoGeneratePersistentCollectionClasses?: self::AUTOGENERATE_*,
90
+ * defaultCommitOptions?: CommitOptions,
91
+ * defaultDocumentRepositoryClassName?: string,
92
+ * documentNamespaces?: array<string, string>,
93
+ * filters?: array<string, array{
94
+ * class: string,
95
+ * parameters: array<string, mixed>
96
+ * }>,
97
+ * hydratorDir?: string,
98
+ * hydratorNamespace?: string,
99
+ * metadataCacheImpl?: Cache,
100
+ * metadataDriverImpl?: MappingDriver,
101
+ * persistentCollectionFactory?: PersistentCollectionFactory,
102
+ * persistentCollectionGenerator?: PersistentCollectionGenerator,
103
+ * persistentCollectionDir?: string,
104
+ * repositoryFactory?: RepositoryFactory
105
+ * }
85
106
*/
86
107
private $ attributes = [];
87
108
@@ -124,6 +145,8 @@ public function getDocumentNamespace(string $documentNamespaceAlias): string
124
145
125
146
/**
126
147
* Retrieves the list of registered document namespace aliases.
148
+ *
149
+ * @return array<string, string>
127
150
*/
128
151
public function getDocumentNamespaces (): array
129
152
{
@@ -132,6 +155,8 @@ public function getDocumentNamespaces(): array
132
155
133
156
/**
134
157
* Set the document alias map
158
+ *
159
+ * @param array<string, string> $documentNamespaces
135
160
*/
136
161
public function setDocumentNamespaces (array $ documentNamespaces ): void
137
162
{
@@ -151,6 +176,8 @@ public function setMetadataDriverImpl(MappingDriver $driverImpl): void
151
176
152
177
/**
153
178
* Add a new default annotation driver with a correctly configured annotation reader.
179
+ *
180
+ * @param string[] $paths
154
181
*/
155
182
public function newDefaultAnnotationDriver (array $ paths = []): AnnotationDriver
156
183
{
@@ -287,6 +314,8 @@ public function getHydratorDir(): ?string
287
314
/**
288
315
* Gets an int flag that indicates whether hydrator classes should always be regenerated
289
316
* during each script execution.
317
+ *
318
+ * @psalm-return self::AUTOGENERATE_*
290
319
*/
291
320
public function getAutoGenerateHydratorClasses (): int
292
321
{
@@ -296,6 +325,8 @@ public function getAutoGenerateHydratorClasses(): int
296
325
/**
297
326
* Sets an int flag that indicates whether hydrator classes should always be regenerated
298
327
* during each script execution.
328
+ *
329
+ * @psalm-param self::AUTOGENERATE_* $mode
299
330
*/
300
331
public function setAutoGenerateHydratorClasses (int $ mode ): void
301
332
{
@@ -325,6 +356,8 @@ public function getPersistentCollectionDir(): ?string
325
356
/**
326
357
* Gets a integer flag that indicates how and when persistent collection
327
358
* classes should be generated.
359
+ *
360
+ * @psalm-return self::AUTOGENERATE_*
328
361
*/
329
362
public function getAutoGeneratePersistentCollectionClasses (): int
330
363
{
@@ -334,6 +367,8 @@ public function getAutoGeneratePersistentCollectionClasses(): int
334
367
/**
335
368
* Sets a integer flag that indicates how and when persistent collection
336
369
* classes should be generated.
370
+ *
371
+ * @psalm-param self::AUTOGENERATE_* $mode
337
372
*/
338
373
public function setAutoGeneratePersistentCollectionClasses (int $ mode ): void
339
374
{
@@ -381,6 +416,9 @@ public function getClassMetadataFactoryName(): string
381
416
return $ this ->attributes ['classMetadataFactoryName ' ];
382
417
}
383
418
419
+ /**
420
+ * @psalm-return CommitOptions
421
+ */
384
422
public function getDefaultCommitOptions (): array
385
423
{
386
424
if (! isset ($ this ->attributes ['defaultCommitOptions ' ])) {
@@ -390,13 +428,19 @@ public function getDefaultCommitOptions(): array
390
428
return $ this ->attributes ['defaultCommitOptions ' ];
391
429
}
392
430
431
+ /**
432
+ * @psalm-param CommitOptions $defaultCommitOptions
433
+ */
393
434
public function setDefaultCommitOptions (array $ defaultCommitOptions ): void
394
435
{
395
436
$ this ->attributes ['defaultCommitOptions ' ] = $ defaultCommitOptions ;
396
437
}
397
438
398
439
/**
399
440
* Add a filter to the list of possible filters.
441
+ *
442
+ * @param array<string, mixed> $parameters
443
+ * @psalm-param class-string $className
400
444
*/
401
445
public function addFilter (string $ name , string $ className , array $ parameters = []): void
402
446
{
@@ -413,6 +457,9 @@ public function getFilterClassName(string $name): ?string
413
457
: null ;
414
458
}
415
459
460
+ /**
461
+ * @return array<string, mixed>
462
+ */
416
463
public function getFilterParameters (string $ name ): array
417
464
{
418
465
return isset ($ this ->attributes ['filters ' ][$ name ])
0 commit comments