66
77use Doctrine \ORM \EntityManager ;
88use Doctrine \ORM \EntityManagerInterface ;
9+ use Doctrine \ORM \Mapping \EntityListenerResolver as EntityListenerResolverInterface ;
10+ use Doctrine \Persistence \Mapping \Driver \MappingDriver ;
911use Doctrine \Persistence \Mapping \Driver \MappingDriverChain ;
1012use Dot \Cache \Adapter \ArrayAdapter ;
1113use Dot \Cache \Adapter \FilesystemAdapter ;
1214use Light \App \Factory \GetIndexViewHandlerFactory ;
1315use Light \App \Handler \GetIndexViewHandler ;
1416use Mezzio \Application ;
15- use Ramsey \Uuid \Doctrine \UuidBinaryOrderedTimeType ;
16- use Ramsey \Uuid \Doctrine \UuidBinaryType ;
1717use Ramsey \Uuid \Doctrine \UuidType ;
1818use Roave \PsrContainerDoctrine \EntityManagerFactory ;
19+ use Symfony \Component \Cache \Adapter \AdapterInterface ;
1920
2021use function getcwd ;
2122
23+ /**
24+ * @phpstan-type ConfigType array{
25+ * dependencies: DependenciesType,
26+ * doctrine: DoctrineConfigType,
27+ * resultCacheLifetime: int,
28+ * }
29+ * @phpstan-type DoctrineConfigType array{
30+ * cache: array{
31+ * array: array{
32+ * class: class-string<AdapterInterface>,
33+ * },
34+ * filesystem: array{
35+ * class: class-string<AdapterInterface>,
36+ * directory: non-empty-string,
37+ * namespace: non-empty-string,
38+ * },
39+ * },
40+ * configuration: array{
41+ * orm_default: array{
42+ * entity_listener_resolver: class-string<EntityListenerResolverInterface>,
43+ * result_cache: non-empty-string,
44+ * metadata_cache: non-empty-string,
45+ * query_cache: non-empty-string,
46+ * hydration_cache: non-empty-string,
47+ * typed_field_mapper: non-empty-string|null,
48+ * second_level_cache: array{
49+ * enabled: bool,
50+ * default_lifetime: int,
51+ * default_lock_lifetime: int,
52+ * file_lock_region_directory: string,
53+ * regions: string[],
54+ * },
55+ * },
56+ * },
57+ * driver: array{
58+ * orm_default: array{
59+ * class: class-string<MappingDriver>,
60+ * },
61+ * },
62+ * migrations: array{
63+ * migrations_paths: array<non-empty-string, non-empty-string>,
64+ * all_or_nothing: bool,
65+ * check_database_platform: bool,
66+ * },
67+ * types: array<non-empty-string, class-string>,
68+ * }
69+ * @phpstan-type DependenciesType array{
70+ * factories: array<class-string|non-empty-string, class-string|non-empty-string>,
71+ * aliases: array<class-string|non-empty-string, class-string|non-empty-string>,
72+ * }
73+ */
74+
2275class ConfigProvider
2376{
2477 /**
2578 @return array{
2679 * dependencies: array<mixed>,
80+ * doctrine: array<mixed>,
2781 * templates: array<mixed>,
2882 * }
2983 */
@@ -37,10 +91,7 @@ public function __invoke(): array
3791 }
3892
3993 /**
40- * @return array{
41- * delegators: array<class-string, array<class-string>>,
42- * factories: array<class-string, class-string>,
43- * }
94+ * @return DependenciesType
4495 */
4596 public function getDependencies (): array
4697 {
@@ -83,6 +134,9 @@ public function getTemplates(): array
83134 ];
84135 }
85136
137+ /**
138+ * @return DoctrineConfigType
139+ */
86140 private function getDoctrineConfig (): array
87141 {
88142 return [
@@ -98,12 +152,13 @@ private function getDoctrineConfig(): array
98152 ],
99153 'configuration ' => [
100154 'orm_default ' => [
101- 'result_cache ' => 'filesystem ' ,
102- 'metadata_cache ' => 'filesystem ' ,
103- 'query_cache ' => 'filesystem ' ,
104- 'hydration_cache ' => 'array ' ,
105- 'typed_field_mapper ' => null ,
106- 'second_level_cache ' => [
155+ 'entity_listener_resolver ' => EntityListenerResolverInterface::class,
156+ 'result_cache ' => 'filesystem ' ,
157+ 'metadata_cache ' => 'filesystem ' ,
158+ 'query_cache ' => 'filesystem ' ,
159+ 'hydration_cache ' => 'array ' ,
160+ 'typed_field_mapper ' => null ,
161+ 'second_level_cache ' => [
107162 'enabled ' => true ,
108163 'default_lifetime ' => 3600 ,
109164 'default_lock_lifetime ' => 60 ,
0 commit comments