Skip to content

Commit 9814996

Browse files
committed
Fixed bug #20131 : PHP errors in svnblame report, if there are files not under version control
1 parent ceaa3ce commit 9814996

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

CodeSniffer/Reports/VersionControl.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,13 @@ public function generate(
6363

6464
foreach ($report['files'] as $filename => $file) {
6565
$blames = $this->getBlameContent($filename);
66-
6766
foreach ($file['messages'] as $line => $lineErrors) {
68-
$author = $this->getAuthor($blames[($line - 1)]);
69-
if ($author === false) {
70-
continue;
67+
$author = 'Unknown';
68+
if (isset($blames[($line - 1)]) === true) {
69+
$blameAuthor = $this->getAuthor($blames[($line - 1)]);
70+
if ($blameAuthor !== false) {
71+
$author = $blameAuthor;
72+
}
7173
}
7274

7375
if (isset($authors[$author]) === false) {
@@ -104,7 +106,7 @@ public function generate(
104106
foreach ($blames as $line) {
105107
$author = $this->getAuthor($line);
106108
if (false === $author) {
107-
continue;
109+
$author = 'Unknown';
108110
}
109111

110112
if (isset($authors[$author]) === false) {

package.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
4242
- Fixed bug #20097 : CLI.php throws error in php 5.2
4343
- Fixed bug #20100 : incorrect Function mysql() has been deprecated report
4444
- Fixed bug #20123 : PSR2 complains about an empty second statement in for-loop
45+
- Fixed bug #20131 : PHP errors in svnblame report, if there are files not under version control
4546
</notes>
4647
<contents>
4748
<dir name="/">

0 commit comments

Comments
 (0)