JBlond/php-diff

maxLineMarkerWidth only calculated for input format plain.

Closed this issue · 3 comments

if ($this->options['format'] == 'plain') {

I think the if statement can be removed.
Its value should be calculated independently of the input format (plain/html).
It's a helper variable to be used in subRenderers to left-align the lines in the output.

Also at InlineCli.php

$padding = str_repeat(' ', $this->maxLineMarkerWidth - strlen($this->options['equalityMarkers'][0]));

The second parameter of str_repeat should be 0 at least.

        $padding     = str_repeat(' ',
            max($this->maxLineMarkerWidth - strlen($this->options['equalityMarkers'][0]), 0));

or it'll generated a warning.
The same goes for line 119, 143, 197 of this file.

Will fix when agreed upon and when PR's are merged/closed.

Both of us forgot the change log.

I've updated the change log in the master branch directly.
I hope it's OK like this.

Maybe we can create a script or something which prepends the change log with commit messages.
Something like $ git log $(git describe --tags --abbrev=0)..HEAD --pretty=format:"%s" -i -E --grep="SOME REGEX HERE" > afile.txt