@@ -31,64 +31,52 @@ abstract class AbstractHydrator
3131{
3232 /**
3333 * The ResultSetMapping.
34- *
35- * @var ResultSetMapping|null
3634 */
37- protected $ _rsm ;
35+ protected ? ResultSetMapping $ _rsm = null ;
3836
3937 /**
4038 * The EntityManager instance.
41- *
42- * @var EntityManagerInterface
4339 */
44- protected $ _em ;
40+ protected EntityManagerInterface $ _em ;
4541
4642 /**
4743 * The dbms Platform instance.
48- *
49- * @var AbstractPlatform
5044 */
51- protected $ _platform ;
45+ protected AbstractPlatform $ _platform ;
5246
5347 /**
5448 * The UnitOfWork of the associated EntityManager.
55- *
56- * @var UnitOfWork
5749 */
58- protected $ _uow ;
50+ protected UnitOfWork $ _uow ;
5951
6052 /**
6153 * Local ClassMetadata cache to avoid going to the EntityManager all the time.
6254 *
6355 * @var array<string, ClassMetadata<object>>
6456 */
65- protected $ _metadataCache = [];
57+ protected array $ _metadataCache = [];
6658
6759 /**
6860 * The cache used during row-by-row hydration.
6961 *
7062 * @var array<string, mixed[]|null>
7163 */
72- protected $ _cache = [];
64+ protected array $ _cache = [];
7365
7466 /**
7567 * The statement that provides the data to hydrate.
76- *
77- * @var Result|null
7868 */
79- protected $ _stmt ;
69+ protected ? Result $ _stmt = null ;
8070
8171 /**
8272 * The query hints.
8373 *
8474 * @var array<string, mixed>
8575 */
86- protected $ _hints = [];
76+ protected array $ _hints = [];
8777
8878 /**
8979 * Initializes a new instance of a class derived from <tt>AbstractHydrator</tt>.
90- *
91- * @param EntityManagerInterface $em The EntityManager to use.
9280 */
9381 public function __construct (EntityManagerInterface $ em )
9482 {
@@ -166,10 +154,8 @@ final protected function resultSetMapping(): ResultSetMapping
166154 * Hydrates all rows returned by the passed statement instance at once.
167155 *
168156 * @psalm-param array<string, string> $hints
169- *
170- * @return mixed[]
171157 */
172- public function hydrateAll (Result $ stmt , ResultSetMapping $ resultSetMapping , array $ hints = [])
158+ public function hydrateAll (Result $ stmt , ResultSetMapping $ resultSetMapping , array $ hints = []): mixed
173159 {
174160 $ this ->_stmt = $ stmt ;
175161 $ this ->_rsm = $ resultSetMapping ;
@@ -190,32 +176,24 @@ public function hydrateAll(Result $stmt, ResultSetMapping $resultSetMapping, arr
190176 /**
191177 * When executed in a hydrate() loop we have to clear internal state to
192178 * decrease memory consumption.
193- *
194- * @param mixed $eventArgs
195- *
196- * @return void
197179 */
198- public function onClear ($ eventArgs )
180+ public function onClear (mixed $ eventArgs ): void
199181 {
200182 }
201183
202184 /**
203185 * Executes one-time preparation tasks, once each time hydration is started
204186 * through {@link hydrateAll} or {@link toIterable()}.
205- *
206- * @return void
207187 */
208- protected function prepare ()
188+ protected function prepare (): void
209189 {
210190 }
211191
212192 /**
213193 * Executes one-time cleanup tasks at the end of a hydration that was initiated
214194 * through {@link hydrateAll} or {@link toIterable()}.
215- *
216- * @return void
217195 */
218- protected function cleanup ()
196+ protected function cleanup (): void
219197 {
220198 $ this ->statement ()->free ();
221199
@@ -242,21 +220,17 @@ protected function cleanupAfterRowIteration(): void
242220 * @param mixed[] $row The row data.
243221 * @param mixed[] $result The result to fill.
244222 *
245- * @return void
246- *
247223 * @throws HydrationException
248224 */
249- protected function hydrateRowData (array $ row , array &$ result )
225+ protected function hydrateRowData (array $ row , array &$ result ): void
250226 {
251227 throw new HydrationException ('hydrateRowData() not implemented by this hydrator. ' );
252228 }
253229
254230 /**
255231 * Hydrates all rows from the current statement instance at once.
256- *
257- * @return mixed[]
258232 */
259- abstract protected function hydrateAllData ();
233+ abstract protected function hydrateAllData (): mixed ;
260234
261235 /**
262236 * Processes a row of the result set.
@@ -284,7 +258,7 @@ abstract protected function hydrateAllData();
284258 * scalars?: array
285259 * }
286260 */
287- protected function gatherRowData (array $ data , array &$ id , array &$ nonemptyComponents )
261+ protected function gatherRowData (array $ data , array &$ id , array &$ nonemptyComponents ): array
288262 {
289263 $ rowData = ['data ' => []];
290264
@@ -365,7 +339,7 @@ protected function gatherRowData(array $data, array &$id, array &$nonemptyCompon
365339 * @return mixed[] The processed row.
366340 * @psalm-return array<string, mixed>
367341 */
368- protected function gatherScalarRowData (&$ data )
342+ protected function gatherScalarRowData (array &$ data ): array
369343 {
370344 $ rowData = [];
371345
@@ -400,7 +374,7 @@ protected function gatherScalarRowData(&$data)
400374 * @return mixed[]|null
401375 * @psalm-return array<string, mixed>|null
402376 */
403- protected function hydrateColumnInfo ($ key )
377+ protected function hydrateColumnInfo (string $ key ): ? array
404378 {
405379 if (isset ($ this ->_cache [$ key ])) {
406380 return $ this ->_cache [$ key ];
@@ -508,12 +482,8 @@ function (string $subClass): string {
508482
509483 /**
510484 * Retrieve ClassMetadata associated to entity class name.
511- *
512- * @param string $className
513- *
514- * @return ClassMetadata
515485 */
516- protected function getClassMetadata ($ className )
486+ protected function getClassMetadata (string $ className ): ClassMetadata
517487 {
518488 if (! isset ($ this ->_metadataCache [$ className ])) {
519489 $ this ->_metadataCache [$ className ] = $ this ->_em ->getClassMetadata ($ className );
@@ -525,14 +495,11 @@ protected function getClassMetadata($className)
525495 /**
526496 * Register entity as managed in UnitOfWork.
527497 *
528- * @param object $entity
529498 * @param mixed[] $data
530499 *
531- * @return void
532- *
533500 * @todo The "$id" generation is the same of UnitOfWork#createEntity. Remove this duplication somehow
534501 */
535- protected function registerManaged (ClassMetadata $ class , $ entity , array $ data )
502+ protected function registerManaged (ClassMetadata $ class , object $ entity , array $ data ): void
536503 {
537504 if ($ class ->isIdentifierComposite ) {
538505 $ id = [];
0 commit comments