Skip to content

fix: change customer email property type to a nullable string#882

Open
edwinvdpol wants to merge 1 commit intomollie:mainfrom
edwinvdpol:fix/nullable-customer-email
Open

fix: change customer email property type to a nullable string#882
edwinvdpol wants to merge 1 commit intomollie:mainfrom
edwinvdpol:fix/nullable-customer-email

Conversation

@edwinvdpol
Copy link
Copy Markdown
Contributor

Hi 👋

After I added strict type to my PHP file, I got this error in production:

TypeError
strtolower(): Argument #1 ($string) must be of type string, null given

in this line of code:

// $mollie is an instance of Mollie\Api\Resources\Customer
if ($user->email !== strtolower($mollie->email) && filled($user->email)) {
    ....
}

This PR changes the customer email property type to a nullable string.

@sandervanhooft
Copy link
Copy Markdown
Collaborator

Thanks @edwinvdpol , let me verify this.

@sandervanhooft
Copy link
Copy Markdown
Collaborator

Hi @edwinvdpol ,

Double check to ensure we get this right: this looks like an issue raised by a static type checker, i.e. PHPStan, correct?

So the code itself is not actually throwing an exception?

@edwinvdpol
Copy link
Copy Markdown
Contributor Author

Hi @sandervanhooft,

It did throw an exception in production after I added declare(strict_types=1); to the top of the file:

Screenshot 2026-04-24 at 10 28 07

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

Successfully merging this pull request may close these issues.

2 participants