Closed
Description
The code to replicate the issue is as follows:
$mg = Mailgun::create('key-example');
$mg->suppressions()->bounces()->show('domain', $email);
The error message is as follows:
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 classMailgun\Model\Suppression\Bounce\Bounce
usesnew self()
during instantiation and useself
as return type. - Class
Mailgun\Model\Suppression\Bounce\ShowResponse
extendedMailgun\Model\Suppression\Bounce\ShowResponse
,if we callShowResponse::create()
the actual return type will beMailgun\Model\Suppression\Bounce\Bounce
. - In this commit, native php type restrictions were added for the
show()
method. This change exposed the issue.
Metadata
Metadata
Assignees
Labels
No labels