*/
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"
* @return DiffOp[]
*/
public function diff( $from_lines, $to_lines ) {
-
// Diff and store locally
$this->diffInternal( $from_lines, $to_lines );
}
while ( $i < $len && !$changed[$i] ) {
- assert( $j < $other_len && ! $other_changed[$j] );
+ assert( $j < $other_len && !$other_changed[$j] );
$i++;
$j++;
while ( $j < $other_len && $other_changed[$j] ) {
$i++;
}
- assert( $j < $other_len && ! $other_changed[$j] );
+ assert( $j < $other_len && !$other_changed[$j] );
$j++;
if ( $j < $other_len && $other_changed[$j] ) {
$corresponding = $i;
$this->maxDifferences = ceil( ( $this->m + $this->n ) / 2.0 );
if ( $this->m * $this->n > $this->tooLong ) {
// limit complexity to D^POW_LIMIT for long sequences
- $this->maxDifferences = floor( pow( $this->maxDifferences, $this->powLimit - 1.0 ) );
+ $this->maxDifferences = floor( $this->maxDifferences ** ( $this->powLimit - 1.0 ) );
wfDebug( "Limiting max number of differences to $this->maxDifferences\n" );
}