diff --git a/library/Pdfexport/HeadlessChrome.php b/library/Pdfexport/HeadlessChrome.php index e9c400f..de3458d 100644 --- a/library/Pdfexport/HeadlessChrome.php +++ b/library/Pdfexport/HeadlessChrome.php @@ -15,7 +15,7 @@ use React\EventLoop\Loop; use React\EventLoop\TimerInterface; use React\Promise; -use React\Promise\ExtendedPromiseInterface; +use React\Promise\PromiseInterface; use Throwable; use WebSocket\Client; @@ -244,9 +244,9 @@ public function fromHtml($html, $asFile = false) /** * Generate a PDF raw string asynchronously. * - * @return ExtendedPromiseInterface + * @return PromiseInterface */ - public function asyncToPdf(): ExtendedPromiseInterface + public function asyncToPdf(): PromiseInterface { $deferred = new Promise\Deferred(); Loop::futureTick(function () use ($deferred) { @@ -397,9 +397,8 @@ public function asyncToPdf(): ExtendedPromiseInterface public function toPdf() { $pdf = ''; - // We don't intend to register any then/otherwise handlers, so call done on that promise - // to properly propagate unhandled exceptions to the caller. - $this->asyncToPdf()->done(function (string $newPdf) use (&$pdf) { + + $this->asyncToPdf()->then(function (string $newPdf) use (&$pdf) { $pdf = $newPdf; }); diff --git a/library/Pdfexport/ProvidedHook/Pdfexport.php b/library/Pdfexport/ProvidedHook/Pdfexport.php index 945e072..671d222 100644 --- a/library/Pdfexport/ProvidedHook/Pdfexport.php +++ b/library/Pdfexport/ProvidedHook/Pdfexport.php @@ -14,7 +14,7 @@ use Icinga\Module\Pdfexport\HeadlessChrome; use Icinga\Module\Pdfexport\PrintableHtmlDocument; use Karriere\PdfMerge\PdfMerge; -use React\Promise\ExtendedPromiseInterface; +use React\Promise\PromiseInterface; class Pdfexport extends PdfexportHook { @@ -98,9 +98,9 @@ public function htmlToPdf($html) * * @param PrintableHtmlDocument|string $html * - * @return ExtendedPromiseInterface + * @return PromiseInterface */ - public function asyncHtmlToPdf($html): ExtendedPromiseInterface + public function asyncHtmlToPdf($html): PromiseInterface { // Keep reference to the chrome object because it is using temp files which are automatically removed when // the object is destructed @@ -109,7 +109,7 @@ public function asyncHtmlToPdf($html): ExtendedPromiseInterface $pdfPromise = $chrome->fromHtml($html, static::getForceTempStorage())->asyncToPdf(); if ($html instanceof PrintableHtmlDocument && ($coverPage = $html->getCoverPage()) !== null) { - /** @var ExtendedPromiseInterface $pdfPromise */ + /** @var PromiseInterface $pdfPromise */ $pdfPromise = $pdfPromise->then(function (string $pdf) use ($chrome, $html, $coverPage) { return $chrome->fromHtml( (new PrintableHtmlDocument())