TypeError: Mailgun\Api\Suppression\Bounce::show():
Return value must be of type ?Mailgun\Model\Suppression\Bounce\ShowResponse, Mailgun\Model\Suppression\Bounce\Bounce returned
The reason for this issue is:
The create() method provided by the class Mailgun\Model\Suppression\Bounce\Bounce uses new self() during instantiation and use self as return type.
Class Mailgun\Model\Suppression\Bounce\ShowResponse extended Mailgun\Model\Suppression\Bounce\ShowResponse,if we call ShowResponse::create() the actual return type will be Mailgun\Model\Suppression\Bounce\Bounce.
In this commit, native php type restrictions were added for the show() method. This change exposed the issue.
The code to replicate the issue is as follows:
The error message is as follows:
The reason for this issue is:
create()
method provided by the classMailgun\Model\Suppression\Bounce\Bounce
usesnew self()
during instantiation and useself
as return type.Mailgun\Model\Suppression\Bounce\ShowResponse
extendedMailgun\Model\Suppression\Bounce\ShowResponse
,if we callShowResponse::create()
the actual return type will beMailgun\Model\Suppression\Bounce\Bounce
.show()
method. This change exposed the issue.