for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
#!/usr/bin/php
<?php
require __DIR__ . '/../vendor/autoload.php';
use Stefaminator\Cli\App;
use Stefaminator\Cli\AppParser;
use Stefaminator\Cli\Cmd;
use Stefaminator\Cli\Color;
AppParser::run(
new class extends App {
public function setup(): Cmd {
return Cmd::root()
->setCallable(static function (Cmd $cmd) {
$cmd->help();
})
->addSubCmd(
Cmd::extend('show')
->setDescription('This command is used to show something. Take a look at the subcommands.')
->setCallable(static function(Cmd $cmd) {
error_reporting(E_ALL);
Cmd::extend('hello')
->setDescription('Displays hello world.')
$cmd
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
->setCallable(static function(/** @scrutinizer ignore-unused */ Cmd $cmd) {
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
self::eol();
self::echo(' Hello world!', Color::FOREGROUND_COLOR_CYAN);
)
Cmd::extend('phpversion')
->setDescription('Displays the current php version of your cli.')
self::echo(' Your PHP version is:', Color::FOREGROUND_COLOR_YELLOW);
self::echo(' ' . PHP_VERSION);
);
}
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.