mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-11-27 08:20:02 +00:00
Split isset() check for array and property
Check the array part first and afterwards the property for null, which does not need the isset() error suppression. Found by a new phan plugin (2efea9f989) This bypass a false positive from phan (T378284) Change-Id: I08651c4b2cd03ecfb38d28ca1cbff599d922208a
This commit is contained in:
parent
873bee7e20
commit
ebd526f2af
|
@ -101,7 +101,7 @@ class ReferenceListFormatter {
|
|||
// Make sure the parent is not a subreference.
|
||||
// FIXME: Move to a validation function.
|
||||
$extends =& $ref->extends;
|
||||
if ( $extends !== null && isset( $groupRefs[$extends]->extends ) ) {
|
||||
if ( $extends !== null && isset( $groupRefs[$extends] ) && $groupRefs[$extends]->extends !== null ) {
|
||||
$ref->warnings[] = [ 'cite_error_ref_nested_extends',
|
||||
$extends, $groupRefs[$extends]->extends ];
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ class Validator {
|
|||
if ( 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]->extends ) ) {
|
||||
} 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 );
|
||||
|
|
Loading…
Reference in a new issue