@@ -103,6 +103,8 @@ class ResolvedPhpDocBlock
103
103
104
104
private ?bool $ isDeprecated = null ;
105
105
106
+ private ?bool $ isNotDeprecated = null ;
107
+
106
108
private ?bool $ isInternal = null ;
107
109
108
110
private ?bool $ isFinal = null ;
@@ -177,6 +179,7 @@ public static function createEmpty(): self
177
179
$ self ->selfOutTypeTag = null ;
178
180
$ self ->deprecatedTag = null ;
179
181
$ self ->isDeprecated = false ;
182
+ $ self ->isNotDeprecated = false ;
180
183
$ self ->isInternal = false ;
181
184
$ self ->isFinal = false ;
182
185
$ self ->isPure = null ;
@@ -229,8 +232,9 @@ public function merge(array $parents, array $parentPhpDocBlocks): self
229
232
$ result ->typeAliasImportTags = $ this ->getTypeAliasImportTags ();
230
233
$ result ->assertTags = self ::mergeAssertTags ($ this ->getAssertTags (), $ parents , $ parentPhpDocBlocks );
231
234
$ result ->selfOutTypeTag = self ::mergeSelfOutTypeTags ($ this ->getSelfOutTag (), $ parents );
232
- $ result ->deprecatedTag = self ::mergeDeprecatedTags ($ this ->getDeprecatedTag (), $ parents );
235
+ $ result ->deprecatedTag = self ::mergeDeprecatedTags ($ this ->getDeprecatedTag (), $ this -> isNotDeprecated (), $ parents );
233
236
$ result ->isDeprecated = $ result ->deprecatedTag !== null ;
237
+ $ result ->isNotDeprecated = $ this ->isNotDeprecated ();
234
238
$ result ->isInternal = $ this ->isInternal ();
235
239
$ result ->isFinal = $ this ->isFinal ();
236
240
$ result ->isPure = $ this ->isPure ();
@@ -324,6 +328,7 @@ public function changeParameterNamesByMapping(array $parameterNameMapping): self
324
328
$ self ->selfOutTypeTag = $ this ->selfOutTypeTag ;
325
329
$ self ->deprecatedTag = $ this ->deprecatedTag ;
326
330
$ self ->isDeprecated = $ this ->isDeprecated ;
331
+ $ self ->isNotDeprecated = $ this ->isNotDeprecated ;
327
332
$ self ->isInternal = $ this ->isInternal ;
328
333
$ self ->isFinal = $ this ->isFinal ;
329
334
$ self ->isPure = $ this ->isPure ;
@@ -599,6 +604,19 @@ public function isDeprecated(): bool
599
604
return $ this ->isDeprecated ;
600
605
}
601
606
607
+ /**
608
+ * @internal
609
+ */
610
+ public function isNotDeprecated (): bool
611
+ {
612
+ if ($ this ->isNotDeprecated === null ) {
613
+ $ this ->isNotDeprecated = $ this ->phpDocNodeResolver ->resolveIsNotDeprecated (
614
+ $ this ->phpDocNode ,
615
+ );
616
+ }
617
+ return $ this ->isNotDeprecated ;
618
+ }
619
+
602
620
public function isInternal (): bool
603
621
{
604
622
if ($ this ->isInternal === null ) {
@@ -871,14 +889,19 @@ private static function mergeSelfOutTypeTags(?SelfOutTypeTag $selfOutTypeTag, ar
871
889
/**
872
890
* @param array<int, self> $parents
873
891
*/
874
- private static function mergeDeprecatedTags (?DeprecatedTag $ deprecatedTag , array $ parents ): ?DeprecatedTag
892
+ private static function mergeDeprecatedTags (?DeprecatedTag $ deprecatedTag , bool $ hasNotDeprecatedTag , array $ parents ): ?DeprecatedTag
875
893
{
876
894
if ($ deprecatedTag !== null ) {
877
895
return $ deprecatedTag ;
878
896
}
897
+
898
+ if ($ hasNotDeprecatedTag ) {
899
+ return null ;
900
+ }
901
+
879
902
foreach ($ parents as $ parent ) {
880
903
$ result = $ parent ->getDeprecatedTag ();
881
- if ($ result === null ) {
904
+ if ($ result === null && ! $ parent -> isNotDeprecated () ) {
882
905
continue ;
883
906
}
884
907
return $ result ;
0 commit comments