for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Hhxsv5\LaravelS\Components\Apollo;
use Hhxsv5\LaravelS\Console\Portal;
use Hhxsv5\LaravelS\Swoole\Coroutine\Context;
use Hhxsv5\LaravelS\Swoole\Process\CustomProcessInterface;
use Swoole\Coroutine;
use Swoole\Http\Server;
use Swoole\Process as SwooleProcess;
class Process implements CustomProcessInterface
{
/**@var Client $apollo */
protected static $apollo;
public static function getDefinition()
return [
'apollo' => [
'class' => static::class,
'redirect' => false,
'pipe' => 0,
'enable' => (bool)getenv('ENABLE_APOLLO'),
],
];
}
public static function callback(Server $swoole, SwooleProcess $process)
$filename = base_path('.env');
base_path
If this is a false-positive, you can also ignore this issue in your code via the ignore-call annotation
ignore-call
$filename = /** @scrutinizer ignore-call */ base_path('.env');
if (isset($_ENV['_ENV'])) {
$filename .= '.' . $_ENV['_ENV'];
self::$apollo = Client::createFromEnv();
self::$apollo->startWatchNotification(function (array $notifications) use ($process, $filename) {
$notifications
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
self::$apollo->startWatchNotification(function (/** @scrutinizer ignore-unused */ array $notifications) use ($process, $filename) {
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
$process
This check looks for imports that have been defined, but are not used in the scope.
$configs = self::$apollo->pullAllAndSave($filename);
app('log')->info('[ApolloProcess] Pull all configurations', $configs);
app
/** @scrutinizer ignore-call */
Portal::runLaravelSCommand(base_path(), 'reload');
Portal::runLaravelSCommand(/** @scrutinizer ignore-call */ base_path(), 'reload');
if (Context::inCoroutine()) {
Coroutine::sleep(5);
} else {
sleep(5);
});
If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:
someFunctionCall( $firstArgument, $secondArgument, $thirdArgument ); // Closing parenthesis on a new line.
public static function onReload(Server $swoole, SwooleProcess $process)
// Stop the process...
self::$apollo->stopWatchNotification();