mirror of
https://github.com/joomla-extensions/weblinks.git
synced 2024-06-09 09:42:24 +00:00
Merge pull request #1 from alexandreelise/alexandreelise-patch-1
Fix #487 Add phpcbf to run:checker Command
This commit is contained in:
commit
7af1abeb4e
25
RoboFile.php
25
RoboFile.php
|
@ -260,7 +260,7 @@ class RoboFile extends Tasks
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
* @param string $tool The tool
|
||||||
*
|
*
|
||||||
|
@ -268,16 +268,18 @@ class RoboFile extends Tasks
|
||||||
*/
|
*/
|
||||||
public function runChecker($tool = null)
|
public function runChecker($tool = null)
|
||||||
{
|
{
|
||||||
|
$allowedTools = array('phpmd', 'phpcs', 'phpcbf','phpcpd');
|
||||||
|
$allowedToolsString = implode(', ', $allowedTools);
|
||||||
if ($tool === null)
|
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;
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -289,7 +291,10 @@ class RoboFile extends Tasks
|
||||||
|
|
||||||
case 'phpcs':
|
case 'phpcs':
|
||||||
return $this->runPhpcs();
|
return $this->runPhpcs();
|
||||||
|
|
||||||
|
case 'phpcbf':
|
||||||
|
return $this->runPhpcbf();
|
||||||
|
|
||||||
case 'phpcpd':
|
case 'phpcpd':
|
||||||
return $this->runPhpcpd();
|
return $this->runPhpcpd();
|
||||||
}
|
}
|
||||||
|
@ -521,6 +526,16 @@ class RoboFile extends Tasks
|
||||||
$this->_exec('phpcs' . $this->extension . ' ' . __DIR__ . '/src');
|
$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
|
* Run the phpcpd tool
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue
Block a user