for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
Install GitHub App
<?php
namespace App\Console\Commands;
use App\Classes\PageRouteBuilder;
use App\Classes\Repositories\MenuRepository;
use App\Classes\Repositories\PageRepository;
use App\Model\Menu;
use App\Model\Page;
use Illuminate\Console\Command;
class GeneratePageRoutes extends Command
{
/**
* @var MenuRepository
*/
private $menus;
* The name and signature of the console command.
*
* @var string
protected $signature = 'page.routes.generate';
* The console command description.
protected $description = 'Generate the page routes based on the linked menus.';
* Create a new command instance.
* @return void
@return
Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.
Please refer to the PHP core documentation on constructors.
public function __construct(MenuRepository $menus)
parent::__construct();
$this->menus = $menus;
}
* Execute the console command.
* @return mixed
boolean
This check looks for the generic type array as a return type and suggests a more specific type. This type is inferred from the actual code.
array
public function handle()
/** @var Menu $menu */
foreach ($this->menus->all() as $menu)
PageRouteBuilder::link($menu->page, $menu);
$this->info("{$menu->title} was linked to {$menu->page->slug}");
return true;
Adding a
@returnannotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.