svn: /pear/packages/PHP_CodeSniffer/trunk/CodeSniffer/ File.php
| From: | Greg Sherwood | Date: | Mon, 03 Aug 2009 23:27:47 +0000 |
| Subject: | svn: /pear/packages/PHP_CodeSniffer/trunk/CodeSniffer/ File.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-56883@lists.php.net to get a copy of this message | ||
squiz Mon, 03 Aug 2009 23:27:47 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=286773
Log:
If we can't determine the line ending via a regex, there are probably no newlines chars
Changed paths:
U pear/packages/PHP_CodeSniffer/trunk/CodeSniffer/File.php
Modified: pear/packages/PHP_CodeSniffer/trunk/CodeSniffer/File.php
===================================================================
--- pear/packages/PHP_CodeSniffer/trunk/CodeSniffer/File.php 2009-08-03 23:26:32 UTC (rev 286772)
+++ pear/packages/PHP_CodeSniffer/trunk/CodeSniffer/File.php 2009-08-03 23:27:47 UTC (rev 286773)
@@ -557,11 +557,11 @@
}
} else {
if (preg_match("/\r\n?|\n/", $contents, $matches) !== 1) {
- $error = 'Could not auto-detect line endings from content';
- throw new PHP_CodeSniffer_Exception($error);
+ // Assuming there are no newlines.
+ $eolChar = "\n";
+ } else {
+ $eolChar = $matches[0];
}
-
- $eolChar = $matches[0];
}//end if
return $eolChar;