Skip to content

Commit

Permalink
update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
cdaguerre committed Mar 12, 2024
1 parent 62ea1c4 commit cee36ca
Show file tree
Hide file tree
Showing 49 changed files with 104 additions and 93 deletions.
6 changes: 5 additions & 1 deletion .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@

require_once 'vendor/autoload.php';

return CodingStandards\Factory::createPhpCsFixerConfig(__DIR__);
return CodingStandards\Factory::createPhpCsFixerConfig(__DIR__, [
'rules' => [
'nullable_type_declaration' => ['syntax' => 'union']
]
]);
21 changes: 14 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,19 @@
"name": "worldia/instrumentation-bundle",
"type": "symfony-bundle",
"license": "MIT",
"keywords": ["instrumentation", "tracing", "metrics", "open-telemetry", "prometheus"],
"authors": [{
"name": "Worldia developers",
"email": "[email protected]"
}],
"keywords": [
"instrumentation",
"tracing",
"metrics",
"open-telemetry",
"prometheus"
],
"authors": [
{
"name": "Worldia developers",
"email": "[email protected]"
}
],
"require": {
"monolog/monolog": "^2.0",
"nyholm/dsn": "^2.0",
Expand All @@ -20,11 +28,10 @@
"require-dev": {
"doctrine/dbal": "^3.0",
"friends-of-phpspec/phpspec-expect": "^4.0",
"open-telemetry/sdk-contrib": "^1.0@dev",
"open-telemetry/transport-grpc": "^1.0",
"open-telemetry/gen-otlp-protobuf": "^1.0",
"php-http/httplug": "^2.3",
"phpspec/phpspec": "^7.2",
"phpspec/phpspec": "^7.5",
"phpstan/phpstan": "^1.4",
"symfony/framework-bundle": "*",
"symfony/http-client": "*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

class BaggageHeaderProviderSpec extends ObjectBehavior
{
private ?ScopeInterface $scope = null;
private ScopeInterface|null $scope = null;

public function let()
{
Expand Down
2 changes: 1 addition & 1 deletion spec/Baggage/Propagation/Messenger/BaggageStampSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

class BaggageStampSpec extends ObjectBehavior
{
private ?ScopeInterface $scope = null;
private ScopeInterface|null $scope = null;

public function let()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ private function createConsoleCommandEvent(Command|null $command = null): Consol
return new ConsoleCommandEvent($command, new ArrayInput([]), new NullOutput());
}

private function createConsoleErrorEvent(Command|null $command = null): ConsoleErrorEvent
private function createConsoleErrorEvent(): ConsoleErrorEvent
{
return new ConsoleErrorEvent(new ArrayInput([]), new NullOutput(), new \Exception());
}
Expand Down
6 changes: 3 additions & 3 deletions src/Baggage/Propagation/ContextInitializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

final class ContextInitializer
{
public static function fromRequest(Request $request): ?ScopeInterface
public static function fromRequest(Request $request): ScopeInterface|null
{
if (!$baggage = $request->headers->get(BaggagePropagator::BAGGAGE)) {
return null;
Expand All @@ -26,7 +26,7 @@ public static function fromRequest(Request $request): ?ScopeInterface
return static::activateContext($baggage);
}

public static function fromMessage(Envelope $envelope): ?ScopeInterface
public static function fromMessage(Envelope $envelope): ScopeInterface|null
{
/** @var BaggageStamp|null $stamp */
$stamp = $envelope->last(BaggageStamp::class);
Expand All @@ -38,7 +38,7 @@ public static function fromMessage(Envelope $envelope): ?ScopeInterface
return static::activateContext($stamp->getBaggage());
}

public static function fromW3CHeader(string $header): ?ScopeInterface
public static function fromW3CHeader(string $header): ScopeInterface|null
{
return static::activateContext($header);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

class MessengerEventSubscriber implements EventSubscriberInterface
{
private ?ScopeInterface $scope = null;
private ScopeInterface|null $scope = null;

public static function getSubscribedEvents(): array
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

class RequestEventSubscriber implements EventSubscriberInterface
{
private ?ScopeInterface $scope = null;
private ScopeInterface|null $scope = null;

public static function getSubscribedEvents(): array
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ protected function normalizeException(\Throwable $e, int $depth = 0): array
*
* @param array<mixed> $trace The stack trace returned from Exception::getTrace()
*/
private static function getFunctionNameForReport(?array $trace = null): string
private static function getFunctionNameForReport(array|null $trace = null): string
{
if (null === $trace) {
return '<unknown function>';
Expand Down
2 changes: 1 addition & 1 deletion src/Health/Controller/Endpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static function getProvidedMetrics(): array
/**
* @param iterable<HealtcheckInterface> $checks
*/
public function __construct(private ResourceInfo $resourceInfo, private iterable $checks, private ?RegistryInterface $registry = null, private ?Profiler $profiler = null)
public function __construct(private ResourceInfo $resourceInfo, private iterable $checks, private RegistryInterface|null $registry = null, private Profiler|null $profiler = null)
{
}

Expand Down
4 changes: 2 additions & 2 deletions src/Health/HealtcheckInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ interface HealtcheckInterface

public function getName(): string;

public function getDescription(): ?string;
public function getDescription(): string|null;

/**
* Contextual information about the status.
* Should be returned when the check is failing to give additional
* information about the reason for the current status.
*/
public function getStatusMessage(): ?string;
public function getStatusMessage(): string|null;

/**
* @return string One of the HealtcheckInterface constants
Expand Down
6 changes: 3 additions & 3 deletions src/Http/TracedResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

class TracedResponse implements ResponseInterface, StreamableInterface
{
private ?string $content = null;
private string|null $content = null;
/** @var resource|null */
private $stream;

Expand Down Expand Up @@ -110,7 +110,7 @@ public function cancel(): void
}
}

public function getInfo(?string $type = null): mixed
public function getInfo(string|null $type = null): mixed
{
return $this->response->getInfo($type);
}
Expand Down Expand Up @@ -139,7 +139,7 @@ public function toStream(bool $throw = true)
*
* @internal
*/
public static function stream(HttpClientInterface $client, iterable $responses, ?float $timeout): \Generator
public static function stream(HttpClientInterface $client, iterable $responses, float|null $timeout): \Generator
{
$wrappedResponses = [];
$traceableMap = new \SplObjectStorage();
Expand Down
8 changes: 4 additions & 4 deletions src/Http/TracingHttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ final class TracingHttpClient implements HttpClientInterface
*/
public function __construct(
HttpClientInterface|array|null $client = null,
?ClientRequestOperationNameResolverInterface $operationNameResolver = null,
?ClientRequestAttributeProviderInterface $attributeProvider = null,
ClientRequestOperationNameResolverInterface|null $operationNameResolver = null,
ClientRequestAttributeProviderInterface|null $attributeProvider = null,
int $maxHostConnections = 6,
int $maxPendingPushes = 50
) {
Expand All @@ -61,7 +61,7 @@ public function __construct(
*
* @return array<string>
*/
protected function getExtraSpanAttributes(?array $attributes): array
protected function getExtraSpanAttributes(array|null $attributes): array
{
$attributes = $attributes ?: $_SERVER['OTEL_PHP_HTTP_SPAN_ATTRIBUTES'] ?? [];

Expand Down Expand Up @@ -140,7 +140,7 @@ public function request(string $method, string $url, array $options = []): Respo
return new TracedResponse($this->client->request($method, $url, $options), $span);
}

public function stream(ResponseInterface|iterable $responses, ?float $timeout = null): ResponseStreamInterface
public function stream(ResponseInterface|iterable $responses, float|null $timeout = null): ResponseStreamInterface
{
if ($responses instanceof ResponseInterface) {
$responses = [$responses];
Expand Down
2 changes: 1 addition & 1 deletion src/Logging/Formatter/JsonFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

class JsonFormatter extends BaseJsonFormatter
{
private ?int $lengthLimit = null;
private int|null $lengthLimit = null;

public function format(array $record): string
{
Expand Down
4 changes: 2 additions & 2 deletions src/Logging/Logging.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@

class Logging
{
private static ?LoggerInterface $logger = null;
private static LoggerInterface|null $logger = null;

public function __construct(?LoggerInterface $logger)
public function __construct(LoggerInterface|null $logger)
{
if (self::$logger) {
return;
Expand Down
2 changes: 1 addition & 1 deletion src/Metrics/Controller/Endpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

final class Endpoint
{
public function __construct(private CollectorRegistry $registry, private ?Profiler $profiler = null)
public function __construct(private CollectorRegistry $registry, private Profiler|null $profiler = null)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/Metrics/EventSubscriber/RequestEventSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public static function getProvidedMetrics(): array
/**
* @param array<string> $blacklist
*/
public function __construct(private RegistryInterface $registry, private array $blacklist, private ?MainSpanContextInterface $mainSpanContext = null)
public function __construct(private RegistryInterface $registry, private array $blacklist, private MainSpanContextInterface|null $mainSpanContext = null)
{
}

Expand Down
12 changes: 6 additions & 6 deletions src/Metrics/Meter.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function __construct(
*
* @see https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/api.md#counter-creation
*/
public function createCounter(string $name, ?string $unit = null, ?string $description = null, array $advisory = []): CounterInterface
public function createCounter(string $name, string|null $unit = null, string|null $description = null, array $advisory = []): CounterInterface
{
return new CounterAdapter($name, $description ?: '', $this->collectorRegistry);
}
Expand All @@ -56,7 +56,7 @@ public function createCounter(string $name, ?string $unit = null, ?string $descr
*
* @see https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/api.md#asynchronous-counter-creation
*/
public function createObservableCounter(string $name, ?string $unit = null, ?string $description = null, $advisory = [], callable ...$callbacks): ObservableCounterInterface
public function createObservableCounter(string $name, string|null $unit = null, string|null $description = null, $advisory = [], callable ...$callbacks): ObservableCounterInterface
{
throw new \LogicException(sprintf('Method %s is not implemented', __METHOD__));
}
Expand All @@ -74,7 +74,7 @@ public function createObservableCounter(string $name, ?string $unit = null, ?str
*
* @see https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/api.md#histogram-creation
*/
public function createHistogram(string $name, ?string $unit = null, ?string $description = null, array $advisory = []): HistogramInterface
public function createHistogram(string $name, string|null $unit = null, string|null $description = null, array $advisory = []): HistogramInterface
{
return new HistogramAdapter($name, $description ?: '', $this->collectorRegistry);
}
Expand All @@ -93,7 +93,7 @@ public function createHistogram(string $name, ?string $unit = null, ?string $des
*
* @see https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/api.md#asynchronous-gauge-creation
*/
public function createObservableGauge(string $name, ?string $unit = null, ?string $description = null, $advisory = [], callable ...$callbacks): ObservableGaugeInterface
public function createObservableGauge(string $name, string|null $unit = null, string|null $description = null, $advisory = [], callable ...$callbacks): ObservableGaugeInterface
{
throw new \LogicException(sprintf('Method %s is not implemented', __METHOD__));
}
Expand All @@ -110,7 +110,7 @@ public function createObservableGauge(string $name, ?string $unit = null, ?strin
*
* @see https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/api.md#updowncounter-creation
*/
public function createUpDownCounter(string $name, ?string $unit = null, ?string $description = null, array $advisory = []): UpDownCounterInterface
public function createUpDownCounter(string $name, string|null $unit = null, string|null $description = null, array $advisory = []): UpDownCounterInterface
{
return new UpDownCounterAdapter($name, $description ?: '', $this->collectorRegistry);
}
Expand All @@ -129,7 +129,7 @@ public function createUpDownCounter(string $name, ?string $unit = null, ?string
*
* @see https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/api.md#asynchronous-updowncounter-creation
*/
public function createObservableUpDownCounter(string $name, ?string $unit = null, ?string $description = null, $advisory = [], callable ...$callbacks): ObservableUpDownCounterInterface
public function createObservableUpDownCounter(string $name, string|null $unit = null, string|null $description = null, $advisory = [], callable ...$callbacks): ObservableUpDownCounterInterface
{
throw new \LogicException(sprintf('Method %s is not implemented', __METHOD__));
}
Expand Down
4 changes: 2 additions & 2 deletions src/Metrics/MetricDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function __construct(
private string $type,
private string $help,
private array $labels = [],
private ?array $buckets = null
private array|null $buckets = null
) {
}

Expand Down Expand Up @@ -59,7 +59,7 @@ public function getHelp(): string
/**
* @return array<int|float>
*/
public function getBuckets(): ?array
public function getBuckets(): array|null
{
return $this->buckets;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Metrics/Metrics.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

final class Metrics
{
private static ?RegistryInterface $registry = null;
private static RegistryInterface|null $registry = null;

public static function getRegistry(): RegistryInterface
{
Expand Down
2 changes: 1 addition & 1 deletion src/Metrics/Storage/HostnamePrefixedRedisFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

final class HostnamePrefixedRedisFactory
{
public function __construct(private ?RedisPrefixProvider $redisPrefixProvider)
public function __construct(private RedisPrefixProvider|null $redisPrefixProvider)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/Metrics/Storage/RedisPrefixProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class RedisPrefixProvider
{
protected static ?RedisPrefixProvider $instance = null;
protected static RedisPrefixProvider|null $instance = null;
protected string $prefix;

protected function __construct()
Expand Down
2 changes: 1 addition & 1 deletion src/Semantics/Attribute/ServerRequestAttributeProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ServerRequestAttributeProvider implements ServerRequestAttributeProviderIn
/**
* @param array<string> $capturedHeaders
*/
public function __construct(private ?string $serverName = null, private array $capturedHeaders = [])
public function __construct(private string|null $serverName = null, private array $capturedHeaders = [])
{
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

class CommandOperationNameResolver implements CommandOperationNameResolverInterface
{
public function getOperationName(?Command $command): string
public function getOperationName(Command|null $command): string
{
$name = 'unknown-command';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ interface CommandOperationNameResolverInterface
/**
* @return string&non-empty-string
*/
public function getOperationName(?Command $command): string;
public function getOperationName(Command|null $command): string;
}
2 changes: 1 addition & 1 deletion src/Semantics/OperationName/RoutePath/RouteCacheWarmer.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function isOptional(): bool
return true;
}

public function warmUp(string $cacheDir, ?string $buildDir = null): array
public function warmUp(string $cacheDir, string|null $buildDir = null): array
{
$routes = [];
foreach ($this->router->getRouteCollection() as $name => $route) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public function __construct(private RouteCacheWarmer $routeCacheWarmer, private
{
}

public function resolve(string $routeName): ?string
public function resolve(string $routeName): string|null
{
$routePathCacheFilename = $this->routeCacheWarmer->getCacheFile($this->cacheDir);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@

interface RoutePathResolverInterface
{
public function resolve(string $routeName): ?string;
public function resolve(string $routeName): string|null;
}
Loading

0 comments on commit cee36ca

Please sign in to comment.