Skip to content

TypeError: Mailgun\Api\Suppression\Bounce::show() #878

Closed
@Quarkay

Description

@Quarkay

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:

  1. The create() method provided by the class Mailgun\Model\Suppression\Bounce\Bounce uses new self() during instantiation and use self as return type.
  2. 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.
  3. In this commit, native php type restrictions were added for the show() method. This change exposed the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions