Merge "Remove not needed code without changing anything"

This commit is contained in:
jenkins-bot 2020-03-31 18:30:21 +00:00 committed by Gerrit Code Review
commit a00401fdfc
3 changed files with 27 additions and 35 deletions

View file

@ -105,7 +105,7 @@ class ReferenceStack {
* @param ?string $follow Guaranteed to not be a numeric string
* @param ?string $dir ref direction
*
* @return ?array ref structure, or null if nothing was pushed
* @return ?array ref structure, or null if no footnote marker should be rendered
* @suppress PhanTypePossiblyInvalidDimOffset To many complaints about array indizes
*/
public function pushRef(
@ -125,7 +125,7 @@ class ReferenceStack {
}
if ( $follow && isset( $this->refs[$group][$follow] ) && $text !== null ) {
// We know the parent note already, so just perform the "follow" and bail out
// We know the parent already, so just perform the follow="…" and bail out
$this->appendText( $group, $follow, ' ' . $text );
return null;
}
@ -140,20 +140,12 @@ class ReferenceStack {
];
if ( $follow ) {
$ref['follow'] = $follow;
// This inserts the incomplete "follow" at the end of all other incomplete "follow"
$k = 0;
foreach ( $this->refs[$group] as $value ) {
if ( !isset( $value['follow'] ) ) {
break;
}
$k++;
}
array_splice( $this->refs[$group], $k, 0, [ $ref ] );
array_splice( $this->refCallStack, $k, 0,
[ [ 'new', $this->refSequence, $group, $name, $extends, $text, $argv ] ] );
// A "follow" never gets its own footnote marker
// Mark an incomplete follow="…" as such. This is valid e.g. in the Page:… namespace
// on Wikisource.
$this->refs[$group][] = $ref + [ 'follow' => $follow ];
$this->refCallStack[] = [ 'new', $this->refSequence, $group, $name, $extends, $text,
$argv ];
// A follow="…" never gets its own footnote marker
return null;
}

View file

@ -263,14 +263,6 @@ class ReferenceStackTest extends \MediaWikiUnitTestCase {
],
[
'foo' => [
0 => [
'count' => -1,
'dir' => 'rtl',
'key' => 2,
'name' => null,
'text' => 'text-b',
'follow' => 'c',
],
'a' => [
'count' => 0,
'dir' => 'rtl',
@ -279,6 +271,14 @@ class ReferenceStackTest extends \MediaWikiUnitTestCase {
'text' => 'text-a',
'number' => 1,
],
0 => [
'count' => -1,
'dir' => 'rtl',
'key' => 2,
'name' => null,
'text' => 'text-b',
'follow' => 'c',
],
'c' => [
'count' => 0,
'dir' => 'rtl',
@ -290,8 +290,8 @@ class ReferenceStackTest extends \MediaWikiUnitTestCase {
]
],
[
[ 'new', 2, 'foo', null, null, 'text-b', [] ],
[ 'new', 1, 'foo', 'a', null, 'text-a', [] ],
[ 'new', 2, 'foo', null, null, 'text-b', [] ],
[ 'new', 3, 'foo', 'c', null, 'text-c', [] ],
]
],
@ -789,6 +789,14 @@ class ReferenceStackTest extends \MediaWikiUnitTestCase {
],
[
'foo' => [
'a' => [
'count' => 0,
'dir' => 'rtl',
'key' => 1,
'name' => 'a',
'text' => 'text-a',
'number' => 1,
],
0 => [
'count' => -1,
'dir' => 'rtl',
@ -805,20 +813,12 @@ class ReferenceStackTest extends \MediaWikiUnitTestCase {
'text' => 'text-c',
'follow' => 'd',
],
'a' => [
'count' => 0,
'dir' => 'rtl',
'key' => 1,
'name' => 'a',
'text' => 'text-a',
'number' => 1,
],
]
],
[
[ 'new', 1, 'foo', 'a', null, 'text-a', [] ],
[ 'new', 2, 'foo', null, null, 'text-b', [] ],
[ 'new', 3, 'foo', null, null, 'text-c', [] ],
[ 'new', 1, 'foo', 'a', null, 'text-a', [] ],
]
],
];

View file

@ -246,7 +246,7 @@ class ReferencesFormatterTest extends \MediaWikiUnitTestCase {
[
'text' => 't',
],
'(cite_references_link_many|||<span class="reference-text">t</span>' . "\n" . '|)'
'(cite_references_link_many|||<span class="reference-text">t</span>' . "\n|)"
],
'With dir' => [
1,