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

Docblocks for properties not working #69

Closed
ricklambrechts opened this issue May 21, 2021 · 8 comments
Closed

Docblocks for properties not working #69

ricklambrechts opened this issue May 21, 2021 · 8 comments

Comments

@ricklambrechts
Copy link
Sponsor Contributor

ricklambrechts commented May 21, 2021

Hi,

Most of the things are working great, thanks!

But when using the provided option inside a settings class:

/** @var int[]|null  */
public $an_array_of_ints_or_null;

I get the exception:

ArraySettingsCast::__construct(): Argument #1 ($cast) must be of type Spatie\LaravelSettings\SettingsCasts\SettingsCast, null given. (SettingsCastFactory.php on line 69)
@rubenvanassche
Copy link
Member

Hi @ricklambrechts,

This should be fixed with v2.1.5!

@ricklambrechts
Copy link
Sponsor Contributor Author

Awesome!

@ricklambrechts
Copy link
Sponsor Contributor Author

ricklambrechts commented May 25, 2021

@rubenvanassche Packagist is not showing the new version. Could you look into it?

@rubenvanassche
Copy link
Member

That's strange, updated it: https://packagist.org/packages/spatie/laravel-settings

@argonzalez2016
Copy link

This is not working when using the cache

@rubenvanassche
Copy link
Member

Hi @argonzalez2016, could you provide me an example. Casts are only used to transform values between repository and settings class. When caching we serialize the complete setttings object so the values should be exactly the same as before caching.

@argonzalez2016
Copy link

I found the issue. I was trying to cache a laravel collection and it was calling the toArray method before serializing.

@rubenvanassche
Copy link
Member

Yeah, personally, I wouldn't use too complex types within a settings class because that opens the door for a lot of things that can go wrong. But technically it is possible 😄

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

3 participants