for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace NFLScores\Commands;
use ErrorException;
use NFLScores\Utilities\Printer;
class WeekCommand extends AbstractCommand
{
/**
* The signature of the command.
*
* @var string
*/
protected $signature = 'week';
* The description of the command.
protected $description = 'Show the scheduled games for the week';
* Execute the console command.
* @return void
public function handle(): void
try {
$printer = new Printer($this);
$printer->renderGamesList($this->NFL->getWeekGames());
} catch (ErrorException $e) {
exit($this->line('Sorry, there was a problem fetching the remote data.'));
exit
In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.
$this->line('Sorry, ther...hing the remote data.')
Illuminate\Console\Command::line()
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 getObject() can return nothing but null, so it makes no sense to use the return value.
getObject()
The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.
}
In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.