Method execute
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function execute(InputInterface $input, OutputInterface $output)
{
$helper = $this->getHelper('question');
$args = [
'--standard' => $this->getApplication()->getConfigFilePath('phpcs.xml'),
Function execute
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function execute(InputInterface $input, OutputInterface $output)
{
$helper = $this->getHelper('question');
$args = [
'--standard' => $this->getApplication()->getConfigFilePath('phpcs.xml'),
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid too many return
statements within this method. Open
return $code;
Avoid assigning values to variables in if clauses and the like (line '67', column '14'). Open
protected function execute(InputInterface $input, OutputInterface $output)
{
$helper = $this->getHelper('question');
$args = [
'--standard' => $this->getApplication()->getConfigFilePath('phpcs.xml'),
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
Avoid assigning values to variables in if clauses and the like (line '40', column '14'). Open
protected function execute(InputInterface $input, OutputInterface $output)
{
$helper = $this->getHelper('question');
$args = [
'--standard' => $this->getApplication()->getConfigFilePath('phpcs.xml'),
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
Call to method __construct
from undeclared class \Symfony\Component\Console\Question\ConfirmationQuestion
Open
if (!$helper->ask($input, $output, new ConfirmationQuestion(
- Exclude checks
Reference to constant VALUE_NONE
from undeclared class \Symfony\Component\Console\Input\InputOption
Open
->addOption('ignore-tests', null, InputOption::VALUE_NONE, 'Ignore /tests/ directories')
- Exclude checks
Call to method __construct
from undeclared class \Symfony\Component\Console\Question\ConfirmationQuestion
Open
if (!$helper->ask($input, $output, new ConfirmationQuestion(
- Exclude checks
Reference to constant VALUE_NONE
from undeclared class \Symfony\Component\Console\Input\InputOption
Open
->addOption('ignore-debug', null, InputOption::VALUE_NONE, 'Ignore /debug/ directories')
- Exclude checks
Parameter $input
has undeclared type \Symfony\Component\Console\Input\InputInterface
Open
protected function execute(InputInterface $input, OutputInterface $output)
- Exclude checks
Call to method writeln
from undeclared class \Symfony\Component\Console\Output\OutputInterface
Open
$output->writeln('<fg=green>Code looks great. Go on!</>');
- Exclude checks
Call to undeclared method \Phug\DevTool\Command\CodeStyleCheckCommand::setName
Open
$this->setName('code-style:check')
- Exclude checks
Call to method writeln
from undeclared class \Symfony\Component\Console\Output\OutputInterface
Open
$output->writeln('You can always fix code-style problems by running the [code-style:fix] command.');
- Exclude checks
Call to method writeln
from undeclared class \Symfony\Component\Console\Output\OutputInterface
Open
$output->writeln('<fg=green>All fixable problems have been fixed.</>');
- Exclude checks
Parameter $output
has undeclared type \Symfony\Component\Console\Output\OutputInterface
Open
protected function execute(InputInterface $input, OutputInterface $output)
- Exclude checks
Call to undeclared method \Phug\DevTool\Command\CodeStyleCheckCommand::getHelper
Open
$helper = $this->getHelper('question');
- Exclude checks
Call to method writeln
from undeclared class \Symfony\Component\Console\Output\OutputInterface
Open
$output->writeln(
- Exclude checks
Call to method getOption
from undeclared class \Symfony\Component\Console\Input\InputInterface
Open
if ($input->getOption('ignore-tests')) {
- Exclude checks
Call to method getOption
from undeclared class \Symfony\Component\Console\Input\InputInterface
Open
if ($input->getOption('ignore-debug')) {
- Exclude checks
Call to method writeln
from undeclared class \Symfony\Component\Console\Output\OutputInterface
Open
$output->writeln('<fg=green>Code looks great. Go on!</>');
- Exclude checks