WyriHaximus /
reactphp-child-process-messenger
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace WyriHaximus\React\ChildProcess\Messenger; |
||
| 6 | |||
| 7 | use ReflectionClass; |
||
| 8 | use WyriHaximus\React\ChildProcess\Messenger\ChildProcess\Process; |
||
| 9 | |||
| 10 | use const WyriHaximus\Constants\Boolean\FALSE_; |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 11 | |||
| 12 | final class StaticConfig |
||
| 13 | { |
||
| 14 | private const EXPECTED_INDEX = 3; |
||
| 15 | |||
| 16 | public static function shouldListFileDescriptors(): bool |
||
| 17 | { |
||
| 18 | static $should = null; |
||
| 19 | if ($should !== null) { |
||
| 20 | return $should; |
||
| 21 | } |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @psalm-suppress PossiblyNullReference |
||
| 25 | */ |
||
| 26 | $arguments = (new ReflectionClass(Process::class))->getConstructor()->getParameters(); /** @phpstan-ignore-line */ |
||
| 27 | if (! isset($arguments[self::EXPECTED_INDEX])) { /** @phpstan-ignore-line */ |
||
| 28 | return $should = FALSE_; |
||
| 29 | } |
||
| 30 | |||
| 31 | return $should = ($arguments[self::EXPECTED_INDEX]->getName() === 'fds'); |
||
| 32 | } |
||
| 33 | } |
||
| 34 |