svn: /pear/packages/PHP_CodeSniffer/trunk/ CodeSniffer/Standards/Squiz/Sniffs/NamingConventions/ValidArrayIndexNameSniff.php
CodeSniffer/Standards/Squiz/Tests/NamingConventions/ValidArrayIndexNameUnitTest.inc
CodeSniffer/Standards/Squiz/Tests/NamingConventions/ValidArrayIndexNameUnitTest.php package.xml
| From: | Greg Sherwood | Date: | Tue, 04 Aug 2009 05:46:14 +0000 |
| Subject: | svn: /pear/packages/PHP_CodeSniffer/trunk/ CodeSniffer/Standards/Squiz/Sniffs/NamingConventions/ValidArrayIndexNameSniff.php CodeSniffer/Standards/Squiz/Tests/NamingConventions/ValidArrayIndexNameUnitTest.inc CodeSniffer/Standards/Squiz/Tests/NamingConventions/ValidArrayIndexNameUnitTest.php package.xml |
||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-56887@lists.php.net to get a copy of this message | ||
squiz Tue, 04 Aug 2009 05:46:14 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=286786
Log:
Removed unused ValidArrayIndexNameSniff from the Squiz standard
Changed paths:
D
pear/packages/PHP_CodeSniffer/trunk/CodeSniffer/Standards/Squiz/Sniffs/NamingConventions/ValidArrayIndexNameSniff.php
D
pear/packages/PHP_CodeSniffer/trunk/CodeSniffer/Standards/Squiz/Tests/NamingConventions/ValidArrayIndexNameUnitTest.inc
D
pear/packages/PHP_CodeSniffer/trunk/CodeSniffer/Standards/Squiz/Tests/NamingConventions/ValidArrayIndexNameUnitTest.php
U pear/packages/PHP_CodeSniffer/trunk/package.xml
Deleted:
pear/packages/PHP_CodeSniffer/trunk/CodeSniffer/Standards/Squiz/Sniffs/NamingConventions/ValidArrayIndexNameSniff.php
===================================================================
---
pear/packages/PHP_CodeSniffer/trunk/CodeSniffer/Standards/Squiz/Sniffs/NamingConventions/ValidArrayIndexNameSniff.php 2009-08-04
05:19:21 UTC (rev 286785)
+++
pear/packages/PHP_CodeSniffer/trunk/CodeSniffer/Standards/Squiz/Sniffs/NamingConventions/ValidArrayIndexNameSniff.php 2009-08-04
05:46:14 UTC (rev 286786)
@@ -1,96 +0,0 @@
-<?php
-/**
- * Squiz_Sniffs_NamingConventions_ValidArrayIndexNameSniff.
- *
- * PHP version 5
- *
- * @category PHP
- * @package PHP_CodeSniffer
- * @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$
- * @link http://pear.php.net/package/PHP_CodeSniffer
- */
-
-/**
- * Squiz_Sniffs_NamingConventions_ValidArrayIndexNameSniff.
- *
- * Ensures that array indexes are named correctly.
- *
- * @category PHP
- * @package PHP_CodeSniffer
- * @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 Release: @package_version@
- * @link http://pear.php.net/package/PHP_CodeSniffer
- */
-class Squiz_Sniffs_NamingConventions_ValidArrayIndexNameSniff implements PHP_CodeSniffer_Sniff
-{
-
-
- /**
- * Registers the token types that this sniff wishes to listen to.
- *
- * @return array
- */
- public function register()
- {
- return array(T_OPEN_SQUARE_BRACKET);
-
- }//end register()
-
-
- /**
- * Process the tokens that this sniff is listening for.
- *
- * @param PHP_CodeSniffer_File $phpcsFile The file where the token was found.
- * @param int $stackPtr The position in the stack where
- * the token was found.
- *
- * @return void
- */
- public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
- {
- $tokens = $phpcsFile->getTokens();
-
- // Make sure there is a variable before it.
- $variable = $phpcsFile->findPrevious(PHP_CodeSniffer_Tokens::$emptyTokens, ($stackPtr -
1), null, true);
- if ($variable === false || $tokens[$variable]['code'] !== T_VARIABLE) {
- return;
- }
-
- $ignore = array(
- '$_SERVER',
- '$_GET',
- '$_POST',
- '$_REQUEST',
- );
-
- $variableName = $tokens[$variable]['content'];
- if (in_array($variableName, $ignore) === true) {
- return;
- }
-
- // We are only interested in indexes that are single strings.
- $index = $phpcsFile->findNext(PHP_CodeSniffer_Tokens::$emptyTokens, ($stackPtr + 1),
null, true);
- $next = $phpcsFile->findNext(PHP_CodeSniffer_Tokens::$emptyTokens, ($index + 1), null,
true);
- if ($next !== $tokens[$stackPtr]['bracket_closer']) {
- return;
- }
-
- $indexContent = trim($tokens[$index]['content'], "'");
- if (preg_match('|^[a-zA-Z0-9_]+$|', $indexContent) === 1) {
- if (strtolower($indexContent) !== $indexContent) {
- $error = 'Array index "'.$indexContent.'" should not
contain uppercase characters';
- $phpcsFile->addError($error, $index);
- }
- }
-
- }//end process()
-
-
-}//end class
-
-?>
Deleted:
pear/packages/PHP_CodeSniffer/trunk/CodeSniffer/Standards/Squiz/Tests/NamingConventions/ValidArrayIndexNameUnitTest.inc
===================================================================
---
pear/packages/PHP_CodeSniffer/trunk/CodeSniffer/Standards/Squiz/Tests/NamingConventions/ValidArrayIndexNameUnitTest.inc 2009-08-04
05:19:21 UTC (rev 286785)
+++
pear/packages/PHP_CodeSniffer/trunk/CodeSniffer/Standards/Squiz/Tests/NamingConventions/ValidArrayIndexNameUnitTest.inc 2009-08-04
05:46:14 UTC (rev 286786)
@@ -1,13 +0,0 @@
-<?php
-$array['input_one'] = 'blah';
-echo $array['inputTwo'];
-echo $_SERVER['SERVER_VAR'];
-echo $_POST['myPostVar'];
-echo $_GET['myGetVar'];
-echo $_REQUEST['myRequestVar'];
-echo $_SESSION['myVar'];
-echo $_POST['my_post_var'];
-echo $_GET['my_get_var'];
-echo $_REQUEST['myRequestVar'];
-echo $_SESSION['my_var'];
-?>
Deleted:
pear/packages/PHP_CodeSniffer/trunk/CodeSniffer/Standards/Squiz/Tests/NamingConventions/ValidArrayIndexNameUnitTest.php
===================================================================
---
pear/packages/PHP_CodeSniffer/trunk/CodeSniffer/Standards/Squiz/Tests/NamingConventions/ValidArrayIndexNameUnitTest.php 2009-08-04
05:19:21 UTC (rev 286785)
+++
pear/packages/PHP_CodeSniffer/trunk/CodeSniffer/Standards/Squiz/Tests/NamingConventions/ValidArrayIndexNameUnitTest.php 2009-08-04
05:46:14 UTC (rev 286786)
@@ -1,69 +0,0 @@
-<?php
-/**
- * Unit test class for the ValidArrayIndexName sniff.
- *
- * PHP version 5
- *
- * @category PHP
- * @package PHP_CodeSniffer
- * @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$
- * @link http://pear.php.net/package/PHP_CodeSniffer
- */
-
-/**
- * Unit test class for the ValidArrayIndexName sniff.
- *
- * A sniff unit test checks a .inc file for expected violations of a single
- * coding standard. Expected errors and warnings are stored in this class.
- *
- * @category PHP
- * @package PHP_CodeSniffer
- * @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 Release: @package_version@
- * @link http://pear.php.net/package/PHP_CodeSniffer
- */
-class Squiz_Tests_NamingConventions_ValidArrayIndexNameUnitTest extends AbstractSniffUnitTest
-{
-
-
- /**
- * Returns the lines where errors should occur.
- *
- * The key of the array should represent the line number and the value
- * should represent the number of errors that should occur on that line.
- *
- * @return array(int => int)
- */
- public function getErrorList()
- {
- return array(
- 3 => 1,
- 8 => 1,
- );
-
- }//end getErrorList()
-
-
- /**
- * Returns the lines where warnings should occur.
- *
- * The key of the array should represent the line number and the value
- * should represent the number of warnings that should occur on that line.
- *
- * @return array(int => int)
- */
- public function getWarningList()
- {
- return array();
-
- }//end getWarningList()
-
-
-}//end class
-
-?>
Modified: pear/packages/PHP_CodeSniffer/trunk/package.xml
===================================================================
--- pear/packages/PHP_CodeSniffer/trunk/package.xml 2009-08-04 05:19:21 UTC (rev 286785)
+++ pear/packages/PHP_CodeSniffer/trunk/package.xml 2009-08-04 05:46:14 UTC (rev 286786)
@@ -30,6 +30,7 @@
- Unit tests now use a lot less memory while running
- Squiz standard now uses Generic EmptyStatementSniff but throws errors instead of warnings
- Squiz standard now uses Generic UnusedFunctionParameterSniff
+ - Removed unused ValidArrayIndexNameSniff from the Squiz standard
- Fixed bug #16424 : SubversionPropertiesSniff print PHP Warning
- Fixed bug #16450 : Constant PHP_CODESNIFFER_VERBOSITY already defined (unit tests)
- Fixed bug #16453 : function declaration long line splitted error