classReflectionHydrator
final class ReflectionHydrator
implements HydratorInterface
Hydrates rows through constructor parameters or existing object properties.
Methods§
public function hydrate<T of object>(array<string, mixed> $data, class-string<T> $className): TParameters
$data | array<string, mixed> | |
$className | class-string<T> |
Returns
TThrows
ReflectionException When the requested object cannot be reflected or instantiatedTest cases 43
HydratorInterfaceTest::testHydrateConvertsDatabaseScalarValuescallsConstructorHydrationTest::testHydrateViaConstructorConvertsDeclaredArgumentscallsPropertyHydrationTest::testHydrateViaPropertiesMapsSnakeCaseToCamelCasecallsPropertyHydrationTest::testSetPropertyConvertsTheDatabaseValuecallsReflectionHydratorTest::testCastArrayFromAlreadyArraycallsReflectionHydratorTest::testCastBoolToArrayViaCastValuecallsReflectionHydratorTest::testCastFloatFromIntcallsReflectionHydratorTest::testCastIntFromFloatcallsReflectionHydratorTest::testCastIntToArrayViaCastValuecallsReflectionHydratorTest::testCastNullReturnsNullcallsReflectionHydratorTest::testCastsArrayFromNonJsonStringcallsReflectionHydratorTest::testCastsArrayValuecallsReflectionHydratorTest::testCastsBoolFalseValuecallsReflectionHydratorTest::testCastsBoolFromFalsyValuecallsReflectionHydratorTest::testCastsBoolFromTruthyValuecallsReflectionHydratorTest::testCastsBoolValuecallsReflectionHydratorTest::testCastsFloatValuecallsReflectionHydratorTest::testCastsFloatValueFromNumericStringcallsReflectionHydratorTest::testCastsIntValuecallsReflectionHydratorTest::testCastsIntValueFromNumericStringcallsReflectionHydratorTest::testCastsStringFromIntValuecallsReflectionHydratorTest::testCastsStringValuecallsReflectionHydratorTest::testCastStringFromBoolcallsReflectionHydratorTest::testCastStringFromFloatcallsReflectionHydratorTest::testHydrateIgnoresExtraDatacallsReflectionHydratorTest::testHydratePreservesArrayInMixedNamePropertycallsReflectionHydratorTest::testHydratePreservesStringInMixedAmountPropertycallsReflectionHydratorTest::testHydratePreservesStringInMixedIdPropertycallsReflectionHydratorTest::testHydrateViaConstructorcallsReflectionHydratorTest::testHydrateViaConstructorWithEmptyConstructorcallsReflectionHydratorTest::testHydrateViaPropertiescallsReflectionHydratorTest::testHydrateViaPropertiesDirectKeycallsReflectionHydratorTest::testHydrateViaPropertiesIgnoresUnknownKeyscallsReflectionHydratorTest::testHydrateViaPropertiesSkipsUnknownAndContinuescallsReflectionHydratorTest::testHydrateViaPropertiesWithCastingcallsReflectionHydratorTest::testHydrateViaPropertiesWithSnakeCasecallsReflectionHydratorTest::testHydrateWithDefaultValuescallsReflectionHydratorTest::testHydrateWithMixedTypecallsReflectionHydratorTest::testHydrateWithNullableParametercallsReflectionHydratorTest::testHydrateWithSnakeCasePropertiescallsReflectionHydratorTest::testHydrateWithSnakeCaseToConstructorcallsReflectionHydratorTest::testThrowsExceptionForMissingRequiredParametercallsReflectionHydratorTest::testThrowsExceptionForNonExistentClasscalls
Calls 8
- function-call
class_existsline 26 - new ClassNotFoundException line 27
- new
ReflectionClassline 30 - method-call
ReflectionClass::getConstructor()line 31 - method-call ConstructorHydration::hydrateViaConstructor() line 34
- new ConstructorHydration line 34
- method-call PropertyHydration::hydrateViaProperties() line 37
- new PropertyHydration line 37
Test cases 54§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 39
ReflectionHydratorTest::testCastArrayFromAlreadyArraycallsReflectionHydratorTest::testCastBoolToArrayViaCastValuecallsReflectionHydratorTest::testCastFloatFromIntcallsReflectionHydratorTest::testCastIntFromFloatcallsReflectionHydratorTest::testCastIntToArrayViaCastValuecallsReflectionHydratorTest::testCastNullReturnsNullcallsReflectionHydratorTest::testCastsArrayFromNonJsonStringcallsReflectionHydratorTest::testCastsArrayValuecallsReflectionHydratorTest::testCastsBoolFalseValuecallsReflectionHydratorTest::testCastsBoolFromFalsyValuecallsReflectionHydratorTest::testCastsBoolFromTruthyValuecallsReflectionHydratorTest::testCastsBoolValuecallsReflectionHydratorTest::testCastsFloatValuecallsReflectionHydratorTest::testCastsFloatValueFromNumericStringcallsReflectionHydratorTest::testCastsIntValuecallsReflectionHydratorTest::testCastsIntValueFromNumericStringcallsReflectionHydratorTest::testCastsStringFromIntValuecallsReflectionHydratorTest::testCastsStringValuecallsReflectionHydratorTest::testCastStringFromBoolcallsReflectionHydratorTest::testCastStringFromFloatcallsReflectionHydratorTest::testHydrateIgnoresExtraDatacallsReflectionHydratorTest::testHydratePreservesArrayInMixedNamePropertycallsReflectionHydratorTest::testHydratePreservesStringInMixedAmountPropertycallsReflectionHydratorTest::testHydratePreservesStringInMixedIdPropertycallsReflectionHydratorTest::testHydrateViaConstructorcallsReflectionHydratorTest::testHydrateViaConstructorWithEmptyConstructorcallsReflectionHydratorTest::testHydrateViaPropertiescallsReflectionHydratorTest::testHydrateViaPropertiesDirectKeycallsReflectionHydratorTest::testHydrateViaPropertiesIgnoresUnknownKeyscallsReflectionHydratorTest::testHydrateViaPropertiesSkipsUnknownAndContinuescallsReflectionHydratorTest::testHydrateViaPropertiesWithCastingcallsReflectionHydratorTest::testHydrateViaPropertiesWithSnakeCasecallsReflectionHydratorTest::testHydrateWithDefaultValuescallsReflectionHydratorTest::testHydrateWithMixedTypecallsReflectionHydratorTest::testHydrateWithNullableParametercallsReflectionHydratorTest::testHydrateWithSnakeCasePropertiescallsReflectionHydratorTest::testHydrateWithSnakeCaseToConstructorcallsReflectionHydratorTest::testThrowsExceptionForMissingRequiredParametercallsReflectionHydratorTest::testThrowsExceptionForNonExistentClasscalls
Other tests reaching this symbol 15
PostgreSqlEndToEndTestcallsSqliteIntegrationTestcallsDatabaseFixtureProviderTestcallsFileFixtureProviderTestcallsRowMaterializerTestcallsPlanGeneratorTestcallsRowGenerationTestcallsFixtureGeneratorTest::testConfigureWithCustomDependenciescallsFixtureGeneratorTest::testGetHydratorcallsFixtureProviderTestcallsHydratorInterfaceTest::testHydrateConvertsDatabaseScalarValuescallsConstructorHydrationTest::testHydrateViaConstructorConvertsDeclaredArgumentscallsPropertyHydrationTest::testHydrateViaPropertiesMapsSnakeCaseToCamelCasecallsPropertyHydrationTest::testSetPropertyConvertsTheDatabaseValuecallsSqlSchemaProviderTestcalls