Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #487 Add phpcbf to run:checker Command #488

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 20 additions & 5 deletions RoboFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,24 +260,26 @@ public function runTest($pathToTestFile = null, $suite = 'acceptance')
}

/**
* Run the specified checker tool. Valid options are phpmd, phpcs, phpcpd
* Run the specified checker tool. Valid options are phpmd, phpcs, phpcbf, phpcpd
*
* @param string $tool The tool
*
* @return bool
*/
public function runChecker($tool = null)
{
$allowedTools = array('phpmd', 'phpcs', 'phpcbf','phpcpd');
$allowedToolsString = implode(', ', $allowedTools);
if ($tool === null)
{
$this->say('You have to specify a tool name as argument. Valid tools are phpmd, phpcs, phpcpd.');
$this->say(sprintf('You have to specify a tool name as argument. Valid tools are %s', $allowedToolsString));

return false;
}

if (!in_array($tool, array('phpmd', 'phpcs', 'phpcpd')))
if (!in_array($tool, $allowedTools))
{
$this->say('The tool you required is not known. Valid tools are phpmd, phpcs, phpcpd.');
$this->say(sprintf('The tool you required is not known. Valid tools are %s', $allowedToolsString));

return false;
}
Expand All @@ -289,7 +291,10 @@ public function runChecker($tool = null)

case 'phpcs':
return $this->runPhpcs();


case 'phpcbf':
return $this->runPhpcbf();

case 'phpcpd':
return $this->runPhpcpd();
}
Expand Down Expand Up @@ -521,6 +526,16 @@ private function runPhpcs()
$this->_exec('phpcs' . $this->extension . ' ' . __DIR__ . '/src');
}

/**
* Run the phpcbf tool
*
* @return void
*/
private function runPhpcbf()
{
$this->_exec('phpcbf --extensions=php' . $this->extension . ' ' . __DIR__ . '/src');
}

/**
* Run the phpcpd tool
*
Expand Down