Skip to content

Commit

Permalink
Brought the svn pre-commit hook in line with the latest CLI class cha…
Browse files Browse the repository at this point in the history
…nges

git-svn-id: http://svn.php.net/repository/pear/packages/PHP_CodeSniffer/trunk@293562 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information
gsherwood committed Jan 14, 2010
1 parent 3ff0e51 commit a3b0525
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CodeSniffer.php
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,12 @@ public function process($files, $standard, array $sniffs=array(), $local=false)

$this->populateTokenListeners();

// The SVN pre-commit calls process() to init the sniffs
// so there may not be any files to process.
if (empty($files) === true) {
return;
}

foreach ($files as $file) {
$this->file = $file;
if (is_dir($this->file) === true) {
Expand Down
3 changes: 2 additions & 1 deletion scripts/phpcs-svn-pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class PHP_CodeSniffer_SVN_Hook extends PHP_CodeSniffer_CLI
/**
* Processes an unknown command line argument.
*
* All unkown args are sent to SVN commands.
* All unknown 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.
Expand Down Expand Up @@ -130,6 +130,7 @@ class PHP_CodeSniffer_SVN_Hook extends PHP_CodeSniffer_CLI
}

// Initialize PHP_CodeSniffer listeners but don't process any files.
$phpcs->setCli($this);
$phpcs->process(array(), $values['standard'], $values['sniffs']);

foreach (preg_split('/\v/', $contents, -1, PREG_SPLIT_NO_EMPTY) as $path) {
Expand Down

0 comments on commit a3b0525

Please sign in to comment.