Skip to content

Fix the return type #396

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 18, 2022
Merged

Fix the return type #396

merged 1 commit into from
Jul 18, 2022

Conversation

adelynx
Copy link
Contributor

@adelynx adelynx commented Jul 16, 2022

In a scenario where you may need to extend the ConfirmedPasswordStatusController to a custom controller and you need to call the show() method inside a function with a return type hint you will get the worning below:

Return value is expected to be '\Illuminate\Http\JsonResponse', '\Illuminate\Http\Response' returned 

Example:

<?php

declare(strict_types=1);

namespace App\Http\Controllers\Auth;

use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;

class ConfirmedPasswordStatusController extends \Laravel\Fortify\Http\Controllers\ConfirmedPasswordStatusController
{
    /**
     * Get the password confirmation status.
     *
     * @param \Illuminate\Http\Request $request
     *
     * @return \Illuminate\Http\JsonResponse
     */
    public function __invoke(Request $request): JsonResponse
    {
        return parent::show($request);
    }

@taylorotwell taylorotwell merged commit db1e375 into laravel:1.x Jul 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants