for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace App\Http\Livewire\Contact;
use App\Interfaces\ContactServiceInterface;
use App\Models\Contact;
use App\Models\User;
use Illuminate\Support\Facades\Auth;
use Livewire\Component;
class Show extends Component
{
public User $user;
public Contact $contact;
public function mount(string $id, ContactServiceInterface $contactService)
$this->user = Auth::user();
$this->contact = $contactService->contact($id, $this->user) ?? abort(404);
abort(404)
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 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.
}
public function render()
return view('livewire.contact.show', [
'contact' => $this->contact,
]);
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.