Skip to content

Commit 257216b

Browse files
Revert "Rework"
This reverts commit 9b80946.
1 parent 2cdc247 commit 257216b

File tree

2 files changed

+5
-20
lines changed

2 files changed

+5
-20
lines changed

src/PhpDoc/ResolvedPhpDocBlock.php

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,10 @@ public static function createEmpty(): self
252252
*/
253253
public function merge(array $parents, array $parentPhpDocBlocks): self
254254
{
255-
$classReflection = $this->getClassReflection();
255+
$className = $this->nameScope !== null ? $this->nameScope->getClassName() : null;
256+
$classReflection = $className !== null && $this->reflectionProvider->hasClass($className)
257+
? $this->reflectionProvider->getClass($className)
258+
: null;
256259

257260
// new property also needs to be added to createEmpty()
258261
$result = new self();
@@ -458,16 +461,6 @@ public function getNullableNameScope(): ?NameScope
458461
return $this->nameScope;
459462
}
460463

461-
private function getClassReflection(): ?ClassReflection
462-
{
463-
$className = $this->nameScope?->getClassName();
464-
if ($className === null || !$this->reflectionProvider->hasClass($className)) {
465-
return null;
466-
}
467-
468-
return $this->reflectionProvider->getClass($className);
469-
}
470-
471464
/**
472465
* @return array<(string|int), VarTag>
473466
*/
@@ -834,14 +827,6 @@ public function isPure(): ?bool
834827
return $this->isPure;
835828
}
836829

837-
if ($this->nameScope !== null) {
838-
$classReflection = $this->getClassReflection();
839-
if ($classReflection !== null) {
840-
$this->isPure = $classReflection->getDefaultMethodPurity();
841-
return $this->isPure;
842-
}
843-
}
844-
845830
$this->isPure = null;
846831
}
847832

src/Reflection/Php/PhpClassReflectionExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -892,7 +892,7 @@ public function createUserlandMethodReflection(ClassReflection $fileDeclaringCla
892892
}
893893
}
894894

895-
$isPure ??= $resolvedPhpDoc->isPure();
895+
$isPure ??= $resolvedPhpDoc->isPure() ?? $phpDocBlockClassReflection->getDefaultMethodPurity();
896896
$asserts = Assertions::createFromResolvedPhpDocBlock($resolvedPhpDoc);
897897
$acceptsNamedArguments = $resolvedPhpDoc->acceptsNamedArguments();
898898
$selfOutType = $resolvedPhpDoc->getSelfOutTag() !== null ? $resolvedPhpDoc->getSelfOutTag()->getType() : null;

0 commit comments

Comments
 (0)