cvs: pear /PHP_CodeSniffer CodeSniffer.php
| From: | Greg Sherwood | Date: | Fri, 12 Jan 2007 03:56:19 +0000 |
| Subject: | cvs: pear /PHP_CodeSniffer CodeSniffer.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-44198@lists.php.net to get a copy of this message | ||
squiz Fri Jan 12 03:56:19 2007 UTC
Modified files:
/pear/PHP_CodeSniffer CodeSniffer.php
Log:
Shortend some lines
http://cvs.php.net/viewvc.cgi/pear/PHP_CodeSniffer/CodeSniffer.php?r1=1.17&r2=1.18&diff_format=u
Index: pear/PHP_CodeSniffer/CodeSniffer.php
diff -u pear/PHP_CodeSniffer/CodeSniffer.php:1.17 pear/PHP_CodeSniffer/CodeSniffer.php:1.18
--- pear/PHP_CodeSniffer/CodeSniffer.php:1.17 Tue Jan 9 23:04:16 2007
+++ pear/PHP_CodeSniffer/CodeSniffer.php Fri Jan 12 03:56:19 2007
@@ -11,7 +11,7 @@
* @author Marc McIntyre <mmcintyre@squiz.net>
* @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
* @license http://matrix.squiz.net/developer/tools/php_cs/licence
BSD Licence
- * @version CVS: $Id: CodeSniffer.php,v 1.17 2007/01/09 23:04:16 squiz Exp $
+ * @version CVS: $Id: CodeSniffer.php,v 1.18 2007/01/12 03:56:19 squiz Exp $
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
@@ -224,9 +224,10 @@
if (isset($this->_classCache[$file]) === false) {
// Determine what classes this file contains.
- $currentClasses = get_declared_classes();
+ $oldClasses = get_declared_classes();
include_once $file;
- $this->_classCache[$file] = array_diff(get_declared_classes(), $currentClasses);
+ $newClasses = get_declared_classes();
+ $this->_classCache[$file] = array_diff($newClasses, $oldClasses);
}
$newClasses = $this->_classCache[$file];
@@ -249,7 +250,8 @@
// If they have specified a list of sniffs to restrict to, check
// to see if this sniff is allowed.
- if (empty($sniffs) === false && in_array(strtolower($className), $sniffs)
=== false) {
+ $allowed = in_array(strtolower($className), $sniffs);
+ if (empty($sniffs) === false && $allowed === false) {
continue;
}
@@ -344,7 +346,7 @@
private function _processFile($file)
{
if (file_exists($file) === false) {
- throw new PHP_CodeSniffer_Exception('Source file '.$file.' does not
exist');
+ throw new PHP_CodeSniffer_Exception("Source file $file does not exist");
}
if (PHP_CODESNIFFER_VERBOSITY > 0) {
@@ -870,8 +872,10 @@
$di = new DirectoryIterator($standardsDir);
foreach ($di as $file) {
if ($file->isDir() === true && $file->isDot() === false) {
+ $filename = $file->getFilename();
+
// Ignore the special "Generic" standard.
- if ($includeGeneric === false && $file->getFilename() ===
'Generic') {
+ if ($includeGeneric === false && $filename === 'Generic') {
continue;
}
@@ -879,7 +883,7 @@
// subdirectory, so check for it.
if (is_dir($file->getPathname().'/Sniffs') === true) {
// We found a coding standard directory.
- $installedStandards[] = $file->getFilename();
+ $installedStandards[] = $filename;
}
}
}
@@ -903,7 +907,8 @@
*/
public static function isInstalledStandard($standard)
{
- $standardDir =
dirname(__FILE__).'/CodeSniffer/Standards/'.$standard.'/Sniffs';
+ $standardDir = dirname(__FILE__);
+ $standardDir .='/CodeSniffer/Standards/'.$standard.'/Sniffs';
return (is_dir($standardDir) === true);
}//end isInstalledStandard()