Skip to content

Require react/promise:^3.3, but preserve React\Promise\*PromiseInterface#61

Closed
Al2Klimov wants to merge 2 commits intomainfrom
ExtendedPromiseInterface
Closed

Require react/promise:^3.3, but preserve React\Promise\*PromiseInterface#61
Al2Klimov wants to merge 2 commits intomainfrom
ExtendedPromiseInterface

Conversation

@Al2Klimov
Copy link
Member

@Al2Klimov Al2Klimov commented Jan 21, 2026

for their existing users as aliases for their base interface, PromiseInterface.

Now our code works with the latest react/promise and has time to switch to PromiseInterface.

TODO

as aliases for their base interface, PromiseInterface.

Now our code works with the latest React\Promise and has time to switch to PromiseInterface.
@cla-bot cla-bot bot added the cla/signed CLA is signed by all contributors of a PR label Jan 21, 2026
Copy link
Member Author

@Al2Klimov Al2Klimov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test

  • rm -rf vendor composer.lock
  • composer install
  • php test.php
test.php
<?php

use ipl\Scheduler\Common\TaskProperties;
use ipl\Scheduler\Contract\Task;
use React\Promise\Deferred;
use React\Promise\ExtendedPromiseInterface;

require_once __DIR__ . '/vendor/autoload.php';

class TestTask implements Task
{
    use TaskProperties;

    public function run(): ExtendedPromiseInterface
    {
        return (new Deferred())->promise();
    }
}

var_dump((new TestTask())->run());

652c13c / main

Works, but.. holy crap – deprecation warnings everywhere.

Details
PHP Deprecated:  React\Promise\Deferred::__construct(): Implicitly marking parameter $canceller as nullable is deprecated, the explicit nullable type must be used instead in /Users/aklimov/NET/WS/ipl-scheduler/vendor/react/promise/src/Deferred.php on line 13

Deprecated: React\Promise\Deferred::__construct(): Implicitly marking parameter $canceller as nullable is deprecated, the explicit nullable type must be used instead in /Users/aklimov/NET/WS/ipl-scheduler/vendor/react/promise/src/Deferred.php on line 13
PHP Deprecated:  React\Promise\Promise::__construct(): Implicitly marking parameter $canceller as nullable is deprecated, the explicit nullable type must be used instead in /Users/aklimov/NET/WS/ipl-scheduler/vendor/react/promise/src/Promise.php on line 16

Deprecated: React\Promise\Promise::__construct(): Implicitly marking parameter $canceller as nullable is deprecated, the explicit nullable type must be used instead in /Users/aklimov/NET/WS/ipl-scheduler/vendor/react/promise/src/Promise.php on line 16
PHP Deprecated:  React\Promise\Promise::then(): Implicitly marking parameter $onFulfilled as nullable is deprecated, the explicit nullable type must be used instead in /Users/aklimov/NET/WS/ipl-scheduler/vendor/react/promise/src/Promise.php on line 28

Deprecated: React\Promise\Promise::then(): Implicitly marking parameter $onFulfilled as nullable is deprecated, the explicit nullable type must be used instead in /Users/aklimov/NET/WS/ipl-scheduler/vendor/react/promise/src/Promise.php on line 28
PHP Deprecated:  React\Promise\Promise::then(): Implicitly marking parameter $onRejected as nullable is deprecated, the explicit nullable type must be used instead in /Users/aklimov/NET/WS/ipl-scheduler/vendor/react/promise/src/Promise.php on line 28

Deprecated: React\Promise\Promise::then(): Implicitly marking parameter $onRejected as nullable is deprecated, the explicit nullable type must be used instead in /Users/aklimov/NET/WS/ipl-scheduler/vendor/react/promise/src/Promise.php on line 28
PHP Deprecated:  React\Promise\Promise::then(): Implicitly marking parameter $onProgress as nullable is deprecated, the explicit nullable type must be used instead in /Users/aklimov/NET/WS/ipl-scheduler/vendor/react/promise/src/Promise.php on line 28

Deprecated: React\Promise\Promise::then(): Implicitly marking parameter $onProgress as nullable is deprecated, the explicit nullable type must be used instead in /Users/aklimov/NET/WS/ipl-scheduler/vendor/react/promise/src/Promise.php on line 28
PHP Deprecated:  React\Promise\Promise::done(): Implicitly marking parameter $onFulfilled as nullable is deprecated, the explicit nullable type must be used instead in /Users/aklimov/NET/WS/ipl-scheduler/vendor/react/promise/src/Promise.php on line 58

Deprecated: React\Promise\Promise::done(): Implicitly marking parameter $onFulfilled as nullable is deprecated, the explicit nullable type must be used instead in /Users/aklimov/NET/WS/ipl-scheduler/vendor/react/promise/src/Promise.php on line 58
PHP Deprecated:  React\Promise\Promise::done(): Implicitly marking parameter $onRejected as nullable is deprecated, the explicit nullable type must be used instead in /Users/aklimov/NET/WS/ipl-scheduler/vendor/react/promise/src/Promise.php on line 58

Deprecated: React\Promise\Promise::done(): Implicitly marking parameter $onRejected as nullable is deprecated, the explicit nullable type must be used instead in /Users/aklimov/NET/WS/ipl-scheduler/vendor/react/promise/src/Promise.php on line 58
PHP Deprecated:  React\Promise\Promise::done(): Implicitly marking parameter $onProgress as nullable is deprecated, the explicit nullable type must be used instead in /Users/aklimov/NET/WS/ipl-scheduler/vendor/react/promise/src/Promise.php on line 58

Deprecated: React\Promise\Promise::done(): Implicitly marking parameter $onProgress as nullable is deprecated, the explicit nullable type must be used instead in /Users/aklimov/NET/WS/ipl-scheduler/vendor/react/promise/src/Promise.php on line 58
PHP Deprecated:  React\Promise\Promise::resolver(): Implicitly marking parameter $onFulfilled as nullable is deprecated, the explicit nullable type must be used instead in /Users/aklimov/NET/WS/ipl-scheduler/vendor/react/promise/src/Promise.php on line 115


Deprecated: React\Promise\Promise::resolver(): Implicitly marking parameter $onFulfilled as nullable is deprecated, the explicit nullable type must be used instead in /Users/aklimov/NET/WS/ipl-scheduler/vendor/react/promise/src/Promise.php on line 115
PHP Deprecated:  React\Promise\Promise::resolver(): Implicitly marking parameter $onRejected as nullable is deprecated, the explicit nullable type must be used instead in /Users/aklimov/NET/WS/ipl-scheduler/vendor/react/promise/src/Promise.php on line 115

Deprecated: React\Promise\Promise::resolver(): Implicitly marking parameter $onRejected as nullable is deprecated, the explicit nullable type must be used instead in /Users/aklimov/NET/WS/ipl-scheduler/vendor/react/promise/src/Promise.php on line 115
PHP Deprecated:  React\Promise\Promise::resolver(): Implicitly marking parameter $onProgress as nullable is deprecated, the explicit nullable type must be used instead in /Users/aklimov/NET/WS/ipl-scheduler/vendor/react/promise/src/Promise.php on line 115

Deprecated: React\Promise\Promise::resolver(): Implicitly marking parameter $onProgress as nullable is deprecated, the explicit nullable type must be used instead in /Users/aklimov/NET/WS/ipl-scheduler/vendor/react/promise/src/Promise.php on line 115
PHP Deprecated:  React\Promise\ExtendedPromiseInterface::done(): Implicitly marking parameter $onFulfilled as nullable is deprecated, the explicit nullable type must be used instead in /Users/aklimov/NET/WS/ipl-scheduler/vendor/react/promise/src/ExtendedPromiseInterface.php on line 22

Deprecated: React\Promise\ExtendedPromiseInterface::done(): Implicitly marking parameter $onFulfilled as nullable is deprecated, the explicit nullable type must be used instead in /Users/aklimov/NET/WS/ipl-scheduler/vendor/react/promise/src/ExtendedPromiseInterface.php on line 22
PHP Deprecated:  React\Promise\ExtendedPromiseInterface::done(): Implicitly marking parameter $onRejected as nullable is deprecated, the explicit nullable type must be used instead in /Users/aklimov/NET/WS/ipl-scheduler/vendor/react/promise/src/ExtendedPromiseInterface.php on line 22

Deprecated: React\Promise\ExtendedPromiseInterface::done(): Implicitly marking parameter $onRejected as nullable is deprecated, the explicit nullable type must be used instead in /Users/aklimov/NET/WS/ipl-scheduler/vendor/react/promise/src/ExtendedPromiseInterface.php on line 22
PHP Deprecated:  React\Promise\ExtendedPromiseInterface::done(): Implicitly marking parameter $onProgress as nullable is deprecated, the explicit nullable type must be used instead in /Users/aklimov/NET/WS/ipl-scheduler/vendor/react/promise/src/ExtendedPromiseInterface.php on line 22

Deprecated: React\Promise\ExtendedPromiseInterface::done(): Implicitly marking parameter $onProgress as nullable is deprecated, the explicit nullable type must be used instead in /Users/aklimov/NET/WS/ipl-scheduler/vendor/react/promise/src/ExtendedPromiseInterface.php on line 22
PHP Deprecated:  React\Promise\PromiseInterface::then(): Implicitly marking parameter $onFulfilled as nullable is deprecated, the explicit nullable type must be used instead in /Users/aklimov/NET/WS/ipl-scheduler/vendor/react/promise/src/PromiseInterface.php on line 40

Deprecated: React\Promise\PromiseInterface::then(): Implicitly marking parameter $onFulfilled as nullable is deprecated, the explicit nullable type must be used instead in /Users/aklimov/NET/WS/ipl-scheduler/vendor/react/promise/src/PromiseInterface.php on line 40
PHP Deprecated:  React\Promise\PromiseInterface::then(): Implicitly marking parameter $onRejected as nullable is deprecated, the explicit nullable type must be used instead in /Users/aklimov/NET/WS/ipl-scheduler/vendor/react/promise/src/PromiseInterface.php on line 40

Deprecated: React\Promise\PromiseInterface::then(): Implicitly marking parameter $onRejected as nullable is deprecated, the explicit nullable type must be used instead in /Users/aklimov/NET/WS/ipl-scheduler/vendor/react/promise/src/PromiseInterface.php on line 40
PHP Deprecated:  React\Promise\PromiseInterface::then(): Implicitly marking parameter $onProgress as nullable is deprecated, the explicit nullable type must be used instead in /Users/aklimov/NET/WS/ipl-scheduler/vendor/react/promise/src/PromiseInterface.php on line 40

Deprecated: React\Promise\PromiseInterface::then(): Implicitly marking parameter $onProgress as nullable is deprecated, the explicit nullable type must be used instead in /Users/aklimov/NET/WS/ipl-scheduler/vendor/react/promise/src/PromiseInterface.php on line 40
object(React\Promise\Promise)#5 (6) {
  ["canceller":"React\Promise\Promise":private]=>
  NULL
  ["result":"React\Promise\Promise":private]=>
  NULL
  ["handlers":"React\Promise\Promise":private]=>
  array(0) {
  }
  ["progressHandlers":"React\Promise\Promise":private]=>
  array(0) {
  }
  ["requiredCancelRequests":"React\Promise\Promise":private]=>
  int(0)
  ["cancelRequests":"React\Promise\Promise":private]=>
  int(0)
}

41d0270 / just composer require 'react/promise:^3.3'

PHP Fatal error:  Uncaught TypeError: TestTask::run(): Return value must be of type React\Promise\ExtendedPromiseInterface, React\Promise\Promise returned in /Users/aklimov/NET/WS/ipl-scheduler/test.php:16
Stack trace:
#0 /Users/aklimov/NET/WS/ipl-scheduler/test.php(20): TestTask->run()
#1 {main}
  thrown in /Users/aklimov/NET/WS/ipl-scheduler/test.php on line 16

Fatal error: Uncaught TypeError: TestTask::run(): Return value must be of type React\Promise\ExtendedPromiseInterface, React\Promise\Promise returned in /Users/aklimov/NET/WS/ipl-scheduler/test.php:16
Stack trace:
#0 /Users/aklimov/NET/WS/ipl-scheduler/test.php(20): TestTask->run()
#1 {main}
  thrown in /Users/aklimov/NET/WS/ipl-scheduler/test.php on line 16

ea71fc6 / this PR as whole

Purrs like a cat.

object(React\Promise\Promise)#5 (5) {
  ["canceller":"React\Promise\Promise":private]=>
  NULL
  ["result":"React\Promise\Promise":private]=>
  NULL
  ["handlers":"React\Promise\Promise":private]=>
  array(0) {
  }
  ["requiredCancelRequests":"React\Promise\Promise":private]=>
  int(0)
  ["cancelled":"React\Promise\Promise":private]=>
  bool(false)
}

@Al2Klimov Al2Klimov marked this pull request as draft January 21, 2026 16:34
@lippserd
Copy link
Member

Failing tests uncover that I forgot about the other breaking changes, as resolve() and reject() now require arguments. While our certificate module calls resolve() with an argument, our reporting module does not. So since we must change code anyway, we can forget about this attempt to maintain compatibility.

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

Labels

cla/signed CLA is signed by all contributors of a PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants