PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / trunk
Yoast SEO – Advanced SEO with real-time guidance and built-in AI vtrunk
28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 19.0 All 129 releases
← All changes | vendor_prefixed/guzzlehttp/promises/src/TaskQueue.php +9 -6 18.5 → trunk View file →
@@ -1,6 +1,7 @@
1 1 <?php
2 2
3 +declare (strict_types=1);
3 4 namespace YoastSEO_Vendor\GuzzleHttp\Promise;
4 5
5 6 /**
6 7 * A task queue that executes tasks in a FIFO order.
@@ -9,17 +10,19 @@
9 10 * maintains a constant stack size. You can use the task queue asynchronously
10 11 * by calling the `run()` function of the global task queue in an event loop.
11 12 *
12 13 * GuzzleHttp\Promise\Utils::queue()->run();
14 + *
15 + * @final
13 16 */
14 17 class TaskQueue implements \YoastSEO_Vendor\GuzzleHttp\Promise\TaskQueueInterface
15 18 {
16 19 private $enableShutdown = \true;
17 20 private $queue = [];
18 - public function __construct($withShutdown = \true)
21 + public function __construct(bool $withShutdown = \true)
19 22 {
20 23 if ($withShutdown) {
21 - \register_shutdown_function(function () {
24 + \register_shutdown_function(function () : void {
22 25 if ($this->enableShutdown) {
23 26 // Only run the tasks if an E_ERROR didn't occur.
24 27 $err = \error_get_last();
25 28 if (!$err || $err['type'] ^ \E_ERROR) {
@@ -28,17 +31,17 @@
28 31 }
29 32 });
30 33 }
31 34 }
32 - public function isEmpty()
35 + public function isEmpty() : bool
33 36 {
34 37 return !$this->queue;
35 38 }
36 - public function add(callable $task)
39 + public function add(callable $task) : void
37 40 {
38 41 $this->queue[] = $task;
39 42 }
40 - public function run()
43 + public function run() : void
41 44 {
42 45 while ($task = \array_shift($this->queue)) {
43 46 /** @var callable $task */
44 47 $task();
@@ -54,9 +57,9 @@
54 57 * or manually using the run() method) or wait on each outstanding promise.
55 58 *
56 59 * Note: This shutdown will occur before any destructors are triggered.
57 60 */
58 - public function disableShutdown()
61 + public function disableShutdown() : void
59 62 {
60 63 $this->enableShutdown = \false;
61 64 }
62 65 }