for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Yarak\Commands;
use Yarak\Output\SymfonyOutput;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class MigrateRollback extends YarakCommand
{
/**
* Configure the command.
*/
protected function configure()
$this->setName('migrate:rollback')
->setDescription('Rollback migrations by given number of steps.')
->setHelp('This command allows you to rollback migrations.')
->addOption(
'steps',
null,
InputOption::VALUE_OPTIONAL,
'Number of steps to rollback.',
1
);
}
* Execute the command.
*
* @param InputInterface $input
* @param OutputInterface $output
protected function execute(InputInterface $input, OutputInterface $output)
$migrator = $this->getMigrator(new SymfonyOutput($output))
$migrator
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
$myVar = 'Value'; $higher = false; if (rand(1, 6) > 3) { $higher = true; } else { $higher = false; }
Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.
$myVar
$higher
->rollback($input->getOption('steps'));
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.