backblaze-b2 icon indicating copy to clipboard operation
backblaze-b2 copied to clipboard

Compatibility with PHP 8.1

Open BenMorel opened this issue 3 years ago • 5 comments

Fix for a deprecation warning on PHP 8.1:

Return type of BackblazeB2\File::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

BenMorel avatar Aug 14 '22 22:08 BenMorel

@mlambley Any chance this can be merged?

BenMorel avatar Oct 09 '22 23:10 BenMorel

Fixed via https://github.com/gliterd/backblaze-b2/pull/78 Please confirm it now works.

mlambley avatar Oct 10 '22 00:10 mlambley

This should work for PHP 8.0+, but I think you just broke compatibility with PHP 7.2 - 7.4 (the mixed return type is a new addition in PHP 8.0, while the #[ReturnTypeWillChange] is a way around the deprecation that is compatible with all versions).

It looks like your last Travis build ran 2 years ago, do you want a PR to add GitHub actions instead? This would prevent such issues.

BenMorel avatar Oct 10 '22 20:10 BenMorel

Yeah that's a good point. Please resolve your conflicts and I'll merge this instead.

mlambley avatar Oct 11 '22 03:10 mlambley

@mlambley Done!

BenMorel avatar Nov 01 '22 11:11 BenMorel