for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace ByTIC\Migrations\Migrator\Traits;
use Phinx\Console\PhinxApplication;
use Symfony\Component\Console\Input\ArrayInput;
/**
* Trait RunCommandsTrait
* @package ByTIC\Migrations\Migrator\Traits
*/
trait RunCommandsTrait
{
* @param array $arguments
* @param $output
* @return int
public function migrate($arguments = [], $output = null)
return $this->runCommand('migrate', $arguments, $output);
}
public function create($arguments = [], $output = null)
return $this->runCommand('create', $arguments, $output);
* @param $command
* @noinspection PhpDocMissingThrowsInspection
protected function runCommand($command, $arguments = [], $output = null)
$output
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
protected function runCommand($command, $arguments = [], /** @scrutinizer ignore-unused */ $output = null)
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
$phinx = new PhinxApplication();
$command = $phinx->find($command);
$command
var_dump($arguments);die();
exit
In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.
var_dump($arguments)
$arguments['command'] = $command;
$arguments['command'] = $command
This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.
Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.
return
die
function fx() { try { doSomething(); return true; } catch (\Exception $e) { return false; } return false; }
In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.
return false
$arguments['--configuration'] = $this->getCachedConfigPath();
$input = new ArrayInput($arguments);
/** @noinspection PhpUnhandledExceptionInspection */
return $command->run(new ArrayInput($arguments), $output);
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.