laravel-shift/blueprint

Wrong return type on controller, when returning a View

Konafets opened this issue · 1 comments

  • Laravel Version: 9.38.0
  • PHP Version: 8.1.12
  • Blueprint Version: 2.4
  • Platform: Mac

Issue:

I set 'use_return_types' => true, in config/blueprint.php. Blueprint adds the return types but does not take the real return type into account, which in case of a create() action is View.

class UserController extends Controller
{
    /**
     * @param \Illuminate\Http\Request $request
     * @return \Illuminate\Http\Response
     */
    public function create(Request $request): \Illuminate\Http\Response
    {
        return view('user.create');
    }
   
    //...    
}

draft.yaml:

models:
  User:
    name: string
    email: string unique
    email_verified_at: datetime nullable
    password: string
    remember_token: rememberToken
    softDeletes

controllers:
  User:
    resource

I'm not 100% on this. However, since Laravel 10 will be increasing their support for types, I'm accepting @ghostwriter's PR as I know he does good work.