diff --git a/src/API/Baggage/Propagation/BaggagePropagator.php b/src/API/Baggage/Propagation/BaggagePropagator.php index 964868705..788db2ae1 100644 --- a/src/API/Baggage/Propagation/BaggagePropagator.php +++ b/src/API/Baggage/Propagation/BaggagePropagator.php @@ -39,7 +39,7 @@ public function fields(): array return [self::BAGGAGE]; } - public function inject(&$carrier, PropagationSetterInterface $setter = null, ContextInterface $context = null): void + public function inject(&$carrier, ?PropagationSetterInterface $setter = null, ?ContextInterface $context = null): void { $setter ??= ArrayAccessGetterSetter::getInstance(); $context ??= Context::getCurrent(); @@ -70,7 +70,7 @@ public function inject(&$carrier, PropagationSetterInterface $setter = null, Con } } - public function extract($carrier, PropagationGetterInterface $getter = null, ContextInterface $context = null): ContextInterface + public function extract($carrier, ?PropagationGetterInterface $getter = null, ?ContextInterface $context = null): ContextInterface { $getter ??= ArrayAccessGetterSetter::getInstance(); $context ??= Context::getCurrent(); diff --git a/src/API/Trace/Propagation/TraceContextPropagator.php b/src/API/Trace/Propagation/TraceContextPropagator.php index b70a15647..e1cc7e3dc 100644 --- a/src/API/Trace/Propagation/TraceContextPropagator.php +++ b/src/API/Trace/Propagation/TraceContextPropagator.php @@ -59,7 +59,7 @@ public function fields(): array } /** {@inheritdoc} */ - public function inject(&$carrier, PropagationSetterInterface $setter = null, ContextInterface $context = null): void + public function inject(&$carrier, ?PropagationSetterInterface $setter = null, ?ContextInterface $context = null): void { $setter ??= ArrayAccessGetterSetter::getInstance(); $context ??= Context::getCurrent(); @@ -81,7 +81,7 @@ public function inject(&$carrier, PropagationSetterInterface $setter = null, Con } /** {@inheritdoc} */ - public function extract($carrier, PropagationGetterInterface $getter = null, ContextInterface $context = null): ContextInterface + public function extract($carrier, ?PropagationGetterInterface $getter = null, ?ContextInterface $context = null): ContextInterface { $getter ??= ArrayAccessGetterSetter::getInstance(); $context ??= Context::getCurrent(); diff --git a/src/Context/Propagation/NoopTextMapPropagator.php b/src/Context/Propagation/NoopTextMapPropagator.php index c408cfc79..62892b329 100644 --- a/src/Context/Propagation/NoopTextMapPropagator.php +++ b/src/Context/Propagation/NoopTextMapPropagator.php @@ -25,12 +25,12 @@ public function fields(): array return []; } - public function extract($carrier, PropagationGetterInterface $getter = null, ContextInterface $context = null): ContextInterface + public function extract($carrier, ?PropagationGetterInterface $getter = null, ?ContextInterface $context = null): ContextInterface { return $context ?? Context::getCurrent(); } - public function inject(&$carrier, PropagationSetterInterface $setter = null, ContextInterface $context = null): void + public function inject(&$carrier, ?PropagationSetterInterface $setter = null, ?ContextInterface $context = null): void { } } diff --git a/src/Context/Propagation/TextMapPropagatorInterface.php b/src/Context/Propagation/TextMapPropagatorInterface.php index b2e6582fa..1be587452 100644 --- a/src/Context/Propagation/TextMapPropagatorInterface.php +++ b/src/Context/Propagation/TextMapPropagatorInterface.php @@ -26,7 +26,7 @@ public function fields() : array; * * @see https://github.com/open-telemetry/opentelemetry-specification/blob/v1.6.1/specification/context/api-propagators.md#textmap-inject */ - public function inject(mixed &$carrier, PropagationSetterInterface $setter = null, ContextInterface $context = null): void; + public function inject(mixed &$carrier, ?PropagationSetterInterface $setter = null, ?ContextInterface $context = null): void; /** * Extracts specific values from the provided carrier into the provided {@see ContextInterface} @@ -34,5 +34,5 @@ public function inject(mixed &$carrier, PropagationSetterInterface $setter = nul * * @see https://github.com/open-telemetry/opentelemetry-specification/blob/v1.6.1/specification/context/api-propagators.md#textmap-extract */ - public function extract($carrier, PropagationGetterInterface $getter = null, ContextInterface $context = null): ContextInterface; + public function extract($carrier, ?PropagationGetterInterface $getter = null, ?ContextInterface $context = null): ContextInterface; } diff --git a/src/SDK/Common/Configuration/Configuration.php b/src/SDK/Common/Configuration/Configuration.php index 577c85708..e716f76ff 100644 --- a/src/SDK/Common/Configuration/Configuration.php +++ b/src/SDK/Common/Configuration/Configuration.php @@ -29,7 +29,7 @@ public static function has(string $name): bool return CompositeResolver::instance()->hasVariable($name); } - public static function getInt(string $key, int $default = null): int + public static function getInt(string $key, ?int $default = null): int { return (int) self::validateVariableValue( CompositeResolver::instance()->resolve( @@ -40,7 +40,7 @@ public static function getInt(string $key, int $default = null): int ); } - public static function getString(string $key, string $default = null): string + public static function getString(string $key, ?string $default = null): string { return (string) self::validateVariableValue( CompositeResolver::instance()->resolve( @@ -50,7 +50,7 @@ public static function getString(string $key, string $default = null): string ); } - public static function getBoolean(string $key, bool $default = null): bool + public static function getBoolean(string $key, ?bool $default = null): bool { $resolved = self::validateVariableValue( CompositeResolver::instance()->resolve( @@ -78,7 +78,7 @@ public static function getMixed(string $key, $default = null) ); } - public static function getMap(string $key, array $default = null): array + public static function getMap(string $key, ?array $default = null): array { return MapParser::parse( CompositeResolver::instance()->resolve( @@ -88,7 +88,7 @@ public static function getMap(string $key, array $default = null): array ); } - public static function getList(string $key, array $default = null): array + public static function getList(string $key, ?array $default = null): array { return ListParser::parse( CompositeResolver::instance()->resolve( @@ -98,7 +98,7 @@ public static function getList(string $key, array $default = null): array ); } - public static function getEnum(string $key, string $default = null): string + public static function getEnum(string $key, ?string $default = null): string { return (string) self::validateVariableValue( CompositeResolver::instance()->resolve( @@ -108,7 +108,7 @@ public static function getEnum(string $key, string $default = null): string ); } - public static function getFloat(string $key, float $default = null): float + public static function getFloat(string $key, ?float $default = null): float { return (float) self::validateVariableValue( CompositeResolver::instance()->resolve( @@ -119,7 +119,7 @@ public static function getFloat(string $key, float $default = null): float ); } - public static function getRatio(string $key, float $default = null): float + public static function getRatio(string $key, ?float $default = null): float { return RatioParser::parse( self::validateVariableValue(