Php

Void return types

If a method return nothing, it SHOULD be indicated with void. This makes it more clear to the users of your code what your intention was when writing it.

UserController.php
namespace App\Http\Controllers;

class UserController extends Controller {

    public function create(array $data): void
    {
        User::create($data);
    }
}
Copyright © 2026