PluginProbe
Depicter — Popup & Slider Builder / 1.9.2
Depicter — Popup & Slider Builder v1.9.2
4.8.1 trunk 1.0.0 1.1.0 1.1.2 1.1.4 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.3.5 1.3.8 1.5.0 1.5.1 1.5.2 1.5.5 1.6.0 1.6.1 1.6.2 1.7.0 All 76 releases
← All changes | modules/GuzzleHttp/Promise/TaskQueue.php +6 -10 trunk1.9.2 View file →
@@ -1,8 +1,6 @@
1 1 <?php
2 2
3 -declare(strict_types=1);
4 -
5 3 namespace Depicter\GuzzleHttp\Promise;
6 4
7 5 /**
8 6 * A task queue that executes tasks in a FIFO order.
@@ -11,10 +9,8 @@
11 9 * maintains a constant stack size. You can use the task queue asynchronously
12 10 * by calling the `run()` function of the global task queue in an event loop.
13 11 *
14 12 * Depicter\GuzzleHttp\Promise\Utils::queue()->run();
15 - *
16 - * @final
17 13 */
18 14 class TaskQueue implements TaskQueueInterface
19 15 {
20 16 private $enableShutdown = true;
@@ -19,12 +15,12 @@
19 15 {
20 16 private $enableShutdown = true;
21 17 private $queue = [];
22 18
23 - public function __construct(bool $withShutdown = true)
19 + public function __construct($withShutdown = true)
24 20 {
25 21 if ($withShutdown) {
26 - register_shutdown_function(function (): void {
22 + register_shutdown_function(function () {
27 23 if ($this->enableShutdown) {
28 24 // Only run the tasks if an E_ERROR didn't occur.
29 25 $err = error_get_last();
30 26 if (!$err || ($err['type'] ^ E_ERROR)) {
@@ -34,19 +30,19 @@
34 30 });
35 31 }
36 32 }
37 33
38 - public function isEmpty(): bool
34 + public function isEmpty()
39 35 {
40 36 return !$this->queue;
41 37 }
42 38
43 - public function add(callable $task): void
39 + public function add(callable $task)
44 40 {
45 41 $this->queue[] = $task;
46 42 }
47 43
48 - public function run(): void
44 + public function run()
49 45 {
50 46 while ($task = array_shift($this->queue)) {
51 47 /** @var callable $task */
52 48 $task();
@@ -63,9 +59,9 @@
63 59 * or manually using the run() method) or wait on each outstanding promise.
64 60 *
65 61 * Note: This shutdown will occur before any destructors are triggered.
66 62 */
67 - public function disableShutdown(): void
63 + public function disableShutdown()
68 64 {
69 65 $this->enableShutdown = false;
70 66 }
71 67 }