@@ -139,8 +139,9 @@ final class ResolvedPhpDocBlock
139
139
/** @var bool|'notLoaded'|null */
140
140
private bool |string |null $ isPure = 'notLoaded ' ;
141
141
142
- /** @var bool|'notLoaded'|null */
143
- private bool |string |null $ defaultMethodPurity = 'notLoaded ' ;
142
+ private ?bool $ areAllMethodsPure = null ;
143
+
144
+ private ?bool $ areAllMethodsImpure = null ;
144
145
145
146
private ?bool $ isReadOnly = null ;
146
147
@@ -236,7 +237,8 @@ public static function createEmpty(): self
236
237
$ self ->isInternal = false ;
237
238
$ self ->isFinal = false ;
238
239
$ self ->isPure = null ;
239
- $ self ->defaultMethodPurity = null ;
240
+ $ self ->areAllMethodsPure = false ;
241
+ $ self ->areAllMethodsImpure = false ;
240
242
$ self ->isReadOnly = false ;
241
243
$ self ->isImmutable = false ;
242
244
$ self ->isAllowedPrivateMutation = false ;
@@ -302,7 +304,8 @@ public function merge(array $parents, array $parentPhpDocBlocks): self
302
304
$ result ->isInternal = $ this ->isInternal ();
303
305
$ result ->isFinal = $ this ->isFinal ();
304
306
$ result ->isPure = self ::mergePureTags ($ this ->isPure (), $ parents );
305
- $ result ->defaultMethodPurity = $ this ->getDefaultMethodPurity ();
307
+ $ result ->areAllMethodsPure = $ this ->areAllMethodsPure ();
308
+ $ result ->areAllMethodsImpure = $ this ->areAllMethodsImpure ();
306
309
$ result ->isReadOnly = $ this ->isReadOnly ();
307
310
$ result ->isImmutable = $ this ->isImmutable ();
308
311
$ result ->isAllowedPrivateMutation = $ this ->isAllowedPrivateMutation ();
@@ -423,7 +426,6 @@ public function changeParameterNamesByMapping(array $parameterNameMapping): self
423
426
$ self ->isInternal = $ this ->isInternal ;
424
427
$ self ->isFinal = $ this ->isFinal ;
425
428
$ self ->isPure = $ this ->isPure ;
426
- $ self ->defaultMethodPurity = $ this ->defaultMethodPurity ;
427
429
428
430
return $ self ;
429
431
}
@@ -833,29 +835,18 @@ public function isPure(): ?bool
833
835
return $ this ->isPure ;
834
836
}
835
837
836
- public function getDefaultMethodPurity (): ? bool
838
+ public function areAllMethodsPure (): bool
837
839
{
838
- if ($ this ->defaultMethodPurity === 'notLoaded ' ) {
839
- $ pure = $ this ->phpDocNodeResolver ->resolveAllMethodsArePure (
840
- $ this ->phpDocNode ,
841
- );
842
- if ($ pure ) {
843
- $ this ->defaultMethodPurity = true ;
844
- return $ this ->defaultMethodPurity ;
845
- }
846
-
847
- $ impure = $ this ->phpDocNodeResolver ->resolveAllMethodsAreImpure (
848
- $ this ->phpDocNode ,
849
- );
850
- if ($ impure ) {
851
- $ this ->defaultMethodPurity = false ;
852
- return $ this ->defaultMethodPurity ;
853
- }
854
-
855
- $ this ->defaultMethodPurity = null ;
856
- }
840
+ return $ this ->areAllMethodsPure ??= $ this ->phpDocNodeResolver ->resolveAllMethodsPure (
841
+ $ this ->phpDocNode ,
842
+ );
843
+ }
857
844
858
- return $ this ->defaultMethodPurity ;
845
+ public function areAllMethodsImpure (): bool
846
+ {
847
+ return $ this ->areAllMethodsImpure ??= $ this ->phpDocNodeResolver ->resolveAllMethodsImpure (
848
+ $ this ->phpDocNode ,
849
+ );
859
850
}
860
851
861
852
public function isReadOnly (): bool
0 commit comments