Whitelist the remaining usages of assert(), and reinstate the PHPCS sniff
that forbids usage of it. Add FIXME comments as well, so any casual readers
of the code will not think that the disabling and usage is intentional.
Change-Id: I7cabe715c0e6aa6a9ef3ffe5657f3de7fd8e662b
<exclude name="MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.SingleSpaceBeforeSingleLineComment" />
<exclude name="MediaWiki.Usage.DbrQueryUsage.DbrQueryFound" />
<exclude name="MediaWiki.Usage.ExtendClassUsage.FunctionVarUsage" />
<exclude name="MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.SingleSpaceBeforeSingleLineComment" />
<exclude name="MediaWiki.Usage.DbrQueryUsage.DbrQueryFound" />
<exclude name="MediaWiki.Usage.ExtendClassUsage.FunctionVarUsage" />
- <exclude name="MediaWiki.Usage.ForbiddenFunctions.assert" />
<exclude name="MediaWiki.Usage.SuperGlobalsUsage.SuperGlobals" />
<exclude name="MediaWiki.Files.ClassMatchesFilename.WrongCase" />
<exclude name="MediaWiki.Files.ClassMatchesFilename.NotMatch" />
<exclude name="MediaWiki.Usage.SuperGlobalsUsage.SuperGlobals" />
<exclude name="MediaWiki.Files.ClassMatchesFilename.WrongCase" />
<exclude name="MediaWiki.Files.ClassMatchesFilename.NotMatch" />
*/
use MediaWiki\Diff\ComplexityException;
*/
use MediaWiki\Diff\ComplexityException;
+// FIXME: Don't use assert() in this file
+// phpcs:disable MediaWiki.Usage.ForbiddenFunctions.assert
+
/**
* This diff implementation is mainly lifted from the LCS algorithm of the Eclipse project which
* in turn is based on Myers' "An O(ND) difference algorithm and its variations"
/**
* This diff implementation is mainly lifted from the LCS algorithm of the Eclipse project which
* in turn is based on Myers' "An O(ND) difference algorithm and its variations"
$this->flushLine( $tag );
$word = substr( $word, 1 );
}
$this->flushLine( $tag );
$word = substr( $word, 1 );
}
+ // FIXME: Don't use assert()
+ // phpcs:ignore MediaWiki.Usage.ForbiddenFunctions.assert
assert( !strstr( $word, "\n" ) );
$this->group .= $word;
}
assert( !strstr( $word, "\n" ) );
$this->group .= $word;
}
} elseif ( $found == 'line-end' ) {
$piece = $stack->top;
// A heading must be open, otherwise \n wouldn't have been in the search list
} elseif ( $found == 'line-end' ) {
$piece = $stack->top;
// A heading must be open, otherwise \n wouldn't have been in the search list
+ // FIXME: Don't use assert()
+ // phpcs:ignore MediaWiki.Usage.ForbiddenFunctions.assert
assert( $piece->open === "\n" );
$part = $piece->getCurrentPart();
// Search back through the input to see if it has a proper close.
assert( $piece->open === "\n" );
$part = $piece->getCurrentPart();
// Search back through the input to see if it has a proper close.
} elseif ( $found == 'line-end' ) {
$piece = $stack->top;
// A heading must be open, otherwise \n wouldn't have been in the search list
} elseif ( $found == 'line-end' ) {
$piece = $stack->top;
// A heading must be open, otherwise \n wouldn't have been in the search list
+ // FIXME: Don't use assert()
+ // phpcs:ignore MediaWiki.Usage.ForbiddenFunctions.assert
assert( $piece->open === "\n" );
$part = $piece->getCurrentPart();
// Search back through the input to see if it has a proper close.
assert( $piece->open === "\n" );
$part = $piece->getCurrentPart();
// Search back through the input to see if it has a proper close.