for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace App\Console\Commands;
use App\User;
use Illuminate\Console\Command;
class ListUserCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'user:list';
* The console command description.
protected $description = 'List all users with a table format.';
* Create a new command instance.
* @return void
public function __construct()
parent::__construct();
}
* Execute the console command.
* @return mixed
public function handle()
try {
$tasks = User::all()->toArray();
$headers = array_keys($tasks[0]);
$tasks[0]
App\User
array
$input
array_keys()
If this is a false-positive, you can also ignore this issue in your code via the ignore-type annotation
ignore-type
$headers = array_keys(/** @scrutinizer ignore-type */ $tasks[0]);
$this->table($headers, $tasks);
} catch (exception $e) {
App\Console\Commands\exception
exception
\
$this->error('Error: '.$e);