Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
emergingdzns opened this issue Jan 24, 2025 · 1 comment
Open

Comments

@emergingdzns
Copy link

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.

@swember
Copy link
Contributor

swember commented Feb 4, 2025

Hello @emergingdzns, thank you very much for your report. I checked the class you mentioned and I can see that $externalId is defined as string|array there. Could you please share which version of the library you use?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants