File: Fiber.php

package info (click to toggle)
php-react-promise 3.3.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 832 kB
  • sloc: php: 3,457; makefile: 22
file content (27 lines) | stat: -rw-r--r-- 625 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php

if (!class_exists(Fiber::class)) {
    /**
     * Fiber stub to make PHPStan happy on PHP < 8.1
     *
     * @link https://www.php.net/manual/en/class.fiber.php
     * @copyright Copyright (c) 2023 Christian Lück, taken from https://github.com/clue/framework-x with permission
     */
    class Fiber
    {
        public static function suspend(mixed $value): void
        {
            // NOOP
        }

        public function __construct(callable $callback)
        {
            assert(is_callable($callback));
        }

        public function start(): int
        {
            return 42;
        }
    }
}