Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP 8.4 compatibility #167

Closed
jpxd opened this issue Dec 28, 2024 · 2 comments
Closed

PHP 8.4 compatibility #167

jpxd opened this issue Dec 28, 2024 · 2 comments
Milestone

Comments

@jpxd
Copy link

jpxd commented Dec 28, 2024

PHP 8.4 has been released for a few weeks now and I started to test upgrades in a project of mine where I use reactphp-redis. As of now it seems that the library is not compatible yet because of one deprecation: implicitly nullable parameter types are now deprecated and result in an ErrorException (see https://wiki.php.net/rfc/deprecate-implicitly-nullable-types).

Example in version 2.7 of reactphp-redis in file src/Factory.php:30:

   /**
     * @param ?LoopInterface $loop
     * @param ?ConnectorInterface $connector
     * @param ?ProtocolFactory $protocol
     */
    public function __construct(LoopInterface $loop = null, ConnectorInterface $connector = null, ProtocolFactory $protocol = null)
    {
        $this->loop = $loop ?: Loop::get();
        $this->connector = $connector ?: new Connector(array(), $this->loop);
        $this->protocol = $protocol ?: new ProtocolFactory();
    }

The parameters are marked as nullable in the doctype comment, but not the actual type declaration like e.g. function __construct(?LoopInterface $loop = null, .... This raises an error exception in PHP8.4 like this:

ErrorException: Clue\React\Redis\Factory::__construct(): Implicitly marking parameter $loop as nullable is deprecated, the explicit nullable type must be used instead in vendor/clue/redis-react/src/Factory.php:30

Any chance this still can get fixed in version 2.x? That would be great! Or do we just have to wait for version 3.x for PHP8.4? Thank you for your library! 😃

@clue clue added this to the v2.8.0 milestone Dec 29, 2024
@clue
Copy link
Owner

clue commented Dec 29, 2024

@jpxd Thanks for the friendly reminder and for filing this ticket!

I've indeed prepared PHP 8.4 compatibility with #157 and related upstream tickets on the 3.x branch a while ago, but for personal reasons haven't gotten around to preparing a release yet and had to focus my attention on other areas for now as this project doesn't usually receive required financial support at the moment.

Seeing this major release will still take some non-trivial amount of work (and time), I've started backporting the relevant changes to the 2.x branch in #165 already for the time being. The plan would be to get a v2.8.0 out with the relevant changes as soon as time allows and continue working on the major effort without blocking this release.

I'll make sure to coordinate the release process and will update this ticket as soon as possible.

In the meantime, I hope this helps! 👍 If so, consider supporting this project, for example by becoming a sponsor ❤️

@clue clue closed this as completed Jan 3, 2025
@clue
Copy link
Owner

clue commented Jan 3, 2025

Just released https://github.com/clue/reactphp-redis/releases/tag/v2.8.0 🎉

I hope you enjoy this! 👍 If so, consider supporting this project, for example by becoming a sponsor ❤️ Happy New Year!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants