php-dot-notation icon indicating copy to clipboard operation
php-dot-notation copied to clipboard

Deprecated error with php8

Open yndu13 opened this issue 1 year ago • 1 comments

Error Message: PHP Deprecated: Return type of Adbar\Dot::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/dyn/AliGitRepo/openapi-sdk-php-client/vendor/adbario/php-dot-notation/src/Dot.php on line 603

"adbario/php-dot-notation": "^2.3"

yndu13 avatar Aug 02 '22 03:08 yndu13

Same problema here, added "@" temporarily

nicojmb avatar Aug 04 '22 16:08 nicojmb

@yndu13 @nicojmb

If you're on v2.3, it supports PHP up to 8.1.

For some reason, the release seems to be dated in 2019 though, so I'm assuming something has gone wrong. I've just done a new release as v2.4, and that should fix the issue. All the automated tests are passing on PHP 5.5 -> PHP 8.1

Let me know if 2.4 doesn't fix the issues.

There's also a v3 which adds some additional features but supports only PHP 7.4 and up.

adbario avatar Aug 17 '22 00:08 adbario

@adbario Not sure what changed between 2.2 and 2.4, but the issue remains. We either need the return type changed to mixed or the same annotation added to jsonSerialize as was added to getIterator (#[\ReturnTypeWillChange]).

This is causing deprecation warnings to pop up in downstream libraries, could we possibly get this fixed real quick?

jamisonbryant avatar Aug 25 '22 19:08 jamisonbryant

Thanks @jamisonbryant, your PR was just approved and a new release is out. I'm surprised that you've seen deprecation warnings as all the tests were passing already before, but hopefully this fixes the issue now.

adbario avatar Aug 25 '22 19:08 adbario

You're welcome, glad to be of service! Thank you for responding so quickly.

jamisonbryant avatar Aug 25 '22 20:08 jamisonbryant