moneyphp / money

PHP implementation of Fowler's Money pattern.
http://moneyphp.org
MIT License
4.62k stars 440 forks source link

Deprecated warning on php 8.1.8 for different signature of `jsonSerialize` #705

Closed cristiancalara closed 2 years ago

cristiancalara commented 2 years ago

PHP Deprecated: Return type of Money\Money::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in Money.php on line 521

Found this thread on a different package that might help https://github.com/ramsey/uuid/issues/381#issuecomment-1035461859

I think that to avoid a breaking change - we can just add the #[ReturnTypeWillChange] attribute to the method?

frederikbosch commented 2 years ago

Use Money v4.

garak commented 2 years ago

Use Money v4.

I'd love to (and I use it sometimes). But there are some situations where you just cannot use v4, mainly when you have a server with PHP 8 without bcmath extension. In such a case, even composer, by requiring this library without constraints, makes you install v3.

I perfectly understand the decision of not supporting an old branch, but could you please make an exception for this edge case? After all, it's just about merging the related PR and releasing a patch version.

frederikbosch commented 2 years ago

Done, also tagged a new 3.x version.

wilr commented 6 months ago

If I'm not mistaken this is still an issue in v4 on PHP 8.2. https://github.com/silverstripe/silverstripe-omnipay/actions/runs/8611734928/job/23599504795?pr=247

frederikbosch commented 6 months ago

You are installing lowest dependencies there, right? That results in MoneyPHP 3.1.0 being installed. See also composer.json of omnipay/common.

You need at least MoneyPHP 3.3.2 for PHP 8.2.

Actually, I cannot believe this is still an issue. MoneyPHP v3.1.0 is from 2018. This is a waste of my, and anybody else's time.

wilr commented 6 months ago

@frederikbosch My sincere apologies if this is a waste of time. As far as I can see from that failed run 4.5.0 is installed and being used with PHP 8.2 and still failing hence my enquiry.

Screenshot 2024-04-09 at 8 11 44 PM
frederikbosch commented 6 months ago

Where is that screenshot from? In the link you included in the original message, where I relinked to in my reply, you see that MoneyPHP 3.1.0 is being installed, not version 4.