Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

Type hints in mailable constructor must be an object #52

Closed
MartijnDB opened this issue Sep 23, 2019 · 6 comments
Closed

Type hints in mailable constructor must be an object #52

MartijnDB opened this issue Sep 23, 2019 · 6 comments
Labels
bug Something isn't working

Comments

@MartijnDB
Copy link

In my mailable contructor I have a typehint for int and it fails on that:
"Argument 1 passed to App\Mail\XXX::__construct() must be of the type int, object given"

@Qoraiche Qoraiche added the bug Something isn't working label Sep 23, 2019
@Qoraiche
Copy link
Owner

Qoraiche commented Sep 23, 2019

Hello @MartijnDB,

can please share your mailable, please?

@MartijnDB
Copy link
Author

Sure. See the screenshot.
Screenshot_2019-09-23, 11_39_09

@ReeceM
Copy link
Collaborator

ReeceM commented Sep 23, 2019

@Qoraiche, and @MartijnDB.

I have had a look at it and initially there isn't a way to account for all the PHP builtin types as the __toString magic method allows for one to react to the string type hint.

Things like the int, bool, float types need to be accounted for differently.

I have a working patch on my local fork of the repo, I will clean it up and push it and you can test it as a PR on the main repo here.

Please let me know if this is okay?

@Qoraiche
Copy link
Owner

@ReeceM of course, thank you

ReeceM added a commit to ReeceM/laravel-mail-editor that referenced this issue Sep 23, 2019
@ReeceM ReeceM mentioned this issue Sep 23, 2019
Qoraiche pushed a commit that referenced this issue Sep 28, 2019
@ReeceM
Copy link
Collaborator

ReeceM commented Sep 28, 2019

HI @MartijnDB, release v1.3.2 should have fixed your issue you were experiencing with the mailables. Please do a composer update and reply back if it has fixed it

@MartijnDB
Copy link
Author

Yes. Works as expected. Thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants