[prev in list] [next in list] [prev in thread] [next in thread]
List: pear-cvs
Subject: [PEAR-CVS] cvs: pear /PHP_CodeSniffer package.xml /PHP_CodeSniffer/CodeSniffer/Standards/MySource/S
From: "Greg Sherwood" <squiz () php ! net>
Date: 2008-01-31 2:39:32
Message-ID: cvssquiz1201747172 () cvsserver
[Download RAW message or body]
squiz Thu Jan 31 02:39:32 2008 UTC
Modified files:
/pear/PHP_CodeSniffer package.xml
/pear/PHP_CodeSniffer/CodeSniffer/Standards/MySource/Sniffs/Channels
IncludeSystemSniff.php
UnusedSystemSniff.php
/pear/PHP_CodeSniffer/CodeSniffer/Standards/MySource/Tests/Channels
IncludeSystemUnitTest.inc
IncludeSystemUnitTest.php
UnusedSystemUnitTest.inc
UnusedSystemUnitTest.php
Log:
These sniffs now support includeWidget() calls
["squiz-20080131023932.txt" (text/plain)]
http://cvs.php.net/viewvc.cgi/pear/PHP_CodeSniffer/package.xml?r1=1.210&r2=1.211&diff_format=u
Index: pear/PHP_CodeSniffer/package.xml
diff -u pear/PHP_CodeSniffer/package.xml:1.210 pear/PHP_CodeSniffer/package.xml:1.211
--- pear/PHP_CodeSniffer/package.xml:1.210 Wed Jan 23 03:46:38 2008
+++ pear/PHP_CodeSniffer/package.xml Thu Jan 31 02:39:32 2008
@@ -40,6 +40,8 @@
- Squiz VariableCommentSniff now continues throwing errors after the first one is \
found
- MySource IncludedSystemSniff now checks extended class names
- MySource UnusedSystemSniff now checks extended and implemented class names
+ - MySource IncludedSystemSniff now supports includeWidget()
+ - MySource UnusedSystemSniff now supports includeWidget()
- Added Squiz DisallowCountInLoopsSniff to check for the use of count() in FOR and \
WHILE loop conditions
- Added MySource UnusedSystemSniff to check for included classes that are never \
used
- Fixed a problem that caused the parentheses map to sometimes contain incorrect \
values http://cvs.php.net/viewvc.cgi/pear/PHP_CodeSniffer/CodeSniffer/Standards/MySource/Sniffs/Channels/IncludeSystemSniff.php?r1=1.14&r2=1.15&diff_format=u
Index: pear/PHP_CodeSniffer/CodeSniffer/Standards/MySource/Sniffs/Channels/IncludeSystemSniff.php
diff -u pear/PHP_CodeSniffer/CodeSniffer/Standards/MySource/Sniffs/Channels/IncludeSystemSniff.php:1.14 \
pear/PHP_CodeSniffer/CodeSniffer/Standards/MySource/Sniffs/Channels/IncludeSystemSniff.php:1.15
--- pear/PHP_CodeSniffer/CodeSniffer/Standards/MySource/Sniffs/Channels/IncludeSystemSniff.php:1.14 Wed \
Jan 23 03:46:38 2008
+++ pear/PHP_CodeSniffer/CodeSniffer/Standards/MySource/Sniffs/Channels/IncludeSystemSniff.php Thu \
Jan 31 02:39:32 2008 @@ -9,7 +9,7 @@
* @author Greg Sherwood <gsherwood@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: IncludeSystemSniff.php,v 1.14 2008/01/23 03:46:38 squiz Exp \
$ + * @version CVS: $Id: IncludeSystemSniff.php,v 1.15 2008/01/31 02:39:32 squiz \
Exp $
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
@@ -216,6 +216,10 @@
$typeName = \
$phpcsFile->findNext(T_CONSTANT_ENCAPSED_STRING, ($i + 1));
$typeName = trim($tokens[$typeName]['content'], " '");
$includedClasses[] = strtolower($typeName).'assettype';
+ } else if (strtolower($tokens[$i]['content']) === 'includewidget') {
+ $typeName = \
$phpcsFile->findNext(T_CONSTANT_ENCAPSED_STRING, ($i + 1)); + \
$typeName = trim($tokens[$typeName]['content'], " '"); + \
$includedClasses[] = strtolower($typeName).'widgettype';
} else if (in_array($tokens[$i]['code'], \
PHP_CodeSniffer_Tokens::$includeTokens) === true) {
$filePath = $phpcsFile->findNext(T_CONSTANT_ENCAPSED_STRING, ($i + \
1)); $filePath = $tokens[$filePath]['content'];
http://cvs.php.net/viewvc.cgi/pear/PHP_CodeSniffer/CodeSniffer/Standards/MySource/Sniffs/Channels/UnusedSystemSniff.php?r1=1.3&r2=1.4&diff_format=u
Index: pear/PHP_CodeSniffer/CodeSniffer/Standards/MySource/Sniffs/Channels/UnusedSystemSniff.php
diff -u pear/PHP_CodeSniffer/CodeSniffer/Standards/MySource/Sniffs/Channels/UnusedSystemSniff.php:1.3 \
pear/PHP_CodeSniffer/CodeSniffer/Standards/MySource/Sniffs/Channels/UnusedSystemSniff.php:1.4
--- pear/PHP_CodeSniffer/CodeSniffer/Standards/MySource/Sniffs/Channels/UnusedSystemSniff.php:1.3 Thu \
Jan 24 23:56:42 2008
+++ pear/PHP_CodeSniffer/CodeSniffer/Standards/MySource/Sniffs/Channels/UnusedSystemSniff.php Thu \
Jan 31 02:39:32 2008 @@ -9,7 +9,7 @@
* @author Greg Sherwood <gsherwood@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: UnusedSystemSniff.php,v 1.3 2008/01/24 23:56:42 squiz Exp $
+ * @version CVS: $Id: UnusedSystemSniff.php,v 1.4 2008/01/31 02:39:32 squiz Exp $
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
@@ -53,25 +53,24 @@
$tokens = $phpcsFile->getTokens();
// Check if this is a call to includeSystem or includeAsset.
- if (strtolower($tokens[($stackPtr + 1)]['content']) === 'includesystem') {
+ $methodName = strtolower($tokens[($stackPtr + 1)]['content']);
+ if (in_array($methodName, array('includesystem', 'includeasset', \
'includewidget')) === true) {
$systemName = $phpcsFile->findNext(T_CONSTANT_ENCAPSED_STRING, \
($stackPtr + 2), null, false, null, true); if ($systemName === false) {
return;
}
$systemName = trim($tokens[$systemName]['content'], " '");
- } else if (strtolower($tokens[($stackPtr + 1)]['content']) === \
'includeasset') {
- $systemName = $phpcsFile->findNext(T_CONSTANT_ENCAPSED_STRING, \
($stackPtr + 2), null, false, null, true);
- if ($systemName === false) {
- return;
- }
-
- $systemName = trim($tokens[$systemName]['content'], " '");
- $systemName .= 'assettype';
} else {
return;
}
+ if ($methodName === 'includeasset') {
+ $systemName .= 'assettype';
+ } else if ($methodName === 'includewidget') {
+ $systemName .= 'widgettype';
+ }
+
$systemName = strtolower($systemName);
// Now check if this system is used anywhere in this scope.
http://cvs.php.net/viewvc.cgi/pear/PHP_CodeSniffer/CodeSniffer/Standards/MySource/Tests/Channels/IncludeSystemUnitTest.inc?r1=1.8&r2=1.9&diff_format=u
Index: pear/PHP_CodeSniffer/CodeSniffer/Standards/MySource/Tests/Channels/IncludeSystemUnitTest.inc
diff -u pear/PHP_CodeSniffer/CodeSniffer/Standards/MySource/Tests/Channels/IncludeSystemUnitTest.inc:1.8 \
pear/PHP_CodeSniffer/CodeSniffer/Standards/MySource/Tests/Channels/IncludeSystemUnitTest.inc:1.9
--- pear/PHP_CodeSniffer/CodeSniffer/Standards/MySource/Tests/Channels/IncludeSystemUnitTest.inc:1.8 Wed \
Jan 23 03:46:38 2008
+++ pear/PHP_CodeSniffer/CodeSniffer/Standards/MySource/Tests/Channels/IncludeSystemUnitTest.inc Thu \
Jan 31 02:39:32 2008 @@ -61,4 +61,10 @@
$query->fetch(PDO::FETCH_NUM)
BaseSystem::getDataDir();
Util::getArrayIndex(array(), '');
+
+
+Channels::includeSystem('Widget');
+Widget::includeWidget('AbstractContainer');
+class MyWidget extends AbstractContainerWidgetType {}
+class MyOtherWidget extends BookWidgetType {}
?>
\ No newline at end of file
http://cvs.php.net/viewvc.cgi/pear/PHP_CodeSniffer/CodeSniffer/Standards/MySource/Tests/Channels/IncludeSystemUnitTest.php?r1=1.4&r2=1.5&diff_format=u
Index: pear/PHP_CodeSniffer/CodeSniffer/Standards/MySource/Tests/Channels/IncludeSystemUnitTest.php
diff -u pear/PHP_CodeSniffer/CodeSniffer/Standards/MySource/Tests/Channels/IncludeSystemUnitTest.php:1.4 \
pear/PHP_CodeSniffer/CodeSniffer/Standards/MySource/Tests/Channels/IncludeSystemUnitTest.php:1.5
--- pear/PHP_CodeSniffer/CodeSniffer/Standards/MySource/Tests/Channels/IncludeSystemUnitTest.php:1.4 Wed \
Jan 23 03:46:38 2008
+++ pear/PHP_CodeSniffer/CodeSniffer/Standards/MySource/Tests/Channels/IncludeSystemUnitTest.php Thu \
Jan 31 02:39:32 2008 @@ -9,7 +9,7 @@
* @author Greg Sherwood <gsherwood@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: IncludeSystemUnitTest.php,v 1.4 2008/01/23 03:46:38 squiz \
Exp $ + * @version CVS: $Id: IncludeSystemUnitTest.php,v 1.5 2008/01/31 02:39:32 \
squiz Exp $
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
@@ -51,6 +51,7 @@
36 => 1,
41 => 1,
60 => 1,
+ 69 => 1,
);
}//end getErrorList()
http://cvs.php.net/viewvc.cgi/pear/PHP_CodeSniffer/CodeSniffer/Standards/MySource/Tests/Channels/UnusedSystemUnitTest.inc?r1=1.3&r2=1.4&diff_format=u
Index: pear/PHP_CodeSniffer/CodeSniffer/Standards/MySource/Tests/Channels/UnusedSystemUnitTest.inc
diff -u pear/PHP_CodeSniffer/CodeSniffer/Standards/MySource/Tests/Channels/UnusedSystemUnitTest.inc:1.3 \
pear/PHP_CodeSniffer/CodeSniffer/Standards/MySource/Tests/Channels/UnusedSystemUnitTest.inc:1.4
--- pear/PHP_CodeSniffer/CodeSniffer/Standards/MySource/Tests/Channels/UnusedSystemUnitTest.inc:1.3 Thu \
Jan 24 23:56:42 2008
+++ pear/PHP_CodeSniffer/CodeSniffer/Standards/MySource/Tests/Channels/UnusedSystemUnitTest.inc Thu \
Jan 31 02:39:32 2008 @@ -48,4 +48,8 @@
// Shouldnt throw an error because we dont know the system name.
self::includeSystem($systemName);
}
+
+Channels::includeSystem('Widget');
+Widget::includeWidget('AbstractContainer');
+class MyOtherWidget extends BookWidgetType {}
?>
\ No newline at end of file
http://cvs.php.net/viewvc.cgi/pear/PHP_CodeSniffer/CodeSniffer/Standards/MySource/Tests/Channels/UnusedSystemUnitTest.php?r1=1.3&r2=1.4&diff_format=u
Index: pear/PHP_CodeSniffer/CodeSniffer/Standards/MySource/Tests/Channels/UnusedSystemUnitTest.php
diff -u pear/PHP_CodeSniffer/CodeSniffer/Standards/MySource/Tests/Channels/UnusedSystemUnitTest.php:1.3 \
pear/PHP_CodeSniffer/CodeSniffer/Standards/MySource/Tests/Channels/UnusedSystemUnitTest.php:1.4
--- pear/PHP_CodeSniffer/CodeSniffer/Standards/MySource/Tests/Channels/UnusedSystemUnitTest.php:1.3 Wed \
Jan 23 03:46:38 2008
+++ pear/PHP_CodeSniffer/CodeSniffer/Standards/MySource/Tests/Channels/UnusedSystemUnitTest.php Thu \
Jan 31 02:39:32 2008 @@ -9,7 +9,7 @@
* @author Greg Sherwood <gsherwood@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: UnusedSystemUnitTest.php,v 1.3 2008/01/23 03:46:38 squiz Exp \
$ + * @version CVS: $Id: UnusedSystemUnitTest.php,v 1.4 2008/01/31 02:39:32 squiz \
Exp $
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
@@ -47,6 +47,7 @@
8 => 1,
24 => 1,
34 => 1,
+ 53 => 1,
);
}//end getErrorList()
--
PEAR CVS Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic