Skip to content

Commit 9d738d6

Browse files
author
matheo
committed
refactoring and renaming
1 parent 11b9210 commit 9d738d6

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/LiveComponent/src/LiveComponentHydrator.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -394,14 +394,14 @@ private function dehydrateObjectValue(object $value, string $classType, ?string
394394
}
395395
}
396396

397-
$hydratedObject = [];
397+
$dehydratedObjectValues = [];
398398
foreach ((new \ReflectionClass($classType))->getProperties() as $property) {
399399
$propertyValue = $this->propertyAccessor->getValue($value, $property->getName());
400-
$propMetadata = $this->liveComponentMetadataFactory->createLivePropMetadata($classType, $property->getName(), $property);
401-
$hydratedObject[$property->getName()] = $this->dehydrateValue($propertyValue, $propMetadata, $component);
400+
$propMetadata = $this->liveComponentMetadataFactory->createLivePropMetadata($classType, $property->getName(), $property, new LiveProp());
401+
$dehydratedObjectValues[$property->getName()] = $this->dehydrateValue($propertyValue, $propMetadata, $component);
402402
}
403403

404-
return $hydratedObject;
404+
return $dehydratedObjectValues;
405405
}
406406

407407
private function hydrateValue(mixed $value, LivePropMetadata $propMetadata, object $component): mixed
@@ -481,7 +481,7 @@ private function hydrateObjectValue(mixed $value, string $className, bool $allow
481481
foreach ($value as $propertyName => $propertyValue) {
482482
$reflexionClass = new \ReflectionClass($className);
483483
$property = $reflexionClass->getProperty($propertyName);
484-
$propMetadata = $this->liveComponentMetadataFactory->createLivePropMetadata($className, $propertyName, $property);
484+
$propMetadata = $this->liveComponentMetadataFactory->createLivePropMetadata($className, $propertyName, $property, new LiveProp());
485485
$this->propertyAccessor->setValue($object, $propertyName, $this->hydrateValue($propertyValue, $propMetadata, $component));
486486
}
487487

src/LiveComponent/src/Metadata/LiveComponentMetadataFactory.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@ public function createPropMetadatas(\ReflectionClass $class): array
5959
continue;
6060
}
6161

62-
$metadatas[$property->getName()] = $this->createLivePropMetadata($class->getName(), $property->getName(), $property, $attribute);
62+
$metadatas[$property->getName()] = $this->createLivePropMetadata($class->getName(), $property->getName(), $property, $attribute->newInstance());
6363
}
6464

6565
return array_values($metadatas);
6666
}
6767

68-
public function createLivePropMetadata(string $className, string $propertyName, \ReflectionProperty $property, \ReflectionAttribute $attribute = null): LivePropMetadata
68+
public function createLivePropMetadata(string $className, string $propertyName, \ReflectionProperty $property, LiveProp $liveProp): LivePropMetadata
6969
{
7070
$collectionValueType = null;
7171
$infoTypes = $this->propertyTypeExtractor->getTypes($className, $propertyName) ?? [];
@@ -85,7 +85,7 @@ public function createLivePropMetadata(string $className, string $propertyName,
8585

8686
return new LivePropMetadata(
8787
$property->getName(),
88-
null !== $attribute ? $attribute->newInstance() : new LiveProp(true),
88+
$liveProp,
8989
$type?->getName(),
9090
$type && $type->isBuiltin(),
9191
!$type || $type->allowsNull(),

0 commit comments

Comments
 (0)