fix implicit null usage (#1362)
php8.4 deprecates implicit null (now checked by phan)
This commit is contained in:
		
							parent
							
								
									80e97da6eb
								
							
						
					
					
						commit
						69825d395a
					
				| 
						 | 
				
			
			@ -20,7 +20,7 @@ final class BaggageBuilder implements BaggageBuilderInterface
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
    /** @inheritDoc */
 | 
			
		||||
    public function set(string $key, $value, MetadataInterface $metadata = null): BaggageBuilderInterface
 | 
			
		||||
    public function set(string $key, $value, ?MetadataInterface $metadata = null): BaggageBuilderInterface
 | 
			
		||||
    {
 | 
			
		||||
        $metadata ??= Metadata::getEmpty();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -11,7 +11,7 @@ interface BaggageBuilderInterface
 | 
			
		|||
    /**
 | 
			
		||||
     * @see https://github.com/open-telemetry/opentelemetry-specification/blob/v1.6.1/specification/baggage/api.md#set-value
 | 
			
		||||
     */
 | 
			
		||||
    public function set(string $key, mixed $value, API\MetadataInterface $metadata = null): API\BaggageBuilderInterface;
 | 
			
		||||
    public function set(string $key, mixed $value, ?API\MetadataInterface $metadata = null): API\BaggageBuilderInterface;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @see https://github.com/open-telemetry/opentelemetry-specification/blob/v1.6.1/specification/baggage/api.md#remove-value
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -16,7 +16,7 @@ interface EventLoggerInterface
 | 
			
		|||
        mixed $body = null,
 | 
			
		||||
        ?int $timestamp = null,
 | 
			
		||||
        ?ContextInterface $context = null,
 | 
			
		||||
        Severity $severityNumber = null,
 | 
			
		||||
        ?Severity $severityNumber = null,
 | 
			
		||||
        iterable $attributes = [],
 | 
			
		||||
    ): void;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -93,7 +93,7 @@ class LogRecord
 | 
			
		|||
    /**
 | 
			
		||||
     * @param int|null $observedTimestamp Time, in nanoseconds since the unix epoch, when the event was observed by the collection system.
 | 
			
		||||
     */
 | 
			
		||||
    public function setObservedTimestamp(int $observedTimestamp = null): self
 | 
			
		||||
    public function setObservedTimestamp(?int $observedTimestamp = null): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->observedTimestamp = $observedTimestamp;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -47,7 +47,7 @@ final class NonRecordingSpan extends Span
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
    /** @inheritDoc */
 | 
			
		||||
    public function addEvent(string $name, iterable $attributes = [], int $timestamp = null): SpanInterface
 | 
			
		||||
    public function addEvent(string $name, iterable $attributes = [], ?int $timestamp = null): SpanInterface
 | 
			
		||||
    {
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -65,13 +65,13 @@ final class NonRecordingSpan extends Span
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
    /** @inheritDoc */
 | 
			
		||||
    public function setStatus(string $code, string $description = null): SpanInterface
 | 
			
		||||
    public function setStatus(string $code, ?string $description = null): SpanInterface
 | 
			
		||||
    {
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /** @inheritDoc */
 | 
			
		||||
    public function end(int $endEpochNanos = null): void
 | 
			
		||||
    public function end(?int $endEpochNanos = null): void
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -83,7 +83,7 @@ interface SpanInterface extends ImplicitContextKeyedInterface
 | 
			
		|||
    /**
 | 
			
		||||
     * @see https://github.com/open-telemetry/opentelemetry-specification/blob/v1.6.1/specification/trace/api.md#add-events
 | 
			
		||||
     */
 | 
			
		||||
    public function addEvent(string $name, iterable $attributes = [], int $timestamp = null): SpanInterface;
 | 
			
		||||
    public function addEvent(string $name, iterable $attributes = [], ?int $timestamp = null): SpanInterface;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @see https://github.com/open-telemetry/opentelemetry-specification/blob/v1.6.1/specification/trace/api.md#record-exception
 | 
			
		||||
| 
						 | 
				
			
			@ -102,10 +102,10 @@ interface SpanInterface extends ImplicitContextKeyedInterface
 | 
			
		|||
     *
 | 
			
		||||
     * @psalm-param StatusCode::STATUS_* $code
 | 
			
		||||
     */
 | 
			
		||||
    public function setStatus(string $code, string $description = null): SpanInterface;
 | 
			
		||||
    public function setStatus(string $code, ?string $description = null): SpanInterface;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @see https://github.com/open-telemetry/opentelemetry-specification/blob/v1.6.1/specification/trace/api.md#end
 | 
			
		||||
     */
 | 
			
		||||
    public function end(int $endEpochNanos = null): void;
 | 
			
		||||
    public function end(?int $endEpochNanos = null): void;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -32,14 +32,14 @@ final class MultiTextMapPropagator implements TextMapPropagatorInterface
 | 
			
		|||
        return $this->fields;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function inject(&$carrier, PropagationSetterInterface $setter = null, ContextInterface $context = null): void
 | 
			
		||||
    public function inject(&$carrier, ?PropagationSetterInterface $setter = null, ?ContextInterface $context = null): void
 | 
			
		||||
    {
 | 
			
		||||
        foreach ($this->propagators as $propagator) {
 | 
			
		||||
            $propagator->inject($carrier, $setter, $context);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function extract($carrier, PropagationGetterInterface $getter = null, ContextInterface $context = null): ContextInterface
 | 
			
		||||
    public function extract($carrier, ?PropagationGetterInterface $getter = null, ?ContextInterface $context = null): ContextInterface
 | 
			
		||||
    {
 | 
			
		||||
        $context ??= Context::getCurrent();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -25,7 +25,7 @@ class Exporter implements SpanExporterInterface
 | 
			
		|||
 | 
			
		||||
    public function __construct(
 | 
			
		||||
        private readonly TransportInterface $transport,
 | 
			
		||||
        SpanConverterInterface $spanConverter = null,
 | 
			
		||||
        ?SpanConverterInterface $spanConverter = null,
 | 
			
		||||
    ) {
 | 
			
		||||
        $this->setSpanConverter($spanConverter ?? new SpanConverter());
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -33,7 +33,7 @@ class Util
 | 
			
		|||
    /**
 | 
			
		||||
     * @psalm-suppress ArgumentTypeCoercion
 | 
			
		||||
     */
 | 
			
		||||
    public static function triggerClassDeprecationNotice(string $className, string $alternativeClassName = null): void
 | 
			
		||||
    public static function triggerClassDeprecationNotice(string $className, ?string $alternativeClassName = null): void
 | 
			
		||||
    {
 | 
			
		||||
        if (self::getErrorLevel() === self::E_NONE) {
 | 
			
		||||
            return;
 | 
			
		||||
| 
						 | 
				
			
			@ -56,8 +56,8 @@ class Util
 | 
			
		|||
     */
 | 
			
		||||
    public static function triggerMethodDeprecationNotice(
 | 
			
		||||
        string $methodName,
 | 
			
		||||
        string $alternativeMethodName = null,
 | 
			
		||||
        string $alternativeClassName = null,
 | 
			
		||||
        ?string $alternativeMethodName = null,
 | 
			
		||||
        ?string $alternativeClassName = null,
 | 
			
		||||
    ): void {
 | 
			
		||||
        if (self::getErrorLevel() === self::E_NONE) {
 | 
			
		||||
            return;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -31,7 +31,7 @@ class EventLogger implements EventLoggerInterface
 | 
			
		|||
        mixed $body = null,
 | 
			
		||||
        ?int $timestamp = null,
 | 
			
		||||
        ?ContextInterface $context = null,
 | 
			
		||||
        Severity $severityNumber = null,
 | 
			
		||||
        ?Severity $severityNumber = null,
 | 
			
		||||
        iterable $attributes = [],
 | 
			
		||||
    ): void {
 | 
			
		||||
        $logRecord = new LogRecord();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -50,12 +50,12 @@ class LoggerProvider implements LoggerProviderInterface
 | 
			
		|||
        return $logger;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function shutdown(CancellationInterface $cancellation = null): bool
 | 
			
		||||
    public function shutdown(?CancellationInterface $cancellation = null): bool
 | 
			
		||||
    {
 | 
			
		||||
        return $this->loggerSharedState->shutdown($cancellation);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function forceFlush(CancellationInterface $cancellation = null): bool
 | 
			
		||||
    public function forceFlush(?CancellationInterface $cancellation = null): bool
 | 
			
		||||
    {
 | 
			
		||||
        return $this->loggerSharedState->forceFlush($cancellation);
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -23,7 +23,6 @@ use WeakMap;
 | 
			
		|||
 | 
			
		||||
final class MeterProvider implements MeterProviderInterface
 | 
			
		||||
{
 | 
			
		||||
    private readonly MetricFactoryInterface $metricFactory;
 | 
			
		||||
    private readonly MeterInstruments $instruments;
 | 
			
		||||
    private readonly MetricRegistryInterface $registry;
 | 
			
		||||
    private readonly MetricWriterInterface $writer;
 | 
			
		||||
| 
						 | 
				
			
			@ -45,10 +44,9 @@ final class MeterProvider implements MeterProviderInterface
 | 
			
		|||
        private readonly ViewRegistryInterface $viewRegistry,
 | 
			
		||||
        private readonly ?ExemplarFilterInterface $exemplarFilter,
 | 
			
		||||
        private readonly StalenessHandlerFactoryInterface $stalenessHandlerFactory,
 | 
			
		||||
        MetricFactoryInterface $metricFactory = null,
 | 
			
		||||
        private readonly MetricFactoryInterface $metricFactory = new StreamFactory(),
 | 
			
		||||
        private ?Configurator $configurator = null,
 | 
			
		||||
    ) {
 | 
			
		||||
        $this->metricFactory = $metricFactory ?? new StreamFactory();
 | 
			
		||||
        $this->instruments = new MeterInstruments();
 | 
			
		||||
 | 
			
		||||
        $registry = new MetricRegistry($contextStorage, $attributesFactory, $clock);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -100,7 +100,7 @@ final class Span extends API\Span implements ReadWriteSpanInterface
 | 
			
		|||
     *
 | 
			
		||||
     * @codeCoverageIgnore
 | 
			
		||||
     */
 | 
			
		||||
    public static function formatStackTrace(Throwable $e, array &$seen = null): string
 | 
			
		||||
    public static function formatStackTrace(Throwable $e, ?array &$seen = null): string
 | 
			
		||||
    {
 | 
			
		||||
        BcUtil::triggerMethodDeprecationNotice(
 | 
			
		||||
            __METHOD__,
 | 
			
		||||
| 
						 | 
				
			
			@ -224,7 +224,7 @@ final class Span extends API\Span implements ReadWriteSpanInterface
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
    /** @inheritDoc */
 | 
			
		||||
    public function setStatus(string $code, string $description = null): self
 | 
			
		||||
    public function setStatus(string $code, ?string $description = null): self
 | 
			
		||||
    {
 | 
			
		||||
        if ($this->hasEnded) {
 | 
			
		||||
            return $this;
 | 
			
		||||
| 
						 | 
				
			
			@ -245,7 +245,7 @@ final class Span extends API\Span implements ReadWriteSpanInterface
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
    /** @inheritDoc */
 | 
			
		||||
    public function end(int $endEpochNanos = null): void
 | 
			
		||||
    public function end(?int $endEpochNanos = null): void
 | 
			
		||||
    {
 | 
			
		||||
        if ($this->hasEnded) {
 | 
			
		||||
            return;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -27,10 +27,10 @@ final class TracerProvider implements TracerProviderInterface
 | 
			
		|||
    /** @param list<SpanProcessorInterface>|SpanProcessorInterface|null $spanProcessors */
 | 
			
		||||
    public function __construct(
 | 
			
		||||
        SpanProcessorInterface|array|null $spanProcessors = [],
 | 
			
		||||
        SamplerInterface $sampler = null,
 | 
			
		||||
        ResourceInfo $resource = null,
 | 
			
		||||
        SpanLimits $spanLimits = null,
 | 
			
		||||
        IdGeneratorInterface $idGenerator = null,
 | 
			
		||||
        ?SamplerInterface $sampler = null,
 | 
			
		||||
        ?ResourceInfo $resource = null,
 | 
			
		||||
        ?SpanLimits $spanLimits = null,
 | 
			
		||||
        ?IdGeneratorInterface $idGenerator = null,
 | 
			
		||||
        ?InstrumentationScopeFactoryInterface $instrumentationScopeFactory = null,
 | 
			
		||||
        private ?Configurator $configurator = null,
 | 
			
		||||
    ) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue