Skip to content

Doc block definition incorrect for Customer::findByExternalId method #135

@emergingdzns

Description

@emergingdzns

Our internal CI/CD tools have identified that the Customer class findByExternalId method is not defined properly.

Following the documentation I am fetching the customer like this, passing in an array:

$cm_customer = Customer::findByExternalId([
    "external_id" => $subscriber_id,
    "data_source_uuid" => $datasource_uuid
]);

This works. But the tools are saying:

Error: Parameter #1 $externalId of static method ChartMogul\Customer::findByExternalId() expects string, array<string, mixed> given.
Error: Variable $datasource_uuid might not be defined.

The reason it works is because in the class you check for gettype and if it's not a string you wrap it in an array.

The problem is that the docblock above has the first parameter noted as:

* @param  string               $externalId

The string should be set to mixed or as string|array.

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