adbario / php-dot-notation

Dot notation access to PHP arrays

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Deprecated error with php8

yndu13 opened this issue · 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"

Same problema here, added "@" temporarily

@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 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?

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.

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