getFuture(), Future::complete(2)])); } public function testTwoFirstThrowing(): void { self::assertSame(2, any([Future::error(new \Exception('foo')), Future::complete(2)])); } public function testTwoBothThrowing(): void { $this->expectException(CompositeException::class); $this->expectExceptionMessage('Multiple errors encountered (2); use "Amp\CompositeException::getReasons()" to retrieve the array of exceptions thrown:'); Future\any([Future::error(new \Exception('foo')), Future::error(new \RuntimeException('bar'))]); } public function testTwoGeneratorThrows(): void { self::assertSame(2, any((static function () { yield Future::error(new \Exception('foo')); yield Future::complete(2); })())); } }