Php

Void return types

If a method returns 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.

namespace App\Http\Controllers;

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