From a5aeba739e5d0a0529b2fb1d60786053242afb7c Mon Sep 17 00:00:00 2001 From: "C. Scott Ananian" Date: Fri, 15 Nov 2024 14:19:30 -0500 Subject: [PATCH] Resolve PhanTypeMismatchArgumentNullable after tweak to StatusValue::newFatal The type hints added in I3e0df790ff9db2fa630f82408a7254a359fe61ca were sufficient to allow phan to detect that we were possibly passing a null value in one instance. The other instance was a false positive. Follows-Up: I3e0df790ff9db2fa630f82408a7254a359fe61ca Change-Id: I3bacc2aff3d36719133554a8f70d50a3790b84e4 --- src/Validator.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Validator.php b/src/Validator.php index 868568765..7c2c8d94c 100644 --- a/src/Validator.php +++ b/src/Validator.php @@ -62,14 +62,13 @@ class Validator { } $groupRefs = $this->referenceStack->getGroupRefs( $group ); - // @phan-suppress-next-line PhanTypeMismatchDimFetchNullable false positive - if ( isset( $groupRefs[$name] ) && $groupRefs[$name]->extends === null ) { + if ( $name !== null && isset( $groupRefs[$name] ) && $groupRefs[$name]->extends === null ) { // T242141: A top-level can't be changed into a sub-reference return StatusValue::newFatal( 'cite_error_references_duplicate_key', $name ); } elseif ( isset( $groupRefs[$extends] ) && $groupRefs[$extends]->extends !== null ) { // A sub-reference can not be extended a second time (no nesting) return StatusValue::newFatal( 'cite_error_ref_nested_extends', $extends, - $groupRefs[$extends]->extends ); + $groupRefs[$extends]->extends ?? '' ); } }