error in abstract should be compatible with

I have abstract class something like this

protected function update(Request $request, $id)
{
    //function body
}

and extended class like

protected function update(PageRequest $request, $id)
{
    //function body
}

injected PageRequest extended from Request

<?php

namespace AppHttpRequests;

use AppHelpersHelpers;
use AppHttpRequestsRequest;

class PageRequest extends Request
{
    //function body
}

I get this error

Declaration of AppHttpControllersPagesController::update() should
be compatible with
AppHttpControllersMasterControllerCrudController::update(AppHttpRequestsRequest
$request, $id)

I know to pass all of the arguments and access same for update() methods and I think I do it correctly.


Source: laravel

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.