mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-11-23 14:36:51 +00:00
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
This commit is contained in:
parent
1fa7271beb
commit
a5aeba739e
|
@ -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 <ref> 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 ?? '' );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue