class DiffEngine {
// Input variables
+ /** @var string[] */
private $from;
+ /** @var string[] */
private $to;
private $m;
private $n;
*/
$max = min( $this->m, $this->n );
for ( $forwardBound = 0; $forwardBound < $max
+ // @phan-suppress-next-line PhanTypeInvalidDimOffset
&& $this->from[$forwardBound] === $this->to[$forwardBound];
++$forwardBound
) {
// need to store these so we don't lose them when they're
// overwritten by the recursion
- $len = $snake[2];
- $startx = $snake[0];
- $starty = $snake[1];
+ list( $startx, $starty, $len ) = $snake;
// the middle snake is part of the LCS, store it
for ( $i = 0; $i < $len; ++$i ) {
// value_to_add_forward: a 0 or 1 that we add to the start
// offset to make it odd/even
- if ( ( $M & 1 ) == 1 ) {
+ if ( $M & 1 ) {
$value_to_add_forward = 1;
} else {
$value_to_add_forward = 0;
}
- if ( ( $N & 1 ) == 1 ) {
+ if ( $N & 1 ) {
$value_to_add_backward = 1;
} else {
$value_to_add_backward = 0;
$V1[$limit_min_1] = $N;
$limit = min( $this->maxDifferences, ceil( ( $N + $M ) / 2 ) );
- if ( ( $delta & 1 ) == 1 ) {
+ if ( $delta & 1 ) {
for ( $d = 0; $d <= $limit; ++$d ) {
$start_diag = max( $value_to_add_forward + $start_forward, -$d );
$end_diag = min( $end_forward, $d );