@@ -82,7 +82,7 @@ class DataMapper implements DataMapperInterface
8282
8383 /**
8484 * The list of relation loaders
85- * @var array<string, RelationLoader<TEntity>>
85+ * @var array<string, \Platine\Orm\Relation\ RelationLoader<TEntity>>
8686 */
8787 protected array $ loaders = [];
8888
@@ -170,7 +170,7 @@ public function __construct(
170170 $ this ->isNew = $ isNew ;
171171 $ this ->rawColumns = $ columns ;
172172
173- if ($ isNew && ! empty ($ columns )) {
173+ if ($ isNew && count ($ columns ) > 0 ) {
174174 $ this ->rawColumns = [];
175175 $ this ->fill ($ columns );
176176 }
@@ -223,13 +223,13 @@ public function isReadOnly(): bool
223223 */
224224 public function wasModified (): bool
225225 {
226- return ! empty ($ this ->modified ) || ! empty ($ this ->pendingLinks );
226+ return count ($ this ->modified ) > 0 || count ($ this ->pendingLinks ) > 0 ;
227227 }
228228
229229 /**
230230 * {@inheritedoc}
231231 */
232- public function getColumn (string $ name )
232+ public function getColumn (string $ name ): mixed
233233 {
234234 if ($ this ->refresh ) {
235235 $ this ->hydrate ();
@@ -274,7 +274,7 @@ public function getColumn(string $name)
274274 /**
275275 * {@inheritedoc}
276276 */
277- public function setColumn (string $ name , $ value ): void
277+ public function setColumn (string $ name , mixed $ value ): void
278278 {
279279 if ($ this ->isReadOnly ) {
280280 throw new EntityStateException ('The record is readonly ' );
@@ -345,7 +345,7 @@ public function getRawColumns(): array
345345 /**
346346 * {@inheritedoc}
347347 */
348- public function setRawColumn (string $ name , $ value ): void
348+ public function setRawColumn (string $ name , mixed $ value ): void
349349 {
350350 $ this ->modified [$ name ] = true ;
351351 unset($ this ->columns [$ name ]);
@@ -355,7 +355,7 @@ public function setRawColumn(string $name, $value): void
355355 /**
356356 * {@inheritedoc}
357357 */
358- public function getRelated (string $ name , callable $ callback = null )
358+ public function getRelated (string $ name , callable $ callback = null ): mixed
359359 {
360360 if (array_key_exists ($ name , $ this ->relations )) {
361361 return $ this ->relations [$ name ];
@@ -408,7 +408,7 @@ public function setRelated(string $name, ?Entity $entity = null): void
408408 ));
409409 }
410410
411- /** @var Relation<TEntity> $rel */
411+ /** @var \Platine\Orm\Relation\ Relation<TEntity> $rel */
412412 $ rel = $ relations [$ name ];
413413
414414 if (!($ rel instanceof BelongsTo) && !($ rel instanceof HasRelation)) {
@@ -499,7 +499,7 @@ public function fill(array $columns): void
499499 * @param mixed $id
500500 * @return bool
501501 */
502- public function markAsSaved ($ id ): bool
502+ public function markAsSaved (mixed $ id ): bool
503503 {
504504 $ primaryKey = $ this ->mapper ->getPrimaryKey ();
505505 if (!$ primaryKey ->isComposite ()) {
@@ -560,7 +560,7 @@ public function markAsDeleted(): bool
560560 public function executePendingLinkage (): void
561561 {
562562 foreach ($ this ->pendingLinks as $ item ) {
563- /** @var ShareOne<TEntity>|ShareMany<TEntity> $rel */
563+ /** @var \Platine\Orm\Relation\ ShareOne<TEntity>|\Platine\Orm\Relation\ ShareMany<TEntity> $rel */
564564 $ rel = $ item ['relation ' ];
565565
566566 if (isset ($ item ['link ' ])) {
@@ -581,7 +581,7 @@ public function executePendingLinkage(): void
581581 */
582582 protected function hydrate (): void
583583 {
584- if (! $ this ->refresh ) {
584+ if ($ this ->refresh === false ) {
585585 return ;
586586 }
587587
@@ -615,7 +615,7 @@ protected function hydrate(): void
615615 *
616616 * @return mixed
617617 */
618- protected function castGet ($ value , string $ type )
618+ protected function castGet (mixed $ value , string $ type ): mixed
619619 {
620620 $ original = $ type ;
621621
@@ -668,7 +668,7 @@ protected function castGet($value, string $type)
668668 *
669669 * @return mixed
670670 */
671- protected function castSet ($ value , string $ type )
671+ protected function castSet (mixed $ value , string $ type ): mixed
672672 {
673673 $ original = $ type ;
674674
@@ -730,7 +730,7 @@ private function setLink(string $relation, Entity $entity, bool $link): void
730730 ));
731731 }
732732
733- /** @var ShareRelation <TEntity> $rel */
733+ /** @var \Platine\Orm\Relation\Relation <TEntity> $rel */
734734 $ rel = $ relations [$ relation ];
735735 if (!($ rel instanceof ShareRelation)) {
736736 throw new RuntimeException ('Unsupported relation type ' );
0 commit comments