Skip to content

Commit 8cf537b

Browse files
committed
Do not Type-Check twice
1 parent 4bdcba4 commit 8cf537b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Diff for: src/DataTransferValue.php

+7
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,17 @@ private function tryResolvingIntoObject(): void
8282
*/
8383
private function validate(): void
8484
{
85+
$typeChecked = false;
8586
foreach ($this->property->getAttributes(Validation::class, ReflectionAttribute::IS_INSTANCEOF) as $attribute) {
8687
/** @var Validation $validation */
8788
$validation = $attribute->newInstance();
8889
$validation->validate($this->value);
90+
91+
$typeChecked = $typeChecked || $validation instanceof Type;
92+
}
93+
94+
if ($typeChecked) {
95+
return;
8996
}
9097

9198
$type = $this->property->getType();

0 commit comments

Comments
 (0)