cvs: pear /PHP_CodeSniffer/CodeSniffer/CommentParser AbstractParser.php
| From: | Greg Sherwood | Date: | Tue, 02 Jan 2007 03:48:45 +0000 |
| Subject: | cvs: pear /PHP_CodeSniffer/CodeSniffer/CommentParser AbstractParser.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-43922@lists.php.net to get a copy of this message | ||
squiz Tue Jan 2 03:48:45 2007 UTC
Modified files:
/pear/PHP_CodeSniffer/CodeSniffer/CommentParser AbstractParser.php
Log:
Added functions to handle unknown tags
http://cvs.php.net/viewvc.cgi/pear/PHP_CodeSniffer/CodeSniffer/CommentParser/AbstractParser.php?r1=1.6&r2=1.7&diff_format=u
Index: pear/PHP_CodeSniffer/CodeSniffer/CommentParser/AbstractParser.php
diff -u pear/PHP_CodeSniffer/CodeSniffer/CommentParser/AbstractParser.php:1.6
pear/PHP_CodeSniffer/CodeSniffer/CommentParser/AbstractParser.php:1.7
--- pear/PHP_CodeSniffer/CodeSniffer/CommentParser/AbstractParser.php:1.6 Tue Dec 19 04:38:10 2006
+++ pear/PHP_CodeSniffer/CodeSniffer/CommentParser/AbstractParser.php Tue Jan 2 03:48:45 2007
@@ -10,7 +10,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: AbstractParser.php,v 1.6 2006/12/19 04:38:10 squiz Exp $
+ * @version CVS: $Id: AbstractParser.php,v 1.7 2007/01/02 03:48:45 squiz Exp $
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
@@ -134,7 +134,14 @@
);
/**
- * The order of tags
+ * An array of unknown tags.
+ *
+ * @var array(string)
+ */
+ public $unknown = array();
+
+ /**
+ * The order of tags.
*
* @var array(string)
*/
@@ -259,7 +266,32 @@
}
$prevTagPos = $wordPos;
+ } else {
+ // A real comment tag should have a space and a newline before it.
+ if (!isset($this->words[$wordPos-1]) || $this->words[$wordPos-1] !==
' ') {
+ continue;
+ }
+ if (!isset($this->words[$wordPos-2]) || $this->words[$wordPos-2] !==
"\n") {
+ continue;
+ }
+ $standardTags = array(
+ 'access',
+ 'example',
+ 'ignore',
+ 'internal',
+ 'static',
+ 'tutorial',
+ 'package_version@',
+ );
+ if (!in_array($tag, $standardTags)) {
+ $this->unknown[] = array(
+ 'tag' => $tag,
+ 'line' => $this->getLine($wordPos),
+ );
+ }
+
}//end if
+
}//end if
}//end foreach
@@ -499,6 +531,18 @@
}//end getTagOrders()
+ /**
+ * Returns the unknown tags.
+ *
+ * @return array
+ */
+ public function getUnknown()
+ {
+ return $this->unknown;
+
+ }//end getUnknown()
+
+
}//end class
?>