valueA; } public function valueB(): string { return $this->valueB; } public function valueC(): string { return $this->valueC; } }; $class = FakeClassDefinition::fromReflection(new ReflectionClass($object)); $objectBuilder = new ReflectionObjectBuilder($class); $result = $objectBuilder->build([ 'valueA' => 'valueA', 'valueB' => 'valueB', 'valueC' => 'valueC', ]); self::assertSame('valueA', $result->valueA()); // @phpstan-ignore-line self::assertSame('valueB', $result->valueB()); // @phpstan-ignore-line self::assertSame('valueC', $result->valueC()); // @phpstan-ignore-line } public function test_arguments_instance_stays_the_same(): void { $class = FakeClassDefinition::new(); $objectBuilder = new ReflectionObjectBuilder($class); $argumentsA = $objectBuilder->describeArguments(); $argumentsB = $objectBuilder->describeArguments(); self::assertSame($argumentsA, $argumentsB); } public function test_missing_arguments_throws_exception(): void { $object = new class () { public string $value; }; $class = FakeClassDefinition::fromReflection(new ReflectionClass($object)); $objectBuilder = new ReflectionObjectBuilder($class); $this->expectException(MissingPropertyArgument::class); $this->expectExceptionCode(1629469529); $this->expectExceptionMessage("Missing value `Signature::value` of type `string`."); $objectBuilder->build([]); } }