summaryrefslogtreecommitdiff
path: root/vendor/open-telemetry/context/FiberBoundContextStorage.php
diff options
context:
space:
mode:
authorAndrew Dolgov <fox@fakecake.org>2024-10-01 16:00:34 +0300
committerAndrew Dolgov <fox@fakecake.org>2024-10-01 16:00:34 +0300
commit884fd92f1320d17daebb772297da03fb2cfa59b8 (patch)
tree3aa80af1df6ffa1d70f21f9fc4411f451c8b6c56 /vendor/open-telemetry/context/FiberBoundContextStorage.php
parent8fcc68baf5b0ff964a0a4a045353462586e0e316 (diff)
drop opentelemetry
Diffstat (limited to 'vendor/open-telemetry/context/FiberBoundContextStorage.php')
-rw-r--r--vendor/open-telemetry/context/FiberBoundContextStorage.php84
1 files changed, 0 insertions, 84 deletions
diff --git a/vendor/open-telemetry/context/FiberBoundContextStorage.php b/vendor/open-telemetry/context/FiberBoundContextStorage.php
deleted file mode 100644
index 667f73b3d..000000000
--- a/vendor/open-telemetry/context/FiberBoundContextStorage.php
+++ /dev/null
@@ -1,84 +0,0 @@
-<?php
-
-/** @noinspection PhpElementIsNotAvailableInCurrentPhpVersionInspection */
-
-declare(strict_types=1);
-
-namespace OpenTelemetry\Context;
-
-use function assert;
-use function class_exists;
-use const E_USER_WARNING;
-use Fiber;
-use function trigger_error;
-
-/**
- * @internal
- *
- * @phan-file-suppress PhanUndeclaredClassReference
- * @phan-file-suppress PhanUndeclaredClassMethod
- */
-final class FiberBoundContextStorage implements ContextStorageInterface, ExecutionContextAwareInterface
-{
- /** @var ContextStorageInterface&ExecutionContextAwareInterface */
- private ContextStorageInterface $storage;
-
- /**
- * @param ContextStorageInterface&ExecutionContextAwareInterface $storage
- */
- public function __construct(ContextStorageInterface $storage)
- {
- $this->storage = $storage;
- }
-
- public function fork($id): void
- {
- $this->storage->fork($id);
- }
-
- public function switch($id): void
- {
- $this->storage->switch($id);
- }
-
- public function destroy($id): void
- {
- $this->storage->destroy($id);
- }
-
- public function scope(): ?ContextStorageScopeInterface
- {
- $this->checkFiberMismatch();
-
- if (($scope = $this->storage->scope()) === null) {
- return null;
- }
-
- return new FiberBoundContextStorageScope($scope);
- }
-
- public function current(): ContextInterface
- {
- $this->checkFiberMismatch();
-
- return $this->storage->current();
- }
-
- public function attach(ContextInterface $context): ContextStorageScopeInterface
- {
- $scope = $this->storage->attach($context);
- assert(class_exists(Fiber::class, false));
- $scope[Fiber::class] = Fiber::getCurrent();
-
- return new FiberBoundContextStorageScope($scope);
- }
-
- private function checkFiberMismatch(): void
- {
- $scope = $this->storage->scope();
- assert(class_exists(Fiber::class, false));
- if ($scope && $scope[Fiber::class] !== Fiber::getCurrent()) {
- trigger_error('Fiber context switching not supported', E_USER_WARNING);
- }
- }
-}