NNTmux /
newznab-tmux
| 1 | <?php |
||
| 2 | |||
| 3 | namespace App\Console\Commands; |
||
| 4 | |||
| 5 | use App\Services\ForkingService; |
||
| 6 | use Illuminate\Console\Command; |
||
| 7 | |||
| 8 | class ProcessSafe extends Command |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * The name and signature of the console command. |
||
| 12 | * |
||
| 13 | * @var string |
||
| 14 | */ |
||
| 15 | protected $signature = 'multiprocessing:safe |
||
| 16 | {type : Type: binaries or backfill}'; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * The console command description. |
||
| 20 | * |
||
| 21 | * @var string |
||
| 22 | */ |
||
| 23 | protected $description = 'Safe binaries or backfill update using multiprocessing'; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * Execute the console command. |
||
| 27 | */ |
||
| 28 | public function handle(): int |
||
| 29 | { |
||
| 30 | $type = $this->argument('type'); |
||
| 31 | |||
| 32 | if (! \in_array($type, ['backfill', 'binaries'], true)) { |
||
| 33 | $this->error('Type must be either: binaries or backfill'); |
||
| 34 | $this->line(''); |
||
| 35 | $this->line('binaries => Do Safe Binaries update'); |
||
| 36 | $this->line('backfill => Do Safe Backfill update'); |
||
| 37 | |||
| 38 | return self::FAILURE; |
||
| 39 | } |
||
| 40 | |||
| 41 | try { |
||
| 42 | $service = new ForkingService; |
||
| 43 | |||
| 44 | match ($type) { |
||
| 45 | 'binaries' => $service->safeBinaries(), |
||
|
0 ignored issues
–
show
|
|||
| 46 | 'backfill' => $service->safeBackfill(), |
||
|
0 ignored issues
–
show
Are you sure the usage of
$service->safeBackfill() targeting App\Services\ForkingService::safeBackfill() seems to always return null.
This check looks for function or method calls that always return null and whose return value is used. class A
{
function getObject()
{
return null;
}
}
$a = new A();
if ($a->getObject()) {
The method The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes. Loading history...
|
|||
| 47 | }; |
||
| 48 | |||
| 49 | return self::SUCCESS; |
||
| 50 | } catch (\Exception $e) { |
||
| 51 | $this->error($e->getMessage()); |
||
| 52 | |||
| 53 | return self::FAILURE; |
||
| 54 | } |
||
| 55 | } |
||
| 56 | } |
||
| 57 |
This check looks for function or method calls that always return null and whose return value is used.
The method
getObject()can return nothing but null, so it makes no sense to use the return value.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.