File tree Expand file tree Collapse file tree 2 files changed +24
-5
lines changed Expand file tree Collapse file tree 2 files changed +24
-5
lines changed Original file line number Diff line number Diff line change @@ -252,10 +252,7 @@ public static function createEmpty(): self
252
252
*/
253
253
public function merge (array $ parents , array $ parentPhpDocBlocks ): self
254
254
{
255
- $ className = $ this ->nameScope !== null ? $ this ->nameScope ->getClassName () : null ;
256
- $ classReflection = $ className !== null && $ this ->reflectionProvider ->hasClass ($ className )
257
- ? $ this ->reflectionProvider ->getClass ($ className )
258
- : null ;
255
+ $ classReflection = $ this ->getClassReflection ();
259
256
260
257
// new property also needs to be added to createEmpty()
261
258
$ result = new self ();
@@ -461,6 +458,20 @@ public function getNullableNameScope(): ?NameScope
461
458
return $ this ->nameScope ;
462
459
}
463
460
461
+ private function getClassReflection (): ?ClassReflection
462
+ {
463
+ if ($ this ->nameScope === null ) {
464
+ return null ;
465
+ }
466
+
467
+ $ className = $ this ->nameScope ->getClassName ();
468
+ if (!$ this ->reflectionProvider ->hasClass ($ className )) {
469
+ return null ;
470
+ }
471
+
472
+ return $ this ->reflectionProvider ->getClass ($ className );
473
+ }
474
+
464
475
/**
465
476
* @return array<(string|int), VarTag>
466
477
*/
@@ -827,6 +838,14 @@ public function isPure(): ?bool
827
838
return $ this ->isPure ;
828
839
}
829
840
841
+ if ($ this ->nameScope !== null ) {
842
+ $ classReflection = $ this ->getClassReflection ();
843
+ if ($ classReflection !== null ) {
844
+ $ this ->isPure = $ classReflection ->getDefaultMethodPurity ();
845
+ return $ this ->isPure ;
846
+ }
847
+ }
848
+
830
849
$ this ->isPure = null ;
831
850
}
832
851
Original file line number Diff line number Diff line change @@ -892,7 +892,7 @@ public function createUserlandMethodReflection(ClassReflection $fileDeclaringCla
892
892
}
893
893
}
894
894
895
- $ isPure ??= $ resolvedPhpDoc ->isPure () ?? $ phpDocBlockClassReflection -> getDefaultMethodPurity () ;
895
+ $ isPure ??= $ resolvedPhpDoc ->isPure ();
896
896
$ asserts = Assertions::createFromResolvedPhpDocBlock ($ resolvedPhpDoc );
897
897
$ acceptsNamedArguments = $ resolvedPhpDoc ->acceptsNamedArguments ();
898
898
$ selfOutType = $ resolvedPhpDoc ->getSelfOutTag () !== null ? $ resolvedPhpDoc ->getSelfOutTag ()->getType () : null ;
You can’t perform that action at this time.
0 commit comments