cvs: pear /PHP_CodeSniffer/CodeSniffer CLI.php /PHP_CodeSniffer/scripts phpcs-svn-pre-commit

From: Date: Mon, 31 Mar 2008 00:51:25 +0000
Subject: cvs: pear /PHP_CodeSniffer/CodeSniffer CLI.php /PHP_CodeSniffer/scripts phpcs-svn-pre-commit
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-51754@lists.php.net to get a copy of this message
squiz Mon Mar 31 00:51:25 2008 UTC Modified files: /pear/PHP_CodeSniffer/CodeSniffer CLI.php /pear/PHP_CodeSniffer/scripts phpcs-svn-pre-commit Log: Fixed problem setting config values by passing position of command line args when processing them http://cvs.php.net/viewvc.cgi/pear/PHP_CodeSniffer/CodeSniffer/CLI.php?r1=1.1&r2=1.2&diff_format=u Index: pear/PHP_CodeSniffer/CodeSniffer/CLI.php diff -u pear/PHP_CodeSniffer/CodeSniffer/CLI.php:1.1 pear/PHP_CodeSniffer/CodeSniffer/CLI.php:1.2 --- pear/PHP_CodeSniffer/CodeSniffer/CLI.php:1.1 Mon Mar 10 02:39:04 2008 +++ pear/PHP_CodeSniffer/CodeSniffer/CLI.php Mon Mar 31 00:51:25 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: CLI.php,v 1.1 2008/03/10 02:39:04 squiz Exp $ + * @version CVS: $Id: CLI.php,v 1.2 2008/03/31 00:51:25 squiz Exp $ * @link http://pear.php.net/package/PHP_CodeSniffer */ @@ -108,7 +108,7 @@ $arg = $_SERVER['argv'][$i]; if ($arg{0} === '-') { if ($arg{1} === '-') { - $values = $this->processLongArgument(substr($arg, 2), $values); + $values = $this->processLongArgument(substr($arg, 2), $i, $values); } else { $switches = str_split($arg); foreach ($switches as $switch) { @@ -120,7 +120,7 @@ } } } else { - $values = $this->processUnknownArgument($arg, $values); + $values = $this->processUnknownArgument($arg, $i, $values); } }//end for @@ -175,12 +175,13 @@ * Processes a long (--example) command line argument. * * @param string $arg The command line argument. + * @param int $pos The position of the argument on the command line. * @param array $values An array of values determined from CLI args. * * @return array The updated CLI values. * @see getCommandLineValues() */ - public function processLongArgument($arg, $values) + public function processLongArgument($arg, $pos, $values) { switch ($arg) { case 'help': @@ -193,13 +194,13 @@ exit(0); break; case 'config-set': - $key = $_SERVER['argv'][($i + 1)]; - $value = $_SERVER['argv'][($i + 2)]; + $key = $_SERVER['argv'][($pos + 1)]; + $value = $_SERVER['argv'][($pos + 2)]; PHP_CodeSniffer::setConfigData($key, $value); exit(0); break; case 'config-delete': - $key = $_SERVER['argv'][($i + 1)]; + $key = $_SERVER['argv'][($pos + 1)]; PHP_CodeSniffer::setConfigData($key, null); exit(0); break; @@ -253,12 +254,13 @@ * Assumes all unknown arguments are files and folders to check. * * @param string $arg The command line argument. + * @param int $pos The position of the argument on the command line. * @param array $values An array of values determined from CLI args. * * @return array The updated CLI values. * @see getCommandLineValues() */ - public function processUnknownArgument($arg, $values) + public function processUnknownArgument($arg, $pos, $values) { // We don't know about any additional switches; just files. if ($arg{0} === '-') { http://cvs.php.net/viewvc.cgi/pear/PHP_CodeSniffer/scripts/phpcs-svn-pre-commit?r1=1.2&r2=1.3&diff_format=u Index: pear/PHP_CodeSniffer/scripts/phpcs-svn-pre-commit diff -u pear/PHP_CodeSniffer/scripts/phpcs-svn-pre-commit:1.2 pear/PHP_CodeSniffer/scripts/phpcs-svn-pre-commit:1.3 --- pear/PHP_CodeSniffer/scripts/phpcs-svn-pre-commit:1.2 Wed Mar 26 02:53:02 2008 +++ pear/PHP_CodeSniffer/scripts/phpcs-svn-pre-commit Mon Mar 31 00:51:25 2008 @@ -11,7 +11,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: phpcs-svn-pre-commit,v 1.2 2008/03/26 02:53:02 squiz Exp $ + * @version CVS: $Id: phpcs-svn-pre-commit,v 1.3 2008/03/31 00:51:25 squiz Exp $ * @link http://pear.php.net/package/PHP_CodeSniffer */ @@ -61,12 +61,13 @@ * All unkown args are sent to SVN commands. * * @param string $arg The command line argument. + * @param int $pos The position of the argument on the command line. * @param array $values An array of values determined from CLI args. * * @return array The updated CLI values. * @see getCommandLineValues() */ - public function processUnknownArgument($arg, $values) + public function processUnknownArgument($arg, $pos, $values) { $values['svnArgs'][] = $arg; return $values;

« previous php.pear.cvs (#51754) next »