PHP 8.5 (to be released in November) deprecates the magic methods __sleep and __wakeup:
https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_the_sleep_and_wakeup_magic_methods
This currently causes the warning "Deprecated: The __sleep() serialization magic method has been deprecated. Implement __serialize() instead (or in addition, if support for old PHP versions is necessary)".
As long as PHP < 7.4 is supported the best fix is to simply add __serialize and __unserialize methods as wrappers (or move the logic to these and make __sleep and __wakeup the wrappers).