Skip to content

Commit 6ac7975

Browse files
committed
Simplification
1 parent 678fea3 commit 6ac7975

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

src/Reflection/Php/PhpClassReflectionExtension.php

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,19 @@ private function createProperty(
290290
} elseif (isset($varTags[$propertyName])) {
291291
$phpDocType = $varTags[$propertyName]->getType();
292292
}
293+
294+
if (!isset($phpDocBlockClassReflection)) {
295+
throw new ShouldNotHappenException();
296+
}
297+
298+
$phpDocType = $phpDocType !== null ? TemplateTypeHelper::resolveTemplateTypes(
299+
$phpDocType,
300+
$phpDocBlockClassReflection->getActiveTemplateTypeMap(),
301+
) : null;
302+
$deprecatedDescription = $resolvedPhpDoc->getDeprecatedTag() !== null ? $resolvedPhpDoc->getDeprecatedTag()->getMessage() : null;
303+
$isDeprecated = $resolvedPhpDoc->isDeprecated();
304+
$isInternal = $resolvedPhpDoc->isInternal();
305+
$isReadOnlyByPhpDoc = $isReadOnlyByPhpDoc || $resolvedPhpDoc->isReadOnly();
293306
}
294307

295308
if ($phpDocType === null) {
@@ -315,20 +328,6 @@ private function createProperty(
315328
}
316329
}
317330

318-
if ($resolvedPhpDoc !== null) {
319-
if (!isset($phpDocBlockClassReflection)) {
320-
throw new ShouldNotHappenException();
321-
}
322-
$phpDocType = $phpDocType !== null ? TemplateTypeHelper::resolveTemplateTypes(
323-
$phpDocType,
324-
$phpDocBlockClassReflection->getActiveTemplateTypeMap(),
325-
) : null;
326-
$deprecatedDescription = $resolvedPhpDoc->getDeprecatedTag() !== null ? $resolvedPhpDoc->getDeprecatedTag()->getMessage() : null;
327-
$isDeprecated = $resolvedPhpDoc->isDeprecated();
328-
$isInternal = $resolvedPhpDoc->isInternal();
329-
$isReadOnlyByPhpDoc = $isReadOnlyByPhpDoc || $resolvedPhpDoc->isReadOnly();
330-
}
331-
332331
if (
333332
$phpDocType === null
334333
&& $this->inferPrivatePropertyTypeFromConstructor

0 commit comments

Comments
 (0)