svn: /pear2/Pyrus_Developer/trunk/src/Pyrus/Developer/CoverageAnalyzer/ SourceFile.php
| From: | Helgi Þormar Þorbjörnsson | Date: | Mon, 08 Mar 2010 00:28:23 +0000 |
| Subject: | svn: /pear2/Pyrus_Developer/trunk/src/Pyrus/Developer/CoverageAnalyzer/ SourceFile.php | ||
| Groups: | php.pear.cvs php.pear.core | ||
| Request: | Send a blank email to pear-cvs+get-59015@lists.php.net to get a copy of this message | ||
dufuz Mon, 08 Mar 2010 00:28:23 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=295946
Log:
Make sure we don't try to alter the source code before outputting it if there is no coverage
information around to compare it against.
Changed paths:
U pear2/Pyrus_Developer/trunk/src/Pyrus/Developer/CoverageAnalyzer/SourceFile.php
Modified: pear2/Pyrus_Developer/trunk/src/Pyrus/Developer/CoverageAnalyzer/SourceFile.php
===================================================================
--- pear2/Pyrus_Developer/trunk/src/Pyrus/Developer/CoverageAnalyzer/SourceFile.php 2010-03-07
21:59:34 UTC (rev 295945)
+++ pear2/Pyrus_Developer/trunk/src/Pyrus/Developer/CoverageAnalyzer/SourceFile.php 2010-03-08
00:28:23 UTC (rev 295946)
@@ -84,11 +84,16 @@
function source()
{
+ $cov = $this->coverage();
+ if (empty($cov)) {
+ return $this->source;
+ }
+
/* Make sure we have as many lines as required
* Sometimes Xdebug returns coverage on one line beyond what
* our file has, this is PHP doing a return on the file.
*/
- $endLine = max(array_keys($this->coverage()));
+ $endLine = max(array_keys($cov));
if (count($this->source) < $endLine) {
// Add extra new line if required since we use <pre> to format
$secondLast = $endLine - 1;