Skip to content

Commit

Permalink
Closes #831
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Nov 28, 2020
1 parent 61b8db0 commit 60f1e6e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

All notable changes are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.

## [9.2.5] - 2020-MM-DD

### Fixed

* [#831](https://github.com/sebastianbergmann/php-code-coverage/issues/831): Files that do not contain a newline are not handled correctly

## [9.2.4] - 2020-11-27

### Added
Expand Down Expand Up @@ -312,6 +318,7 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](htt
* Class names are now abbreviated (unqualified name shown, fully qualified name shown on hover) in the file view of the HTML report
* Update HTML report to Bootstrap 4

[9.2.5]: https://github.com/sebastianbergmann/php-code-coverage/compare/9.2.4...master
[9.2.4]: https://github.com/sebastianbergmann/php-code-coverage/compare/9.2.3...9.2.4
[9.2.3]: https://github.com/sebastianbergmann/php-code-coverage/compare/9.2.2...9.2.3
[9.2.2]: https://github.com/sebastianbergmann/php-code-coverage/compare/9.2.1...9.2.2
Expand Down
4 changes: 4 additions & 0 deletions src/StaticAnalysis/ParsingCoveredFileAnalyser.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ private function analyse(string $filename): void
$source = file_get_contents($filename);
$linesOfCode = substr_count($source, "\n");

if ($linesOfCode === 0 && !empty($source)) {
$linesOfCode = 1;
}

$parser = (new ParserFactory)->create(
ParserFactory::PREFER_PHP7,
new Lexer
Expand Down

0 comments on commit 60f1e6e

Please sign in to comment.