From 7c9f012de42ea86c3cca5bc4d86a67b1c0f4b56b Mon Sep 17 00:00:00 2001 From: Brett McBride Date: Wed, 16 Jul 2025 15:17:44 +1000 Subject: [PATCH 01/15] fixing psalm complaints use rector (and psalm) to add Override attributes, and add symfony polyfill to provide Override in earlier php versions --- composer.json | 4 +++- .../autoload_sdk_with_custom_transport.php | 5 +++++ .../logs/features/monolog-otel-integration.php | 1 + examples/src/ExampleConfigLoader.php | 2 ++ examples/src/ExampleConfigProvider.php | 2 ++ examples/src/ExampleInstrumentation.php | 1 + rector.php | 5 +++-- src/API/Baggage/Baggage.php | 11 +++++++++++ src/API/Baggage/BaggageBuilder.php | 3 +++ src/API/Baggage/Metadata.php | 1 + .../Baggage/Propagation/BaggagePropagator.php | 3 +++ .../Internal/LogWriter/ErrorLogWriter.php | 1 + .../Internal/LogWriter/NoopLogWriter.php | 1 + .../Internal/LogWriter/Psr3LogWriter.php | 1 + .../Internal/LogWriter/StreamLogWriter.php | 1 + src/API/Common/Time/SystemClock.php | 1 + src/API/Common/Time/TestClock.php | 1 + .../Noop/NoopConfigProperties.php | 1 + .../Configuration/Noop/NoopConfigProvider.php | 1 + .../ConfigurationRegistry.php | 1 + .../ExtensionHookManager.php | 1 + .../AutoInstrumentation/NoopHookManager.php | 1 + .../ConfigEnv/EnvComponentLoaderHttpConfig.php | 2 ++ .../ConfigEnv/EnvComponentLoaderPeerConfig.php | 2 ++ .../Instrumentation/ConfigurationResolver.php | 5 +++++ src/API/Instrumentation/Configurator.php | 2 ++ src/API/Logs/LateBindingLogger.php | 2 ++ src/API/Logs/LateBindingLoggerProvider.php | 1 + src/API/Logs/NoopEventLogger.php | 1 + src/API/Logs/NoopEventLoggerProvider.php | 1 + src/API/Logs/NoopLogger.php | 3 +++ src/API/Logs/NoopLoggerProvider.php | 1 + src/API/Metrics/LateBindingMeter.php | 8 ++++++++ src/API/Metrics/LateBindingMeterProvider.php | 1 + src/API/Metrics/Noop/NoopCounter.php | 2 ++ src/API/Metrics/Noop/NoopGauge.php | 2 ++ src/API/Metrics/Noop/NoopHistogram.php | 2 ++ src/API/Metrics/Noop/NoopMeter.php | 8 ++++++++ src/API/Metrics/Noop/NoopMeterProvider.php | 1 + .../Metrics/Noop/NoopObservableCallback.php | 1 + src/API/Metrics/Noop/NoopObservableCounter.php | 2 ++ src/API/Metrics/Noop/NoopObservableGauge.php | 2 ++ .../Noop/NoopObservableUpDownCounter.php | 2 ++ src/API/Metrics/Noop/NoopUpDownCounter.php | 2 ++ src/API/Trace/LateBindingTracer.php | 2 ++ src/API/Trace/LateBindingTracerProvider.php | 1 + src/API/Trace/NonRecordingSpan.php | 10 ++++++++++ src/API/Trace/NoopSpanBuilder.php | 7 +++++++ src/API/Trace/NoopTracer.php | 2 ++ src/API/Trace/NoopTracerProvider.php | 1 + .../Propagation/TraceContextPropagator.php | 3 +++ src/API/Trace/Span.php | 6 ++++++ src/API/Trace/SpanContext.php | 12 ++++++++++++ src/API/Trace/TraceState.php | 6 ++++++ .../ComponentProvider/Detector/Composer.php | 2 ++ .../SDK/ComponentProvider/Detector/Host.php | 2 ++ .../SDK/ComponentProvider/Detector/Process.php | 2 ++ .../General/HttpConfigProvider.php | 2 ++ .../General/PeerConfigProvider.php | 2 ++ .../InstrumentationConfigurationRegistry.php | 2 ++ .../Logs/LogRecordExporterConsole.php | 2 ++ .../Logs/LogRecordExporterMemory.php | 2 ++ .../Logs/LogRecordExporterOtlpFile.php | 2 ++ .../Logs/LogRecordExporterOtlpGrpc.php | 2 ++ .../Logs/LogRecordExporterOtlpHttp.php | 2 ++ .../Logs/LogRecordProcessorBatch.php | 2 ++ .../Logs/LogRecordProcessorSimple.php | 2 ++ .../Metrics/AggregationResolverDefault.php | 2 ++ .../Metrics/MetricExporterConsole.php | 2 ++ .../Metrics/MetricExporterMemory.php | 2 ++ .../Metrics/MetricExporterOtlpFile.php | 2 ++ .../Metrics/MetricExporterOtlpGrpc.php | 2 ++ .../Metrics/MetricExporterOtlpHttp.php | 2 ++ .../Metrics/MetricReaderPeriodic.php | 2 ++ .../SDK/ComponentProvider/OpenTelemetrySdk.php | 2 ++ .../Propagator/TextMapPropagatorB3.php | 2 ++ .../Propagator/TextMapPropagatorB3Multi.php | 2 ++ .../Propagator/TextMapPropagatorBaggage.php | 2 ++ .../Propagator/TextMapPropagatorComposite.php | 2 ++ .../Propagator/TextMapPropagatorJaeger.php | 2 ++ .../TextMapPropagatorTraceContext.php | 2 ++ .../Trace/SamplerAlwaysOff.php | 2 ++ .../Trace/SamplerAlwaysOn.php | 2 ++ .../Trace/SamplerParentBased.php | 2 ++ .../Trace/SamplerTraceIdRatioBased.php | 2 ++ .../Trace/SpanExporterConsole.php | 2 ++ .../Trace/SpanExporterMemory.php | 2 ++ .../Trace/SpanExporterOtlpFile.php | 2 ++ .../Trace/SpanExporterOtlpGrpc.php | 2 ++ .../Trace/SpanExporterOtlpHttp.php | 2 ++ .../Trace/SpanExporterZipkin.php | 2 ++ .../Trace/SpanProcessorBatch.php | 2 ++ .../Trace/SpanProcessorSimple.php | 2 ++ .../Environment/ArrayEnvSource.php | 1 + .../Configuration/Environment/EnvResource.php | 1 + .../Environment/EnvResourceChecker.php | 2 ++ .../Environment/EnvSourceReader.php | 1 + .../Environment/PhpIniEnvSource.php | 1 + .../Environment/ServerEnvSource.php | 1 + .../Configuration/Internal/ComponentPlugin.php | 1 + .../Internal/ComponentProviderRegistry.php | 5 +++++ .../Internal/ComposerPackageResource.php | 2 ++ .../Internal/ConfigurationLoader.php | 2 ++ .../Internal/EnvSubstitutionNormalization.php | 1 + .../Configuration/Internal/Node/ArrayNode.php | 2 ++ .../Internal/Node/PrototypedArrayNode.php | 3 +++ .../Configuration/Internal/Node/StringNode.php | 1 + .../NodeDefinition/ArrayNodeDefinition.php | 2 ++ .../NodeDefinition/BooleanNodeDefinition.php | 1 + .../NodeDefinition/EnumNodeDefinition.php | 1 + .../NodeDefinition/FloatNodeDefinition.php | 1 + .../NodeDefinition/IntegerNodeDefinition.php | 1 + .../NodeDefinition/ScalarNodeDefinition.php | 1 + .../NodeDefinition/StringNodeDefinition.php | 1 + .../NodeDefinition/VariableNodeDefinition.php | 1 + .../Internal/ResourceCollection.php | 2 ++ .../Internal/TrackingEnvReader.php | 2 ++ .../Loader/YamlExtensionFileLoader.php | 2 ++ .../Loader/YamlSymfonyFileLoader.php | 2 ++ src/Context/Context.php | 6 ++++++ src/Context/ContextStorage.php | 7 +++++++ src/Context/ContextStorageNode.php | 6 ++++++ src/Context/ContextStorageScopeInterface.php | 1 + src/Context/DebugScope.php | 1 + src/Context/FiberBoundContextStorage.php | 4 ++++ ...iberBoundContextStorageExecutionAwareBC.php | 6 ++++++ .../Propagation/ArrayAccessGetterSetter.php | 4 ++++ .../Propagation/MultiTextMapPropagator.php | 3 +++ .../Propagation/NoopTextMapPropagator.php | 3 +++ ...anitizeCombinedHeadersPropagationGetter.php | 3 +++ src/Contrib/Grpc/GrpcTransport.php | 4 ++++ src/Contrib/Grpc/GrpcTransportFactory.php | 1 + src/Contrib/Otlp/HttpEndpointResolver.php | 2 ++ src/Contrib/Otlp/LogsExporter.php | 3 +++ src/Contrib/Otlp/LogsExporterFactory.php | 1 + src/Contrib/Otlp/MetricExporter.php | 4 ++++ src/Contrib/Otlp/MetricExporterFactory.php | 1 + src/Contrib/Otlp/OtlpHttpTransportFactory.php | 1 + src/Contrib/Otlp/ProtobufSerializer.php | 2 +- src/Contrib/Otlp/SpanExporter.php | 3 +++ src/Contrib/Otlp/SpanExporterFactory.php | 1 + src/Contrib/Otlp/StdoutLogsExporterFactory.php | 1 + .../Otlp/StdoutMetricExporterFactory.php | 1 + src/Contrib/Otlp/StdoutSpanExporterFactory.php | 1 + src/Contrib/Zipkin/Exporter.php | 3 +++ src/Contrib/Zipkin/SpanConverter.php | 1 + src/Contrib/Zipkin/SpanExporterFactory.php | 1 + .../Propagator/B3/B3MultiPropagator.php | 3 +++ src/Extension/Propagator/B3/B3Propagator.php | 3 +++ .../Propagator/B3/B3SinglePropagator.php | 3 +++ .../CloudTrace/CloudTracePropagator.php | 3 +++ .../Jaeger/JaegerBaggagePropagator.php | 3 +++ .../Propagator/Jaeger/JaegerPropagator.php | 3 +++ .../HttpDiscovery/DependencyResolver.php | 8 ++++++++ .../HttpDiscovery/HttpPlugClientResolver.php | 1 + .../HttpDiscovery/MessageFactoryResolver.php | 6 ++++++ .../HttpDiscovery/PsrClientResolver.php | 1 + .../Common/Attribute/AttributeValidator.php | 2 ++ src/SDK/Common/Attribute/Attributes.php | 7 +++++++ src/SDK/Common/Attribute/AttributesBuilder.php | 6 ++++++ src/SDK/Common/Attribute/AttributesFactory.php | 1 + .../Attribute/LogRecordAttributeValidator.php | 2 ++ .../EnvComponentLoaderRegistry.php | 1 + src/SDK/Common/Configuration/EnvResolver.php | 7 +++++++ .../Resolver/EnvironmentResolver.php | 2 ++ .../Configuration/Resolver/PhpIniResolver.php | 2 ++ src/SDK/Common/Export/Http/PsrTransport.php | 4 ++++ .../Common/Export/Http/PsrTransportFactory.php | 1 + .../Common/Export/Stream/StreamTransport.php | 4 ++++ .../Export/Stream/StreamTransportFactory.php | 1 + src/SDK/Common/Future/CompletedFuture.php | 3 +++ src/SDK/Common/Future/ErrorFuture.php | 3 +++ src/SDK/Common/Future/NullCancellation.php | 2 ++ .../Common/Http/Psr/Client/Discovery/Buzz.php | 2 ++ .../Http/Psr/Client/Discovery/CurlClient.php | 2 ++ .../Http/Psr/Client/Discovery/Guzzle.php | 2 ++ .../Http/Psr/Client/Discovery/Symfony.php | 2 ++ .../Common/Http/Psr/Message/MessageFactory.php | 3 +++ .../Instrumentation/InstrumentationScope.php | 4 ++++ .../InstrumentationScopeFactory.php | 1 + src/SDK/Logs/EventLogger.php | 1 + src/SDK/Logs/EventLoggerProvider.php | 2 ++ src/SDK/Logs/Exporter/ConsoleExporter.php | 3 +++ .../Logs/Exporter/ConsoleExporterFactory.php | 1 + src/SDK/Logs/Exporter/InMemoryExporter.php | 3 +++ .../Logs/Exporter/InMemoryExporterFactory.php | 1 + src/SDK/Logs/Exporter/NoopExporter.php | 3 +++ src/SDK/Logs/Logger.php | 2 ++ src/SDK/Logs/LoggerProvider.php | 4 ++++ src/SDK/Logs/NoopEventLoggerProvider.php | 2 ++ src/SDK/Logs/NoopLoggerProvider.php | 4 ++++ .../Logs/Processor/BatchLogRecordProcessor.php | 3 +++ .../Logs/Processor/MultiLogRecordProcessor.php | 3 +++ .../Logs/Processor/NoopLogRecordProcessor.php | 3 +++ .../Processor/SimpleLogRecordProcessor.php | 3 +++ src/SDK/Logs/SimplePsrFileLogger.php | 1 + .../ExplicitBucketHistogramAggregation.php | 5 +++++ .../Aggregation/LastValueAggregation.php | 5 +++++ src/SDK/Metrics/Aggregation/SumAggregation.php | 5 +++++ .../FilteredAttributeProcessor.php | 1 + .../IdentityAttributeProcessor.php | 1 + .../ExemplarFilter/AllExemplarFilter.php | 1 + .../ExemplarFilter/NoneExemplarFilter.php | 1 + .../WithSampledTraceExemplarFilter.php | 1 + src/SDK/Metrics/Exemplar/FilteredReservoir.php | 2 ++ .../Metrics/Exemplar/FixedSizeReservoir.php | 2 ++ .../Exemplar/HistogramBucketReservoir.php | 2 ++ src/SDK/Metrics/Exemplar/NoopReservoir.php | 2 ++ src/SDK/Metrics/Meter.php | 9 +++++++++ src/SDK/Metrics/MeterProvider.php | 4 ++++ .../MetricExporter/ConsoleMetricExporter.php | 4 ++++ .../ConsoleMetricExporterFactory.php | 1 + .../MetricExporter/InMemoryExporter.php | 4 ++++ .../MetricExporter/InMemoryExporterFactory.php | 1 + .../MetricExporter/NoopMetricExporter.php | 2 ++ .../NoopMetricExporterFactory.php | 1 + .../Metrics/MetricFactory/StreamFactory.php | 2 ++ .../MetricFactory/StreamMetricSource.php | 2 ++ .../StreamMetricSourceProvider.php | 6 ++++++ .../Metrics/MetricReader/ExportingReader.php | 6 ++++++ .../MultiRegistryRegistration.php | 1 + .../RegistryRegistration.php | 1 + .../Metrics/MetricRegistry/MetricRegistry.php | 8 ++++++++ .../Metrics/MetricRegistry/MultiObserver.php | 1 + .../Metrics/MetricRegistry/NoopObserver.php | 1 + src/SDK/Metrics/NoopMeterProvider.php | 4 ++++ src/SDK/Metrics/ObservableCallback.php | 1 + .../DelayedStalenessHandler.php | 3 +++ .../DelayedStalenessHandlerFactory.php | 1 + .../ImmediateStalenessHandler.php | 3 +++ .../ImmediateStalenessHandlerFactory.php | 1 + .../StalenessHandler/MultiReferenceCounter.php | 2 ++ .../StalenessHandler/NoopStalenessHandler.php | 3 +++ .../NoopStalenessHandlerFactory.php | 1 + .../Stream/AsynchronousMetricStream.php | 6 ++++++ src/SDK/Metrics/Stream/MetricAggregator.php | 2 ++ .../Metrics/Stream/MetricAggregatorFactory.php | 1 + .../Metrics/Stream/SynchronousMetricStream.php | 6 ++++++ src/SDK/Metrics/View/CriteriaViewRegistry.php | 1 + .../View/SelectionCriteria/AllCriteria.php | 1 + .../InstrumentNameCriteria.php | 1 + .../InstrumentTypeCriteria.php | 1 + .../InstrumentationScopeNameCriteria.php | 1 + .../InstrumentationScopeSchemaUrlCriteria.php | 1 + .../InstrumentationScopeVersionCriteria.php | 1 + .../LateBindingTextMapPropagator.php | 3 +++ src/SDK/Resource/Detectors/Composer.php | 1 + src/SDK/Resource/Detectors/Composite.php | 1 + src/SDK/Resource/Detectors/Constant.php | 1 + src/SDK/Resource/Detectors/Environment.php | 1 + src/SDK/Resource/Detectors/Host.php | 1 + src/SDK/Resource/Detectors/OperatingSystem.php | 1 + src/SDK/Resource/Detectors/Process.php | 1 + src/SDK/Resource/Detectors/ProcessRuntime.php | 1 + src/SDK/Resource/Detectors/Sdk.php | 1 + src/SDK/Resource/Detectors/SdkProvided.php | 1 + src/SDK/Resource/Detectors/Service.php | 1 + src/SDK/Trace/Event.php | 4 ++++ src/SDK/Trace/ImmutableSpan.php | 18 ++++++++++++++++++ src/SDK/Trace/Link.php | 2 ++ src/SDK/Trace/NoopTracerProvider.php | 3 +++ src/SDK/Trace/RandomIdGenerator.php | 2 ++ src/SDK/Trace/Sampler/AlwaysOffSampler.php | 2 ++ src/SDK/Trace/Sampler/AlwaysOnSampler.php | 2 ++ src/SDK/Trace/Sampler/ParentBased.php | 2 ++ .../Trace/Sampler/TraceIdRatioBasedSampler.php | 2 ++ src/SDK/Trace/Span.php | 18 ++++++++++++++++++ src/SDK/Trace/SpanBuilder.php | 7 +++++++ .../Trace/SpanExporter/ConsoleSpanExporter.php | 3 +++ .../ConsoleSpanExporterFactory.php | 1 + .../SpanExporter/FriendlySpanConverter.php | 1 + .../Trace/SpanExporter/InMemoryExporter.php | 1 + .../InMemorySpanExporterFactory.php | 1 + src/SDK/Trace/SpanExporter/LoggerDecorator.php | 2 ++ src/SDK/Trace/SpanExporter/LoggerExporter.php | 1 + .../Trace/SpanExporter/NullSpanConverter.php | 1 + .../Trace/SpanProcessor/BatchSpanProcessor.php | 4 ++++ .../Trace/SpanProcessor/MultiSpanProcessor.php | 4 ++++ .../Trace/SpanProcessor/NoopSpanProcessor.php | 4 ++++ .../SpanProcessor/SimpleSpanProcessor.php | 4 ++++ src/SDK/Trace/StatusData.php | 5 +++++ src/SDK/Trace/Tracer.php | 2 ++ src/SDK/Trace/TracerProvider.php | 4 ++++ tests/Benchmark/OtlpBench.php | 4 ++++ .../ComponentProvider/Detector/Container.php | 3 +++ .../Config/ComponentProvider/Detector/Os.php | 3 +++ ...regationResolverExplicitBucketHistogram.php | 2 ++ .../Metrics/MetricExporterPrometheus.php | 4 ++++ .../Metrics/MetricReaderPull.php | 5 +++++ .../Propagator/TextMapPropagatorOtTrace.php | 5 +++++ .../Propagator/TextMapPropagatorXray.php | 5 +++++ tests/Integration/Config/ConfigurationTest.php | 2 ++ .../InMemoryStorageManagerWithSKDAutoload.php | 1 + tests/Integration/SDK/LocalRootSpanTest.php | 1 + tests/Integration/SDK/SpanBuilderTest.php | 3 +++ .../API/Baggage/Propagation/ParserTest.php | 1 + .../Behavior/Internal/LogWriterFactoryTest.php | 1 + .../API/Behavior/LogsMessagesTraitTest.php | 1 + tests/Unit/API/Common/Time/ClockTest.php | 1 + .../ExtensionHookManagerTest.php | 3 +++ .../LateBindingProviderTest.php | 2 ++ .../ConfigurationResolverTest.php | 1 + .../Instrumentation/InstrumentationTest.php | 2 ++ .../InstrumentationTraitTest.php | 8 ++++++++ .../Instrumentation/WithSpanHandlerTest.php | 2 ++ tests/Unit/API/LoggerHolderTest.php | 1 + .../Propagation/TraceContextPropagatorTest.php | 1 + tests/Unit/API/Trace/SpanContextTest.php | 1 + tests/Unit/API/Trace/TraceStateTest.php | 1 + .../Configuration/ConfigurationFactoryTest.php | 4 ++++ .../Logs/LogRecordExporterConsole.php | 2 ++ .../ExampleSdk/Logs/LogRecordExporterOtlp.php | 2 ++ .../Logs/LogRecordProcessorBatch.php | 2 ++ .../Logs/LogRecordProcessorSimple.php | 2 ++ .../Metrics/AggregationResolverDefault.php | 2 ++ .../Metrics/AggregationResolverDrop.php | 2 ++ ...regationResolverExplicitBucketHistogram.php | 2 ++ .../Metrics/AggregationResolverLastValue.php | 2 ++ .../Metrics/AggregationResolverSum.php | 2 ++ .../Metrics/MetricExporterConsole.php | 2 ++ .../ExampleSdk/Metrics/MetricExporterOtlp.php | 2 ++ .../Metrics/MetricExporterPrometheus.php | 2 ++ .../Metrics/MetricReaderPeriodic.php | 2 ++ .../ExampleSdk/Metrics/MetricReaderPull.php | 2 ++ .../ExampleSdk/OpenTelemetryConfiguration.php | 2 ++ .../Propagator/TextMapPropagatorB3.php | 2 ++ .../Propagator/TextMapPropagatorB3Multi.php | 2 ++ .../Propagator/TextMapPropagatorBaggage.php | 2 ++ .../Propagator/TextMapPropagatorComposite.php | 2 ++ .../Propagator/TextMapPropagatorJaeger.php | 2 ++ .../Propagator/TextMapPropagatorOTTrace.php | 2 ++ .../TextMapPropagatorTraceContext.php | 2 ++ .../Propagator/TextMapPropagatorXRay.php | 2 ++ .../ExampleSdk/Trace/SamplerAlwaysOff.php | 2 ++ .../ExampleSdk/Trace/SamplerAlwaysOn.php | 2 ++ .../ExampleSdk/Trace/SamplerParentBased.php | 2 ++ .../Trace/SamplerTraceIdRatioBased.php | 2 ++ .../ExampleSdk/Trace/SpanExporterConsole.php | 2 ++ .../ExampleSdk/Trace/SpanExporterOtlp.php | 2 ++ .../ExampleSdk/Trace/SpanExporterZipkin.php | 2 ++ .../ExampleSdk/Trace/SpanProcessorBatch.php | 2 ++ .../ExampleSdk/Trace/SpanProcessorSimple.php | 2 ++ tests/Unit/Context/DebugScopeTest.php | 2 ++ .../Propagation/MultiTextMapPropagatorTest.php | 1 + ...izeCombinedHeadersPropagationGetterTest.php | 1 + tests/Unit/Contrib/Grpc/GrpcTransportTest.php | 1 + tests/Unit/Contrib/Otlp/LogsConverterTest.php | 1 + .../Contrib/Otlp/LogsExporterFactoryTest.php | 1 + tests/Unit/Contrib/Otlp/LogsExporterTest.php | 1 + .../Contrib/Otlp/MetricExporterFactoryTest.php | 1 + tests/Unit/Contrib/Otlp/MetricExporterTest.php | 1 + .../Otlp/OtlpHttpTransportFactoryTest.php | 1 + .../Contrib/Otlp/SpanExporterFactoryTest.php | 1 + tests/Unit/Contrib/Otlp/SpanExporterTest.php | 1 + .../Unit/Contrib/Zipkin/ZipkinExporterTest.php | 2 ++ .../Propagator/B3/B3MultiPropagatorTest.php | 1 + .../Propagator/B3/B3PropagatorTest.php | 1 + .../Propagator/B3/B3SinglePropagatorTest.php | 1 + .../CloudTracePropagatorOneWayTest.php | 1 + .../CloudTrace/CloudTracePropagatorTest.php | 1 + .../Jaeger/JaegerBaggagePropagatorTest.php | 1 + .../Propagator/Jaeger/JaegerPropagatorTest.php | 1 + .../MessageFactoryResolverTest.php | 1 + .../HttpDiscovery/PsrClientResolverTest.php | 1 + .../Attribute/AttributeValidatorTest.php | 1 + .../Resolver/CompositeResolverTest.php | 1 + .../Resolver/EnvironmentResolverTest.php | 1 + .../Resolver/PhpIniResolverTest.php | 1 + .../SDK/Common/Dev/Compatibility/UtilTest.php | 2 ++ .../Common/Export/Http/PsrTransportTest.php | 2 ++ .../Http/Psr/Client/Discovery/BuzzTest.php | 1 + .../Psr/Client/Discovery/CurlClientTest.php | 1 + .../Http/Psr/Client/Discovery/GuzzleTest.php | 1 + .../Http/Psr/Client/Discovery/SymfonyTest.php | 1 + .../Common/InstrumentationScope/ConfigTest.php | 1 + .../InstrumentationScope/ConfiguratorTest.php | 3 +++ .../Unit/SDK/Logs/EventLoggerProviderTest.php | 1 + tests/Unit/SDK/Logs/EventLoggerTest.php | 1 + .../SDK/Logs/Exporter/ConsoleExporterTest.php | 1 + .../SDK/Logs/Exporter/NoopExporterTest.php | 1 + tests/Unit/SDK/Logs/LoggerProviderTest.php | 1 + tests/Unit/SDK/Logs/LoggerSharedStateTest.php | 1 + tests/Unit/SDK/Logs/LoggerTest.php | 2 ++ .../Processor/BatchLogRecordProcessorTest.php | 1 + .../Processor/MultiLogRecordProcessorTest.php | 1 + .../Processor/SimpleLogRecordProcessorTest.php | 1 + tests/Unit/SDK/Logs/ReadableLogRecordTest.php | 1 + .../Unit/SDK/Logs/SimplePsrFileLoggerTest.php | 1 + .../SDK/Metrics/MeterProviderFactoryTest.php | 1 + .../MetricFactory/StreamFactoryTest.php | 1 + .../SDK/Metrics/Stream/MetricStreamTest.php | 1 + .../SDK/Propagation/PropagatorFactoryTest.php | 1 + .../SDK/Resource/Detectors/EnvironmentTest.php | 1 + tests/Unit/SDK/Resource/Detectors/HostTest.php | 1 + tests/Unit/SDK/Resource/Detectors/SdkTest.php | 1 + .../SDK/Resource/Detectors/ServiceTest.php | 1 + .../SDK/Resource/ResourceInfoFactoryTest.php | 1 + tests/Unit/SDK/Resource/ResourceInfoTest.php | 1 + tests/Unit/SDK/SdkAutoloaderTest.php | 1 + tests/Unit/SDK/SdkBuilderTest.php | 1 + tests/Unit/SDK/SdkTest.php | 2 ++ tests/Unit/SDK/Trace/AutoRootSpanTest.php | 2 ++ tests/Unit/SDK/Trace/ExporterFactoryTest.php | 1 + tests/Unit/SDK/Trace/ImmutableSpanTest.php | 1 + tests/Unit/SDK/Trace/LinkTest.php | 1 + .../Unit/SDK/Trace/Sampler/ParentBasedTest.php | 1 + tests/Unit/SDK/Trace/SpanBuilderTest.php | 1 + .../SpanExporter/AbstractExporterTestCase.php | 1 + .../SpanExporter/ConsoleSpanExporterTest.php | 3 +++ .../SpanProcessor/BatchSpanProcessorTest.php | 1 + .../SpanProcessor/SimpleSpanProcessorTest.php | 1 + tests/Unit/SDK/Trace/SpanTest.php | 1 + .../SDK/Trace/TracerProviderFactoryTest.php | 1 + tests/Unit/SDK/Trace/TracerSharedStateTest.php | 1 + tests/Unit/SDK/Trace/TracerTest.php | 1 + tests/Unit/SDK/Util/SpanData.php | 18 ++++++++++++++++++ 416 files changed, 950 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 8552a84c2..a07537ba0 100644 --- a/composer.json +++ b/composer.json @@ -20,6 +20,8 @@ "symfony/config": "^5.4 || ^6.4 || ^7.0", "symfony/polyfill-mbstring": "^1.23", "symfony/polyfill-php82": "^1.26", + "symfony/polyfill-php83": "^1.32", + "symfony/polyfill-php84": "^1.32", "tbachert/spi": "^1.0.1" }, "config": { @@ -98,7 +100,7 @@ "open-telemetry/dev-tools": "dev-main", "php-http/mock-client": "^1.5", "phpdocumentor/reflection-docblock": "^5.3", - "phpspec/prophecy": "^1.17.0", + "phpspec/prophecy": "^1.22", "phpspec/prophecy-phpunit": "^2", "phpstan/phpstan": "^1.10.13", "phpstan/phpstan-mockery": "^1.1", diff --git a/examples/autoload_sdk_with_custom_transport.php b/examples/autoload_sdk_with_custom_transport.php index 28d742caf..3f4f4162f 100644 --- a/examples/autoload_sdk_with_custom_transport.php +++ b/examples/autoload_sdk_with_custom_transport.php @@ -24,21 +24,26 @@ * @psalm-suppress MissingTemplateParam */ $factory = new class() implements \OpenTelemetry\SDK\Common\Export\TransportFactoryInterface { + #[\Override] public function create(string $endpoint, string $contentType, array $headers = [], $compression = null, float $timeout = 10., int $retryDelay = 100, int $maxRetries = 3, ?string $cacert = null, ?string $cert = null, ?string $key = null): \OpenTelemetry\SDK\Common\Export\TransportInterface { return new class() implements \OpenTelemetry\SDK\Common\Export\TransportInterface { + #[\Override] public function contentType(): string { return 'application/x-protobuf'; } + #[\Override] public function send(string $payload, ?\OpenTelemetry\SDK\Common\Future\CancellationInterface $cancellation = null): \OpenTelemetry\SDK\Common\Future\FutureInterface { return new \OpenTelemetry\SDK\Common\Future\CompletedFuture(null); } + #[\Override] public function shutdown(?\OpenTelemetry\SDK\Common\Future\CancellationInterface $cancellation = null): bool { return true; } + #[\Override] public function forceFlush(?\OpenTelemetry\SDK\Common\Future\CancellationInterface $cancellation = null): bool { return true; diff --git a/examples/logs/features/monolog-otel-integration.php b/examples/logs/features/monolog-otel-integration.php index 39b5f79ad..a62007bbd 100644 --- a/examples/logs/features/monolog-otel-integration.php +++ b/examples/logs/features/monolog-otel-integration.php @@ -50,6 +50,7 @@ public function __construct(string $level, bool $bubble = true, ?LoggerProviderI $this->logger = $provider->getLogger('monolog-demo', null, null, ['logging.library' => 'monolog']); } + #[\Override] protected function write(MonologLogRecord $record): void { $this->logger->emit($this->convert($record)); diff --git a/examples/src/ExampleConfigLoader.php b/examples/src/ExampleConfigLoader.php index 598b04daa..6aa3d6c7f 100644 --- a/examples/src/ExampleConfigLoader.php +++ b/examples/src/ExampleConfigLoader.php @@ -15,6 +15,7 @@ */ final class ExampleConfigLoader implements EnvComponentLoader { + #[\Override] public function load(EnvResolver $env, EnvComponentLoaderRegistry $registry, Context $context): InstrumentationConfiguration { return new ExampleConfig( @@ -22,6 +23,7 @@ public function load(EnvResolver $env, EnvComponentLoaderRegistry $registry, Con ); } + #[\Override] public function name(): string { return ExampleConfig::class; diff --git a/examples/src/ExampleConfigProvider.php b/examples/src/ExampleConfigProvider.php index a8970ae03..baf7a80c5 100644 --- a/examples/src/ExampleConfigProvider.php +++ b/examples/src/ExampleConfigProvider.php @@ -24,6 +24,7 @@ final class ExampleConfigProvider implements ComponentProvider * enabled: bool, * } $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): InstrumentationConfiguration { return new ExampleConfig( @@ -35,6 +36,7 @@ public function createPlugin(array $properties, Context $context): Instrumentati /** * @psalm-suppress UndefinedInterfaceMethod,PossiblyNullReference */ + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { $node = $builder->arrayNode('example_instrumentation'); diff --git a/examples/src/ExampleInstrumentation.php b/examples/src/ExampleInstrumentation.php index acff5e451..eae4e9b66 100644 --- a/examples/src/ExampleInstrumentation.php +++ b/examples/src/ExampleInstrumentation.php @@ -13,6 +13,7 @@ final class ExampleInstrumentation implements Instrumentation { + #[\Override] public function register(HookManagerInterface $hookManager, ConfigProperties $configuration, InstrumentationContext $context): void { $config = $configuration->get(ExampleConfig::class) ?? new ExampleConfig(); diff --git a/rector.php b/rector.php index c04b6d53a..2b8c7ae29 100644 --- a/rector.php +++ b/rector.php @@ -2,20 +2,20 @@ declare(strict_types=1); -use Rector\CodeQuality\Rector\Array_\CallableThisArrayToAnonymousFunctionRector; use Rector\CodeQuality\Rector\ClassMethod\LocallyCalledStaticMethodToNonStaticRector; use Rector\CodeQuality\Rector\Identical\FlipTypeControlToUseExclusiveTypeRector; use Rector\CodeQuality\Rector\If_\ExplicitBoolCompareRector; use Rector\Config\RectorConfig; use Rector\Php81\Rector\ClassMethod\NewInInitializerRector; use Rector\Php81\Rector\Property\ReadOnlyPropertyRector; +use Rector\Php83\Rector\ClassMethod\AddOverrideAttributeToOverriddenMethodsRector; use Rector\PHPUnit\Set\PHPUnitSetList; use Rector\Strict\Rector\Empty_\DisallowedEmptyRuleFixerRector; use Rector\ValueObject\PhpVersion; use Rector\Set\ValueObject\SetList; return static function (RectorConfig $rectorConfig): void { - $rectorConfig->phpVersion(PhpVersion::PHP_81); + $rectorConfig->phpVersion(PhpVersion::PHP_83); $rectorConfig->paths([ __DIR__ . '/src', @@ -27,6 +27,7 @@ SetList::CODE_QUALITY, PHPUnitSetList::PHPUNIT_100, ]); + $rectorConfig->rule(AddOverrideAttributeToOverriddenMethodsRector::class); $rectorConfig->skip([ FlipTypeControlToUseExclusiveTypeRector::class, NewInInitializerRector::class => [ diff --git a/src/API/Baggage/Baggage.php b/src/API/Baggage/Baggage.php index f39c1d004..eb98244cc 100644 --- a/src/API/Baggage/Baggage.php +++ b/src/API/Baggage/Baggage.php @@ -14,24 +14,28 @@ final class Baggage implements BaggageInterface private static ?self $emptyBaggage = null; /** @inheritDoc */ + #[\Override] public static function fromContext(ContextInterface $context): BaggageInterface { return $context->get(ContextKeys::baggage()) ?? self::getEmpty(); } /** @inheritDoc */ + #[\Override] public static function getBuilder(): BaggageBuilderInterface { return new BaggageBuilder(); } /** @inheritDoc */ + #[\Override] public static function getCurrent(): BaggageInterface { return self::fromContext(Context::getCurrent()); } /** @inheritDoc */ + #[\Override] public static function getEmpty(): BaggageInterface { if (null === self::$emptyBaggage) { @@ -47,18 +51,21 @@ public function __construct(private readonly array $entries = []) } /** @inheritDoc */ + #[\Override] public function activate(): ScopeInterface { return Context::getCurrent()->withContextValue($this)->activate(); } /** @inheritDoc */ + #[\Override] public function getEntry(string $key): ?Entry { return $this->entries[$key] ?? null; } /** @inheritDoc */ + #[\Override] public function getValue(string $key) { if (($entry = $this->getEntry($key)) !== null) { @@ -69,6 +76,7 @@ public function getValue(string $key) } /** @inheritDoc */ + #[\Override] public function getAll(): iterable { foreach ($this->entries as $key => $entry) { @@ -77,18 +85,21 @@ public function getAll(): iterable } /** @inheritDoc */ + #[\Override] public function isEmpty(): bool { return $this->entries === []; } /** @inheritDoc */ + #[\Override] public function toBuilder(): BaggageBuilderInterface { return new BaggageBuilder($this->entries); } /** @inheritDoc */ + #[\Override] public function storeInContext(ContextInterface $context): ContextInterface { return $context->with(ContextKeys::baggage(), $this); diff --git a/src/API/Baggage/BaggageBuilder.php b/src/API/Baggage/BaggageBuilder.php index fa909902f..6816af469 100644 --- a/src/API/Baggage/BaggageBuilder.php +++ b/src/API/Baggage/BaggageBuilder.php @@ -12,6 +12,7 @@ public function __construct(private array $entries = []) } /** @inheritDoc */ + #[\Override] public function remove(string $key): BaggageBuilderInterface { unset($this->entries[$key]); @@ -20,6 +21,7 @@ public function remove(string $key): BaggageBuilderInterface } /** @inheritDoc */ + #[\Override] public function set(string $key, $value, ?MetadataInterface $metadata = null): BaggageBuilderInterface { if ($key === '') { @@ -32,6 +34,7 @@ public function set(string $key, $value, ?MetadataInterface $metadata = null): B return $this; } + #[\Override] public function build(): BaggageInterface { return new Baggage($this->entries); diff --git a/src/API/Baggage/Metadata.php b/src/API/Baggage/Metadata.php index 5339a6da4..705224031 100644 --- a/src/API/Baggage/Metadata.php +++ b/src/API/Baggage/Metadata.php @@ -17,6 +17,7 @@ public function __construct(private readonly string $metadata) { } + #[\Override] public function getValue(): string { return $this->metadata; diff --git a/src/API/Baggage/Propagation/BaggagePropagator.php b/src/API/Baggage/Propagation/BaggagePropagator.php index 788db2ae1..6865991f5 100644 --- a/src/API/Baggage/Propagation/BaggagePropagator.php +++ b/src/API/Baggage/Propagation/BaggagePropagator.php @@ -34,11 +34,13 @@ public static function getInstance(): self return self::$instance; } + #[\Override] public function fields(): array { return [self::BAGGAGE]; } + #[\Override] public function inject(&$carrier, ?PropagationSetterInterface $setter = null, ?ContextInterface $context = null): void { $setter ??= ArrayAccessGetterSetter::getInstance(); @@ -70,6 +72,7 @@ public function inject(&$carrier, ?PropagationSetterInterface $setter = null, ?C } } + #[\Override] public function extract($carrier, ?PropagationGetterInterface $getter = null, ?ContextInterface $context = null): ContextInterface { $getter ??= ArrayAccessGetterSetter::getInstance(); diff --git a/src/API/Behavior/Internal/LogWriter/ErrorLogWriter.php b/src/API/Behavior/Internal/LogWriter/ErrorLogWriter.php index 1b9f785aa..59add78bb 100644 --- a/src/API/Behavior/Internal/LogWriter/ErrorLogWriter.php +++ b/src/API/Behavior/Internal/LogWriter/ErrorLogWriter.php @@ -6,6 +6,7 @@ class ErrorLogWriter implements LogWriterInterface { + #[\Override] public function write($level, string $message, array $context): void { error_log(Formatter::format($level, $message, $context)); diff --git a/src/API/Behavior/Internal/LogWriter/NoopLogWriter.php b/src/API/Behavior/Internal/LogWriter/NoopLogWriter.php index f7529c082..694519ed2 100644 --- a/src/API/Behavior/Internal/LogWriter/NoopLogWriter.php +++ b/src/API/Behavior/Internal/LogWriter/NoopLogWriter.php @@ -6,6 +6,7 @@ class NoopLogWriter implements LogWriterInterface { + #[\Override] public function write($level, string $message, array $context): void { //do nothing diff --git a/src/API/Behavior/Internal/LogWriter/Psr3LogWriter.php b/src/API/Behavior/Internal/LogWriter/Psr3LogWriter.php index 5c7c8a620..b28471517 100644 --- a/src/API/Behavior/Internal/LogWriter/Psr3LogWriter.php +++ b/src/API/Behavior/Internal/LogWriter/Psr3LogWriter.php @@ -12,6 +12,7 @@ public function __construct(private readonly LoggerInterface $logger) { } + #[\Override] public function write($level, string $message, array $context): void { $this->logger->log($level, $message, $context); diff --git a/src/API/Behavior/Internal/LogWriter/StreamLogWriter.php b/src/API/Behavior/Internal/LogWriter/StreamLogWriter.php index f65f1e856..c49bd583c 100644 --- a/src/API/Behavior/Internal/LogWriter/StreamLogWriter.php +++ b/src/API/Behavior/Internal/LogWriter/StreamLogWriter.php @@ -18,6 +18,7 @@ public function __construct(string $destination) } } + #[\Override] public function write($level, string $message, array $context): void { fwrite($this->stream, Formatter::format($level, $message, $context)); diff --git a/src/API/Common/Time/SystemClock.php b/src/API/Common/Time/SystemClock.php index aa98d5a7f..0ad3e6b6c 100644 --- a/src/API/Common/Time/SystemClock.php +++ b/src/API/Common/Time/SystemClock.php @@ -25,6 +25,7 @@ public static function create(): self } /** @inheritDoc */ + #[\Override] public function now(): int { return self::$referenceTime + hrtime(true); diff --git a/src/API/Common/Time/TestClock.php b/src/API/Common/Time/TestClock.php index 68a457bec..e38d00e2e 100644 --- a/src/API/Common/Time/TestClock.php +++ b/src/API/Common/Time/TestClock.php @@ -33,6 +33,7 @@ public function setTime(int $nanoSeconds): void $this->currentEpochNanos = $nanoSeconds; } + #[\Override] public function now(): int { return $this->currentEpochNanos; diff --git a/src/API/Configuration/Noop/NoopConfigProperties.php b/src/API/Configuration/Noop/NoopConfigProperties.php index a1bf77a29..5a4919884 100644 --- a/src/API/Configuration/Noop/NoopConfigProperties.php +++ b/src/API/Configuration/Noop/NoopConfigProperties.php @@ -8,6 +8,7 @@ class NoopConfigProperties implements ConfigProperties { + #[\Override] public function get(string $id): mixed { return null; diff --git a/src/API/Configuration/Noop/NoopConfigProvider.php b/src/API/Configuration/Noop/NoopConfigProvider.php index e81ce6f78..0558c2f54 100644 --- a/src/API/Configuration/Noop/NoopConfigProvider.php +++ b/src/API/Configuration/Noop/NoopConfigProvider.php @@ -9,6 +9,7 @@ class NoopConfigProvider implements ConfigProviderInterface { + #[\Override] public function getInstrumentationConfig(): ConfigProperties { return new NoopConfigProperties(); diff --git a/src/API/Instrumentation/AutoInstrumentation/ConfigurationRegistry.php b/src/API/Instrumentation/AutoInstrumentation/ConfigurationRegistry.php index a958e8036..415c39ae0 100644 --- a/src/API/Instrumentation/AutoInstrumentation/ConfigurationRegistry.php +++ b/src/API/Instrumentation/AutoInstrumentation/ConfigurationRegistry.php @@ -23,6 +23,7 @@ public function add(InstrumentationConfiguration $configuration): self * @param class-string $id * @return C|null */ + #[\Override] public function get(string $id): ?InstrumentationConfiguration { return $this->configurations[$id] ?? null; diff --git a/src/API/Instrumentation/AutoInstrumentation/ExtensionHookManager.php b/src/API/Instrumentation/AutoInstrumentation/ExtensionHookManager.php index 73265e827..dba6e99c7 100644 --- a/src/API/Instrumentation/AutoInstrumentation/ExtensionHookManager.php +++ b/src/API/Instrumentation/AutoInstrumentation/ExtensionHookManager.php @@ -18,6 +18,7 @@ final class ExtensionHookManager implements HookManagerInterface /** * @phan-suppress PhanUndeclaredFunction */ + #[\Override] public function hook(?string $class, string $function, ?Closure $preHook = null, ?Closure $postHook = null): void { assert(extension_loaded('opentelemetry')); diff --git a/src/API/Instrumentation/AutoInstrumentation/NoopHookManager.php b/src/API/Instrumentation/AutoInstrumentation/NoopHookManager.php index 83394e00d..bb09ea9ca 100644 --- a/src/API/Instrumentation/AutoInstrumentation/NoopHookManager.php +++ b/src/API/Instrumentation/AutoInstrumentation/NoopHookManager.php @@ -8,6 +8,7 @@ final class NoopHookManager implements HookManagerInterface { + #[\Override] public function hook(?string $class, string $function, ?Closure $preHook = null, ?Closure $postHook = null): void { // no-op diff --git a/src/API/Instrumentation/Configuration/General/ConfigEnv/EnvComponentLoaderHttpConfig.php b/src/API/Instrumentation/Configuration/General/ConfigEnv/EnvComponentLoaderHttpConfig.php index d3c3bc92a..03cfaaaa9 100644 --- a/src/API/Instrumentation/Configuration/General/ConfigEnv/EnvComponentLoaderHttpConfig.php +++ b/src/API/Instrumentation/Configuration/General/ConfigEnv/EnvComponentLoaderHttpConfig.php @@ -16,6 +16,7 @@ */ final class EnvComponentLoaderHttpConfig implements EnvComponentLoader { + #[\Override] public function load(EnvResolver $env, EnvComponentLoaderRegistry $registry, Context $context): GeneralInstrumentationConfiguration { return new HttpConfig([ @@ -30,6 +31,7 @@ public function load(EnvResolver $env, EnvComponentLoaderRegistry $registry, Con ]); } + #[\Override] public function name(): string { return HttpConfig::class; diff --git a/src/API/Instrumentation/Configuration/General/ConfigEnv/EnvComponentLoaderPeerConfig.php b/src/API/Instrumentation/Configuration/General/ConfigEnv/EnvComponentLoaderPeerConfig.php index d68122abf..6bedbfddd 100644 --- a/src/API/Instrumentation/Configuration/General/ConfigEnv/EnvComponentLoaderPeerConfig.php +++ b/src/API/Instrumentation/Configuration/General/ConfigEnv/EnvComponentLoaderPeerConfig.php @@ -16,11 +16,13 @@ */ final class EnvComponentLoaderPeerConfig implements EnvComponentLoader { + #[\Override] public function load(EnvResolver $env, EnvComponentLoaderRegistry $registry, Context $context): GeneralInstrumentationConfiguration { return new PeerConfig([]); } + #[\Override] public function name(): string { return PeerConfig::class; diff --git a/src/API/Instrumentation/ConfigurationResolver.php b/src/API/Instrumentation/ConfigurationResolver.php index bb5619c30..6ca13d8d5 100644 --- a/src/API/Instrumentation/ConfigurationResolver.php +++ b/src/API/Instrumentation/ConfigurationResolver.php @@ -6,16 +6,19 @@ class ConfigurationResolver implements ConfigurationResolverInterface { + #[\Override] public function has(string $name): bool { return $this->getVariable($name) !== null; } + #[\Override] public function getString(string $name): ?string { return $this->getVariable($name); } + #[\Override] public function getBoolean(string $name): ?bool { $value = $this->getVariable($name); @@ -26,6 +29,7 @@ public function getBoolean(string $name): ?bool return ($value === 'true'); } + #[\Override] public function getInt(string $name): ?int { $value = $this->getVariable($name); @@ -40,6 +44,7 @@ public function getInt(string $name): ?int return (int) $value; } + #[\Override] public function getList(string $name): array { $value = $this->getVariable($name); diff --git a/src/API/Instrumentation/Configurator.php b/src/API/Instrumentation/Configurator.php index 3ece0ace1..79df52850 100644 --- a/src/API/Instrumentation/Configurator.php +++ b/src/API/Instrumentation/Configurator.php @@ -59,6 +59,7 @@ public static function createNoop(): Configurator ; } + #[\Override] public function activate(): ScopeInterface { return $this->storeInContext()->activate(); @@ -67,6 +68,7 @@ public function activate(): ScopeInterface /** * @phan-suppress PhanDeprecatedFunction */ + #[\Override] public function storeInContext(?ContextInterface $context = null): ContextInterface { $context ??= Context::getCurrent(); diff --git a/src/API/Logs/LateBindingLogger.php b/src/API/Logs/LateBindingLogger.php index 624335f8d..5e27af109 100644 --- a/src/API/Logs/LateBindingLogger.php +++ b/src/API/Logs/LateBindingLogger.php @@ -17,11 +17,13 @@ public function __construct( ) { } + #[\Override] public function emit(LogRecord $logRecord): void { ($this->logger ??= ($this->factory)())->emit($logRecord); } + #[\Override] public function isEnabled(?ContextInterface $context = null, ?int $severityNumber = null, ?string $eventName = null): bool { return true; diff --git a/src/API/Logs/LateBindingLoggerProvider.php b/src/API/Logs/LateBindingLoggerProvider.php index 755325de1..2cb074c95 100644 --- a/src/API/Logs/LateBindingLoggerProvider.php +++ b/src/API/Logs/LateBindingLoggerProvider.php @@ -16,6 +16,7 @@ public function __construct( ) { } + #[\Override] public function getLogger(string $name, ?string $version = null, ?string $schemaUrl = null, iterable $attributes = []): LoggerInterface { return $this->loggerProvider?->getLogger($name, $version, $schemaUrl, $attributes) diff --git a/src/API/Logs/NoopEventLogger.php b/src/API/Logs/NoopEventLogger.php index 43e389e09..81955fe48 100644 --- a/src/API/Logs/NoopEventLogger.php +++ b/src/API/Logs/NoopEventLogger.php @@ -19,6 +19,7 @@ public static function instance(): self return $instance; } + #[\Override] public function emit(string $name, mixed $body = null, ?int $timestamp = null, ?ContextInterface $context = null, Severity|int|null $severityNumber = null, iterable $attributes = []): void { } diff --git a/src/API/Logs/NoopEventLoggerProvider.php b/src/API/Logs/NoopEventLoggerProvider.php index 605f872c0..16474d274 100644 --- a/src/API/Logs/NoopEventLoggerProvider.php +++ b/src/API/Logs/NoopEventLoggerProvider.php @@ -16,6 +16,7 @@ public static function getInstance(): self return $instance ??= new self(); } + #[\Override] public function getEventLogger( string $name, ?string $version = null, diff --git a/src/API/Logs/NoopLogger.php b/src/API/Logs/NoopLogger.php index 34776b61e..2b62d834b 100644 --- a/src/API/Logs/NoopLogger.php +++ b/src/API/Logs/NoopLogger.php @@ -21,6 +21,7 @@ public static function getInstance(): self /** * @codeCoverageIgnore */ + #[\Override] public function emit(LogRecord $logRecord): void { } @@ -28,10 +29,12 @@ public function emit(LogRecord $logRecord): void /** * @codeCoverageIgnore */ + #[\Override] public function log($level, $message, array $context = []): void { } + #[\Override] public function isEnabled(?ContextInterface $context = null, ?int $severityNumber = null, ?string $eventName = null): bool { return false; diff --git a/src/API/Logs/NoopLoggerProvider.php b/src/API/Logs/NoopLoggerProvider.php index 8b00b6637..b696f5b4e 100644 --- a/src/API/Logs/NoopLoggerProvider.php +++ b/src/API/Logs/NoopLoggerProvider.php @@ -13,6 +13,7 @@ public static function getInstance(): self return $instance ??= new self(); } + #[\Override] public function getLogger(string $name, ?string $version = null, ?string $schemaUrl = null, iterable $attributes = []): LoggerInterface { return NoopLogger::getInstance(); diff --git a/src/API/Metrics/LateBindingMeter.php b/src/API/Metrics/LateBindingMeter.php index 1b46912cd..1407c6115 100644 --- a/src/API/Metrics/LateBindingMeter.php +++ b/src/API/Metrics/LateBindingMeter.php @@ -19,41 +19,49 @@ public function __construct( ) { } + #[\Override] public function batchObserve(callable $callback, AsynchronousInstrument $instrument, AsynchronousInstrument ...$instruments): ObservableCallbackInterface { return ($this->meter ??= ($this->factory)())->batchObserve($callback, $instrument, ...$instruments); } + #[\Override] public function createCounter(string $name, ?string $unit = null, ?string $description = null, array $advisory = []): CounterInterface { return ($this->meter ??= ($this->factory)())->createCounter($name, $unit, $description, $advisory); } + #[\Override] public function createObservableCounter(string $name, ?string $unit = null, ?string $description = null, callable|array $advisory = [], callable ...$callbacks): ObservableCounterInterface { return ($this->meter ??= ($this->factory)())->createObservableCounter($name, $unit, $description, $advisory, ...$callbacks); } + #[\Override] public function createHistogram(string $name, ?string $unit = null, ?string $description = null, array $advisory = []): HistogramInterface { return ($this->meter ??= ($this->factory)())->createHistogram($name, $unit, $description, $advisory); } + #[\Override] public function createGauge(string $name, ?string $unit = null, ?string $description = null, array $advisory = []): GaugeInterface { return ($this->meter ??= ($this->factory)())->createGauge($name, $unit, $description, $advisory); } + #[\Override] public function createObservableGauge(string $name, ?string $unit = null, ?string $description = null, callable|array $advisory = [], callable ...$callbacks): ObservableGaugeInterface { return ($this->meter ??= ($this->factory)())->createObservableGauge($name, $unit, $description, $advisory, ...$callbacks); } + #[\Override] public function createUpDownCounter(string $name, ?string $unit = null, ?string $description = null, array $advisory = []): UpDownCounterInterface { return ($this->meter ??= ($this->factory)())->createUpDownCounter($name, $unit, $description, $advisory); } + #[\Override] public function createObservableUpDownCounter(string $name, ?string $unit = null, ?string $description = null, callable|array $advisory = [], callable ...$callbacks): ObservableUpDownCounterInterface { return ($this->meter ??= ($this->factory)())->createObservableUpDownCounter($name, $unit, $description, $advisory, ...$callbacks); diff --git a/src/API/Metrics/LateBindingMeterProvider.php b/src/API/Metrics/LateBindingMeterProvider.php index 39238f03f..a885ea78e 100644 --- a/src/API/Metrics/LateBindingMeterProvider.php +++ b/src/API/Metrics/LateBindingMeterProvider.php @@ -16,6 +16,7 @@ public function __construct( ) { } + #[\Override] public function getMeter(string $name, ?string $version = null, ?string $schemaUrl = null, iterable $attributes = []): MeterInterface { return $this->meterProvider?->getMeter($name, $version, $schemaUrl, $attributes) diff --git a/src/API/Metrics/Noop/NoopCounter.php b/src/API/Metrics/Noop/NoopCounter.php index f4a57f31d..156002a00 100644 --- a/src/API/Metrics/Noop/NoopCounter.php +++ b/src/API/Metrics/Noop/NoopCounter.php @@ -11,11 +11,13 @@ */ final class NoopCounter implements CounterInterface { + #[\Override] public function add($amount, iterable $attributes = [], $context = null): void { // no-op } + #[\Override] public function isEnabled(): bool { return false; diff --git a/src/API/Metrics/Noop/NoopGauge.php b/src/API/Metrics/Noop/NoopGauge.php index c1f93e4f1..16ae95ad5 100644 --- a/src/API/Metrics/Noop/NoopGauge.php +++ b/src/API/Metrics/Noop/NoopGauge.php @@ -11,11 +11,13 @@ */ final class NoopGauge implements GaugeInterface { + #[\Override] public function record(float|int $amount, iterable $attributes = [], $context = null): void { // no-op } + #[\Override] public function isEnabled(): bool { return false; diff --git a/src/API/Metrics/Noop/NoopHistogram.php b/src/API/Metrics/Noop/NoopHistogram.php index 0a0aee953..01a319270 100644 --- a/src/API/Metrics/Noop/NoopHistogram.php +++ b/src/API/Metrics/Noop/NoopHistogram.php @@ -11,11 +11,13 @@ */ final class NoopHistogram implements HistogramInterface { + #[\Override] public function record($amount, iterable $attributes = [], $context = null): void { // no-op } + #[\Override] public function isEnabled(): bool { return false; diff --git a/src/API/Metrics/Noop/NoopMeter.php b/src/API/Metrics/Noop/NoopMeter.php index 25ae9f864..2734f19a1 100644 --- a/src/API/Metrics/Noop/NoopMeter.php +++ b/src/API/Metrics/Noop/NoopMeter.php @@ -17,41 +17,49 @@ final class NoopMeter implements MeterInterface { + #[\Override] public function batchObserve(callable $callback, AsynchronousInstrument $instrument, AsynchronousInstrument ...$instruments): ObservableCallbackInterface { return new NoopObservableCallback(); } + #[\Override] public function createCounter(string $name, ?string $unit = null, ?string $description = null, array $advisory = []): CounterInterface { return new NoopCounter(); } + #[\Override] public function createObservableCounter(string $name, ?string $unit = null, ?string $description = null, $advisory = [], callable ...$callbacks): ObservableCounterInterface { return new NoopObservableCounter(); } + #[\Override] public function createHistogram(string $name, ?string $unit = null, ?string $description = null, array $advisory = []): HistogramInterface { return new NoopHistogram(); } + #[\Override] public function createGauge(string $name, ?string $unit = null, ?string $description = null, array $advisory = []): GaugeInterface { return new NoopGauge(); } + #[\Override] public function createObservableGauge(string $name, ?string $unit = null, ?string $description = null, $advisory = [], callable ...$callbacks): ObservableGaugeInterface { return new NoopObservableGauge(); } + #[\Override] public function createUpDownCounter(string $name, ?string $unit = null, ?string $description = null, array $advisory = []): UpDownCounterInterface { return new NoopUpDownCounter(); } + #[\Override] public function createObservableUpDownCounter(string $name, ?string $unit = null, ?string $description = null, $advisory = [], callable ...$callbacks): ObservableUpDownCounterInterface { return new NoopObservableUpDownCounter(); diff --git a/src/API/Metrics/Noop/NoopMeterProvider.php b/src/API/Metrics/Noop/NoopMeterProvider.php index 6ee6d6774..de0268247 100644 --- a/src/API/Metrics/Noop/NoopMeterProvider.php +++ b/src/API/Metrics/Noop/NoopMeterProvider.php @@ -9,6 +9,7 @@ final class NoopMeterProvider implements MeterProviderInterface { + #[\Override] public function getMeter( string $name, ?string $version = null, diff --git a/src/API/Metrics/Noop/NoopObservableCallback.php b/src/API/Metrics/Noop/NoopObservableCallback.php index c933bd506..16d3f30b6 100644 --- a/src/API/Metrics/Noop/NoopObservableCallback.php +++ b/src/API/Metrics/Noop/NoopObservableCallback.php @@ -11,6 +11,7 @@ */ final class NoopObservableCallback implements ObservableCallbackInterface { + #[\Override] public function detach(): void { // no-op diff --git a/src/API/Metrics/Noop/NoopObservableCounter.php b/src/API/Metrics/Noop/NoopObservableCounter.php index 8f957c9eb..67176c022 100644 --- a/src/API/Metrics/Noop/NoopObservableCounter.php +++ b/src/API/Metrics/Noop/NoopObservableCounter.php @@ -12,11 +12,13 @@ */ final class NoopObservableCounter implements ObservableCounterInterface { + #[\Override] public function observe(callable $callback, bool $weaken = false): ObservableCallbackInterface { return new NoopObservableCallback(); } + #[\Override] public function isEnabled(): bool { return false; diff --git a/src/API/Metrics/Noop/NoopObservableGauge.php b/src/API/Metrics/Noop/NoopObservableGauge.php index 3aa0403b3..42db746f1 100644 --- a/src/API/Metrics/Noop/NoopObservableGauge.php +++ b/src/API/Metrics/Noop/NoopObservableGauge.php @@ -12,11 +12,13 @@ */ final class NoopObservableGauge implements ObservableGaugeInterface { + #[\Override] public function observe(callable $callback, bool $weaken = false): ObservableCallbackInterface { return new NoopObservableCallback(); } + #[\Override] public function isEnabled(): bool { return false; diff --git a/src/API/Metrics/Noop/NoopObservableUpDownCounter.php b/src/API/Metrics/Noop/NoopObservableUpDownCounter.php index bb6ba4bb7..fd88386b9 100644 --- a/src/API/Metrics/Noop/NoopObservableUpDownCounter.php +++ b/src/API/Metrics/Noop/NoopObservableUpDownCounter.php @@ -12,11 +12,13 @@ */ final class NoopObservableUpDownCounter implements ObservableUpDownCounterInterface { + #[\Override] public function observe(callable $callback, bool $weaken = false): ObservableCallbackInterface { return new NoopObservableCallback(); } + #[\Override] public function isEnabled(): bool { return false; diff --git a/src/API/Metrics/Noop/NoopUpDownCounter.php b/src/API/Metrics/Noop/NoopUpDownCounter.php index ca299d9d4..8fdc7e9cc 100644 --- a/src/API/Metrics/Noop/NoopUpDownCounter.php +++ b/src/API/Metrics/Noop/NoopUpDownCounter.php @@ -11,11 +11,13 @@ */ final class NoopUpDownCounter implements UpDownCounterInterface { + #[\Override] public function add($amount, iterable $attributes = [], $context = null): void { // no-op } + #[\Override] public function isEnabled(): bool { return false; diff --git a/src/API/Trace/LateBindingTracer.php b/src/API/Trace/LateBindingTracer.php index 25b5244aa..14768383c 100644 --- a/src/API/Trace/LateBindingTracer.php +++ b/src/API/Trace/LateBindingTracer.php @@ -16,11 +16,13 @@ public function __construct( ) { } + #[\Override] public function spanBuilder(string $spanName): SpanBuilderInterface { return ($this->tracer ??= ($this->factory)())->spanBuilder($spanName); } + #[\Override] public function isEnabled(): bool { return true; diff --git a/src/API/Trace/LateBindingTracerProvider.php b/src/API/Trace/LateBindingTracerProvider.php index 84552f427..74a6c99b4 100644 --- a/src/API/Trace/LateBindingTracerProvider.php +++ b/src/API/Trace/LateBindingTracerProvider.php @@ -22,6 +22,7 @@ public function __construct( ) { } + #[\Override] public function getTracer(string $name, ?string $version = null, ?string $schemaUrl = null, iterable $attributes = []): TracerInterface { return $this->tracerProvider?->getTracer($name, $version, $schemaUrl, $attributes) diff --git a/src/API/Trace/NonRecordingSpan.php b/src/API/Trace/NonRecordingSpan.php index 5fd74b451..57a7d678e 100644 --- a/src/API/Trace/NonRecordingSpan.php +++ b/src/API/Trace/NonRecordingSpan.php @@ -18,59 +18,69 @@ public function __construct(private readonly SpanContextInterface $context) } /** @inheritDoc */ + #[\Override] public function getContext(): SpanContextInterface { return $this->context; } /** @inheritDoc */ + #[\Override] public function isRecording(): bool { return false; } /** @inheritDoc */ + #[\Override] public function setAttribute(string $key, $value): SpanInterface { return $this; } /** @inheritDoc */ + #[\Override] public function setAttributes(iterable $attributes): SpanInterface { return $this; } + #[\Override] public function addLink(SpanContextInterface $context, iterable $attributes = []): SpanInterface { return $this; } /** @inheritDoc */ + #[\Override] public function addEvent(string $name, iterable $attributes = [], ?int $timestamp = null): SpanInterface { return $this; } /** @inheritDoc */ + #[\Override] public function recordException(Throwable $exception, iterable $attributes = []): SpanInterface { return $this; } /** @inheritDoc */ + #[\Override] public function updateName(string $name): SpanInterface { return $this; } /** @inheritDoc */ + #[\Override] public function setStatus(string $code, ?string $description = null): SpanInterface { return $this; } /** @inheritDoc */ + #[\Override] public function end(?int $endEpochNanos = null): void { } diff --git a/src/API/Trace/NoopSpanBuilder.php b/src/API/Trace/NoopSpanBuilder.php index c7a2f295a..d7cd9dfa3 100644 --- a/src/API/Trace/NoopSpanBuilder.php +++ b/src/API/Trace/NoopSpanBuilder.php @@ -16,6 +16,7 @@ public function __construct(private readonly ContextStorageInterface $contextSto { } + #[\Override] public function setParent(ContextInterface|false|null $context): SpanBuilderInterface { $this->parentContext = $context; @@ -23,31 +24,37 @@ public function setParent(ContextInterface|false|null $context): SpanBuilderInte return $this; } + #[\Override] public function addLink(SpanContextInterface $context, iterable $attributes = []): SpanBuilderInterface { return $this; } + #[\Override] public function setAttribute(string $key, mixed $value): SpanBuilderInterface { return $this; } + #[\Override] public function setAttributes(iterable $attributes): SpanBuilderInterface { return $this; } + #[\Override] public function setStartTimestamp(int $timestampNanos): SpanBuilderInterface { return $this; } + #[\Override] public function setSpanKind(int $spanKind): SpanBuilderInterface { return $this; } + #[\Override] public function startSpan(): SpanInterface { $parentContext = Context::resolve($this->parentContext, $this->contextStorage); diff --git a/src/API/Trace/NoopTracer.php b/src/API/Trace/NoopTracer.php index 1841119b4..e157b2700 100644 --- a/src/API/Trace/NoopTracer.php +++ b/src/API/Trace/NoopTracer.php @@ -19,11 +19,13 @@ public static function getInstance(): self return self::$instance; } + #[\Override] public function spanBuilder(string $spanName): SpanBuilderInterface { return new NoopSpanBuilder(Context::storage()); } + #[\Override] public function isEnabled(): bool { return false; diff --git a/src/API/Trace/NoopTracerProvider.php b/src/API/Trace/NoopTracerProvider.php index 1ffb4be74..c3503050b 100644 --- a/src/API/Trace/NoopTracerProvider.php +++ b/src/API/Trace/NoopTracerProvider.php @@ -6,6 +6,7 @@ class NoopTracerProvider implements TracerProviderInterface { + #[\Override] public function getTracer( string $name, ?string $version = null, diff --git a/src/API/Trace/Propagation/TraceContextPropagator.php b/src/API/Trace/Propagation/TraceContextPropagator.php index e1cc7e3dc..1bb6799bb 100644 --- a/src/API/Trace/Propagation/TraceContextPropagator.php +++ b/src/API/Trace/Propagation/TraceContextPropagator.php @@ -53,12 +53,14 @@ public static function getInstance(): self } /** {@inheritdoc} */ + #[\Override] public function fields(): array { return self::FIELDS; } /** {@inheritdoc} */ + #[\Override] public function inject(&$carrier, ?PropagationSetterInterface $setter = null, ?ContextInterface $context = null): void { $setter ??= ArrayAccessGetterSetter::getInstance(); @@ -81,6 +83,7 @@ public function inject(&$carrier, ?PropagationSetterInterface $setter = null, ?C } /** {@inheritdoc} */ + #[\Override] public function extract($carrier, ?PropagationGetterInterface $getter = null, ?ContextInterface $context = null): ContextInterface { $getter ??= ArrayAccessGetterSetter::getInstance(); diff --git a/src/API/Trace/Span.php b/src/API/Trace/Span.php index 44ad4efcb..243bb474a 100644 --- a/src/API/Trace/Span.php +++ b/src/API/Trace/Span.php @@ -14,18 +14,21 @@ abstract class Span implements SpanInterface private static ?self $invalidSpan = null; /** @inheritDoc */ + #[\Override] final public static function fromContext(ContextInterface $context): SpanInterface { return $context->get(ContextKeys::span()) ?? self::getInvalid(); } /** @inheritDoc */ + #[\Override] final public static function getCurrent(): SpanInterface { return self::fromContext(Context::getCurrent()); } /** @inheritDoc */ + #[\Override] final public static function getInvalid(): SpanInterface { if (null === self::$invalidSpan) { @@ -36,6 +39,7 @@ final public static function getInvalid(): SpanInterface } /** @inheritDoc */ + #[\Override] final public static function wrap(SpanContextInterface $spanContext): SpanInterface { if (!$spanContext->isValid()) { @@ -46,12 +50,14 @@ final public static function wrap(SpanContextInterface $spanContext): SpanInterf } /** @inheritDoc */ + #[\Override] final public function activate(): ScopeInterface { return Context::getCurrent()->withContextValue($this)->activate(); } /** @inheritDoc */ + #[\Override] final public function storeInContext(ContextInterface $context): ContextInterface { if (LocalRootSpan::isLocalRoot($context)) { diff --git a/src/API/Trace/SpanContext.php b/src/API/Trace/SpanContext.php index 3e46154d7..e25e6bc39 100644 --- a/src/API/Trace/SpanContext.php +++ b/src/API/Trace/SpanContext.php @@ -35,52 +35,62 @@ private function __construct( $this->isSampled = ($traceFlags & TraceFlags::SAMPLED) === TraceFlags::SAMPLED; } + #[\Override] public function getTraceId(): string { return $this->traceId; } + #[\Override] public function getTraceIdBinary(): string { return hex2bin($this->traceId); } + #[\Override] public function getSpanId(): string { return $this->spanId; } + #[\Override] public function getSpanIdBinary(): string { return hex2bin($this->spanId); } + #[\Override] public function getTraceState(): ?TraceStateInterface { return $this->traceState; } + #[\Override] public function isSampled(): bool { return $this->isSampled; } + #[\Override] public function isValid(): bool { return $this->isValid; } + #[\Override] public function isRemote(): bool { return $this->isRemote; } + #[\Override] public function getTraceFlags(): int { return $this->traceFlags; } /** @inheritDoc */ + #[\Override] public static function createFromRemoteParent(string $traceId, string $spanId, int $traceFlags = TraceFlags::DEFAULT, ?TraceStateInterface $traceState = null): SpanContextInterface { return new self( @@ -93,6 +103,7 @@ public static function createFromRemoteParent(string $traceId, string $spanId, i } /** @inheritDoc */ + #[\Override] public static function create(string $traceId, string $spanId, int $traceFlags = TraceFlags::DEFAULT, ?TraceStateInterface $traceState = null): SpanContextInterface { return new self( @@ -105,6 +116,7 @@ public static function create(string $traceId, string $spanId, int $traceFlags = } /** @inheritDoc */ + #[\Override] public static function getInvalid(): SpanContextInterface { if (null === self::$invalidContext) { diff --git a/src/API/Trace/TraceState.php b/src/API/Trace/TraceState.php index 91eac6339..bfeb7d509 100644 --- a/src/API/Trace/TraceState.php +++ b/src/API/Trace/TraceState.php @@ -38,6 +38,7 @@ public function __construct(?string $rawTracestate = null) $this->traceState = self::parse($rawTracestate ?? ''); } + #[\Override] public function with(string $key, string $value): TraceStateInterface { if (!self::validateMember($this->traceState, $key, $value)) { @@ -52,6 +53,7 @@ public function with(string $key, string $value): TraceStateInterface return $clone; } + #[\Override] public function without(string $key): TraceStateInterface { if (!isset($this->traceState[$key])) { @@ -64,16 +66,19 @@ public function without(string $key): TraceStateInterface return $clone; } + #[\Override] public function get(string $key): ?string { return $this->traceState[$key] ?? null; } + #[\Override] public function getListMemberCount(): int { return count($this->traceState); } + #[\Override] public function toString(?int $limit = null): string { $traceState = $this->traceState; @@ -115,6 +120,7 @@ public function toString(?int $limit = null): string return $s; } + #[\Override] public function __toString(): string { return $this->toString(); diff --git a/src/Config/SDK/ComponentProvider/Detector/Composer.php b/src/Config/SDK/ComponentProvider/Detector/Composer.php index e57aa57de..b24c4ba67 100644 --- a/src/Config/SDK/ComponentProvider/Detector/Composer.php +++ b/src/Config/SDK/ComponentProvider/Detector/Composer.php @@ -20,11 +20,13 @@ final class Composer implements ComponentProvider /** * @param array{} $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): ResourceDetectorInterface { return new ComposerDetector(); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { return $builder->arrayNode('composer'); diff --git a/src/Config/SDK/ComponentProvider/Detector/Host.php b/src/Config/SDK/ComponentProvider/Detector/Host.php index 752cd317f..7a851add0 100644 --- a/src/Config/SDK/ComponentProvider/Detector/Host.php +++ b/src/Config/SDK/ComponentProvider/Detector/Host.php @@ -20,11 +20,13 @@ final class Host implements ComponentProvider /** * @param array{} $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): ResourceDetectorInterface { return new HostDetector(); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { return $builder->arrayNode('host'); diff --git a/src/Config/SDK/ComponentProvider/Detector/Process.php b/src/Config/SDK/ComponentProvider/Detector/Process.php index f7cb660b4..9ddfd00e0 100644 --- a/src/Config/SDK/ComponentProvider/Detector/Process.php +++ b/src/Config/SDK/ComponentProvider/Detector/Process.php @@ -20,11 +20,13 @@ final class Process implements ComponentProvider /** * @param array{} $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): ResourceDetectorInterface { return new ProcessDetector(); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { return $builder->arrayNode('process'); diff --git a/src/Config/SDK/ComponentProvider/Instrumentation/General/HttpConfigProvider.php b/src/Config/SDK/ComponentProvider/Instrumentation/General/HttpConfigProvider.php index 94fa8e074..f72808997 100644 --- a/src/Config/SDK/ComponentProvider/Instrumentation/General/HttpConfigProvider.php +++ b/src/Config/SDK/ComponentProvider/Instrumentation/General/HttpConfigProvider.php @@ -17,11 +17,13 @@ */ class HttpConfigProvider implements ComponentProvider { + #[\Override] public function createPlugin(array $properties, Context $context): GeneralInstrumentationConfiguration { return new HttpConfig($properties); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { $node = $builder->arrayNode('http'); diff --git a/src/Config/SDK/ComponentProvider/Instrumentation/General/PeerConfigProvider.php b/src/Config/SDK/ComponentProvider/Instrumentation/General/PeerConfigProvider.php index 8c3d64679..9bab79c3f 100644 --- a/src/Config/SDK/ComponentProvider/Instrumentation/General/PeerConfigProvider.php +++ b/src/Config/SDK/ComponentProvider/Instrumentation/General/PeerConfigProvider.php @@ -17,11 +17,13 @@ */ class PeerConfigProvider implements ComponentProvider { + #[\Override] public function createPlugin(array $properties, Context $context): GeneralInstrumentationConfiguration { return new PeerConfig($properties); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { $node = $builder->arrayNode('peer'); diff --git a/src/Config/SDK/ComponentProvider/InstrumentationConfigurationRegistry.php b/src/Config/SDK/ComponentProvider/InstrumentationConfigurationRegistry.php index 8b182964a..002c2495c 100644 --- a/src/Config/SDK/ComponentProvider/InstrumentationConfigurationRegistry.php +++ b/src/Config/SDK/ComponentProvider/InstrumentationConfigurationRegistry.php @@ -29,6 +29,7 @@ class InstrumentationConfigurationRegistry implements ComponentProvider * } * } $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): ConfigurationRegistry { $configurationRegistry = new ConfigurationRegistry(); @@ -44,6 +45,7 @@ public function createPlugin(array $properties, Context $context): Configuration return $configurationRegistry; } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { $root = $builder->arrayNode('open_telemetry'); diff --git a/src/Config/SDK/ComponentProvider/Logs/LogRecordExporterConsole.php b/src/Config/SDK/ComponentProvider/Logs/LogRecordExporterConsole.php index 4efdf1deb..2fe21fa2e 100644 --- a/src/Config/SDK/ComponentProvider/Logs/LogRecordExporterConsole.php +++ b/src/Config/SDK/ComponentProvider/Logs/LogRecordExporterConsole.php @@ -21,6 +21,7 @@ final class LogRecordExporterConsole implements ComponentProvider /** * @param array{} $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): LogRecordExporterInterface { return new ConsoleExporter(Registry::transportFactory('stream')->create( @@ -29,6 +30,7 @@ public function createPlugin(array $properties, Context $context): LogRecordExpo )); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { return $builder->arrayNode('console'); diff --git a/src/Config/SDK/ComponentProvider/Logs/LogRecordExporterMemory.php b/src/Config/SDK/ComponentProvider/Logs/LogRecordExporterMemory.php index 99a3163fb..996e532d4 100644 --- a/src/Config/SDK/ComponentProvider/Logs/LogRecordExporterMemory.php +++ b/src/Config/SDK/ComponentProvider/Logs/LogRecordExporterMemory.php @@ -20,11 +20,13 @@ final class LogRecordExporterMemory implements ComponentProvider /** * @param array{} $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): LogRecordExporterInterface { return new InMemoryExporter(); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { return $builder->arrayNode('memory/development'); diff --git a/src/Config/SDK/ComponentProvider/Logs/LogRecordExporterOtlpFile.php b/src/Config/SDK/ComponentProvider/Logs/LogRecordExporterOtlpFile.php index f88eb4ed3..68f65fa47 100644 --- a/src/Config/SDK/ComponentProvider/Logs/LogRecordExporterOtlpFile.php +++ b/src/Config/SDK/ComponentProvider/Logs/LogRecordExporterOtlpFile.php @@ -28,6 +28,7 @@ final class LogRecordExporterOtlpFile implements ComponentProvider * output_stream: string, * } $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): LogRecordExporterInterface { $endpoint = OutputStreamParser::parse($properties['output_stream']); @@ -38,6 +39,7 @@ public function createPlugin(array $properties, Context $context): LogRecordExpo )); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { $node = $builder->arrayNode('otlp_file/development'); diff --git a/src/Config/SDK/ComponentProvider/Logs/LogRecordExporterOtlpGrpc.php b/src/Config/SDK/ComponentProvider/Logs/LogRecordExporterOtlpGrpc.php index 63dfaa7a0..eae97b2cf 100644 --- a/src/Config/SDK/ComponentProvider/Logs/LogRecordExporterOtlpGrpc.php +++ b/src/Config/SDK/ComponentProvider/Logs/LogRecordExporterOtlpGrpc.php @@ -40,6 +40,7 @@ final class LogRecordExporterOtlpGrpc implements ComponentProvider * insecure: ?bool, * } $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): LogRecordExporterInterface { $protocol = Protocols::GRPC; @@ -57,6 +58,7 @@ public function createPlugin(array $properties, Context $context): LogRecordExpo )); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { $node = $builder->arrayNode('otlp_grpc'); diff --git a/src/Config/SDK/ComponentProvider/Logs/LogRecordExporterOtlpHttp.php b/src/Config/SDK/ComponentProvider/Logs/LogRecordExporterOtlpHttp.php index 863aab3ad..87e2c75f4 100644 --- a/src/Config/SDK/ComponentProvider/Logs/LogRecordExporterOtlpHttp.php +++ b/src/Config/SDK/ComponentProvider/Logs/LogRecordExporterOtlpHttp.php @@ -37,6 +37,7 @@ final class LogRecordExporterOtlpHttp implements ComponentProvider * encoding: 'protobuf'|'json', * } $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): LogRecordExporterInterface { $headers = array_column($properties['headers'], 'value', 'name') + MapParser::parse($properties['headers_list']); @@ -56,6 +57,7 @@ public function createPlugin(array $properties, Context $context): LogRecordExpo )); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { $node = $builder->arrayNode('otlp_http'); diff --git a/src/Config/SDK/ComponentProvider/Logs/LogRecordProcessorBatch.php b/src/Config/SDK/ComponentProvider/Logs/LogRecordProcessorBatch.php index 9c13e0aef..e422ba14b 100644 --- a/src/Config/SDK/ComponentProvider/Logs/LogRecordProcessorBatch.php +++ b/src/Config/SDK/ComponentProvider/Logs/LogRecordProcessorBatch.php @@ -29,6 +29,7 @@ final class LogRecordProcessorBatch implements ComponentProvider * exporter: ComponentPlugin, * } $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): LogRecordProcessorInterface { return new BatchLogRecordProcessor( @@ -42,6 +43,7 @@ public function createPlugin(array $properties, Context $context): LogRecordProc ); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { $node = $builder->arrayNode('batch'); diff --git a/src/Config/SDK/ComponentProvider/Logs/LogRecordProcessorSimple.php b/src/Config/SDK/ComponentProvider/Logs/LogRecordProcessorSimple.php index b9c0c81a3..c3c14367a 100644 --- a/src/Config/SDK/ComponentProvider/Logs/LogRecordProcessorSimple.php +++ b/src/Config/SDK/ComponentProvider/Logs/LogRecordProcessorSimple.php @@ -24,6 +24,7 @@ final class LogRecordProcessorSimple implements ComponentProvider * exporter: ComponentPlugin, * } $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): LogRecordProcessorInterface { return new SimpleLogRecordProcessor( @@ -31,6 +32,7 @@ public function createPlugin(array $properties, Context $context): LogRecordProc ); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { $node = $builder->arrayNode('simple'); diff --git a/src/Config/SDK/ComponentProvider/Metrics/AggregationResolverDefault.php b/src/Config/SDK/ComponentProvider/Metrics/AggregationResolverDefault.php index 78e92c12e..92eb9b82e 100644 --- a/src/Config/SDK/ComponentProvider/Metrics/AggregationResolverDefault.php +++ b/src/Config/SDK/ComponentProvider/Metrics/AggregationResolverDefault.php @@ -20,6 +20,7 @@ final class AggregationResolverDefault implements ComponentProvider /** * @param array{} $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): DefaultAggregationProviderInterface { // TODO Implement proper aggregation providers (default, drop, explicit_bucket_histogram, last_value, sum) to handle advisory @@ -28,6 +29,7 @@ public function createPlugin(array $properties, Context $context): DefaultAggreg }; } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { return $builder->arrayNode('default'); diff --git a/src/Config/SDK/ComponentProvider/Metrics/MetricExporterConsole.php b/src/Config/SDK/ComponentProvider/Metrics/MetricExporterConsole.php index df09b7ad4..1d3dc5073 100644 --- a/src/Config/SDK/ComponentProvider/Metrics/MetricExporterConsole.php +++ b/src/Config/SDK/ComponentProvider/Metrics/MetricExporterConsole.php @@ -20,11 +20,13 @@ final class MetricExporterConsole implements ComponentProvider /** * @param array{} $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): MetricExporterInterface { return new ConsoleMetricExporter(); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { return $builder->arrayNode('console'); diff --git a/src/Config/SDK/ComponentProvider/Metrics/MetricExporterMemory.php b/src/Config/SDK/ComponentProvider/Metrics/MetricExporterMemory.php index f4a72096d..77e249815 100644 --- a/src/Config/SDK/ComponentProvider/Metrics/MetricExporterMemory.php +++ b/src/Config/SDK/ComponentProvider/Metrics/MetricExporterMemory.php @@ -20,11 +20,13 @@ final class MetricExporterMemory implements ComponentProvider /** * @param array{} $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): MetricExporterInterface { return new InMemoryExporter(); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { return $builder->arrayNode('memory/development'); diff --git a/src/Config/SDK/ComponentProvider/Metrics/MetricExporterOtlpFile.php b/src/Config/SDK/ComponentProvider/Metrics/MetricExporterOtlpFile.php index 7e49857ce..da1a337cf 100644 --- a/src/Config/SDK/ComponentProvider/Metrics/MetricExporterOtlpFile.php +++ b/src/Config/SDK/ComponentProvider/Metrics/MetricExporterOtlpFile.php @@ -31,6 +31,7 @@ final class MetricExporterOtlpFile implements ComponentProvider * default_histogram_aggregation: 'explicit_bucket_histogram|base2_exponential_bucket_histogram', * } $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): MetricExporterInterface { $endpoint = OutputStreamParser::parse($properties['output_stream']); @@ -47,6 +48,7 @@ public function createPlugin(array $properties, Context $context): MetricExporte ), $temporality); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { $node = $builder->arrayNode('otlp_file/development'); diff --git a/src/Config/SDK/ComponentProvider/Metrics/MetricExporterOtlpGrpc.php b/src/Config/SDK/ComponentProvider/Metrics/MetricExporterOtlpGrpc.php index 96fd8d8e1..081df2a9f 100644 --- a/src/Config/SDK/ComponentProvider/Metrics/MetricExporterOtlpGrpc.php +++ b/src/Config/SDK/ComponentProvider/Metrics/MetricExporterOtlpGrpc.php @@ -43,6 +43,7 @@ final class MetricExporterOtlpGrpc implements ComponentProvider * default_histogram_aggregation: 'explicit_bucket_histogram|base2_exponential_bucket_histogram', * } $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): MetricExporterInterface { $protocol = Protocols::GRPC; @@ -67,6 +68,7 @@ public function createPlugin(array $properties, Context $context): MetricExporte ), $temporality); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { $node = $builder->arrayNode('otlp_grpc'); diff --git a/src/Config/SDK/ComponentProvider/Metrics/MetricExporterOtlpHttp.php b/src/Config/SDK/ComponentProvider/Metrics/MetricExporterOtlpHttp.php index 7b12293f4..c977c21bc 100644 --- a/src/Config/SDK/ComponentProvider/Metrics/MetricExporterOtlpHttp.php +++ b/src/Config/SDK/ComponentProvider/Metrics/MetricExporterOtlpHttp.php @@ -40,6 +40,7 @@ final class MetricExporterOtlpHttp implements ComponentProvider * default_histogram_aggregation: 'explicit_bucket_histogram|base2_exponential_bucket_histogram', * } $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): MetricExporterInterface { $headers = array_column($properties['headers'], 'value', 'name') + MapParser::parse($properties['headers_list']); @@ -65,6 +66,7 @@ public function createPlugin(array $properties, Context $context): MetricExporte ), $temporality); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { $node = $builder->arrayNode('otlp_http'); diff --git a/src/Config/SDK/ComponentProvider/Metrics/MetricReaderPeriodic.php b/src/Config/SDK/ComponentProvider/Metrics/MetricReaderPeriodic.php index a1e0f1c5a..1f2d1486e 100644 --- a/src/Config/SDK/ComponentProvider/Metrics/MetricReaderPeriodic.php +++ b/src/Config/SDK/ComponentProvider/Metrics/MetricReaderPeriodic.php @@ -37,6 +37,7 @@ final class MetricReaderPeriodic implements ComponentProvider * }, * } $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): MetricReaderInterface { return new ExportingReader( @@ -44,6 +45,7 @@ public function createPlugin(array $properties, Context $context): MetricReaderI ); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { $node = $builder->arrayNode('periodic'); diff --git a/src/Config/SDK/ComponentProvider/OpenTelemetrySdk.php b/src/Config/SDK/ComponentProvider/OpenTelemetrySdk.php index 87af5ce17..e4ad37352 100644 --- a/src/Config/SDK/ComponentProvider/OpenTelemetrySdk.php +++ b/src/Config/SDK/ComponentProvider/OpenTelemetrySdk.php @@ -165,6 +165,7 @@ final class OpenTelemetrySdk implements ComponentProvider * }, * } $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): SdkBuilder { $sdkBuilder = new SdkBuilder(); @@ -381,6 +382,7 @@ public function createPlugin(array $properties, Context $context): SdkBuilder return $sdkBuilder; } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { $node = $builder->arrayNode('open_telemetry'); diff --git a/src/Config/SDK/ComponentProvider/Propagator/TextMapPropagatorB3.php b/src/Config/SDK/ComponentProvider/Propagator/TextMapPropagatorB3.php index 8046ea5ab..010464fa4 100644 --- a/src/Config/SDK/ComponentProvider/Propagator/TextMapPropagatorB3.php +++ b/src/Config/SDK/ComponentProvider/Propagator/TextMapPropagatorB3.php @@ -22,11 +22,13 @@ final class TextMapPropagatorB3 implements ComponentProvider /** * @param array{} $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): TextMapPropagatorInterface { return B3Propagator::getB3SingleHeaderInstance(); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { return $builder->arrayNode('b3'); diff --git a/src/Config/SDK/ComponentProvider/Propagator/TextMapPropagatorB3Multi.php b/src/Config/SDK/ComponentProvider/Propagator/TextMapPropagatorB3Multi.php index 1aaf38bf2..b50086da6 100644 --- a/src/Config/SDK/ComponentProvider/Propagator/TextMapPropagatorB3Multi.php +++ b/src/Config/SDK/ComponentProvider/Propagator/TextMapPropagatorB3Multi.php @@ -22,11 +22,13 @@ final class TextMapPropagatorB3Multi implements ComponentProvider /** * @param array{} $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): TextMapPropagatorInterface { return B3Propagator::getB3MultiHeaderInstance(); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { return $builder->arrayNode('b3multi'); diff --git a/src/Config/SDK/ComponentProvider/Propagator/TextMapPropagatorBaggage.php b/src/Config/SDK/ComponentProvider/Propagator/TextMapPropagatorBaggage.php index 874d4dd2f..c7f8b9c77 100644 --- a/src/Config/SDK/ComponentProvider/Propagator/TextMapPropagatorBaggage.php +++ b/src/Config/SDK/ComponentProvider/Propagator/TextMapPropagatorBaggage.php @@ -20,11 +20,13 @@ final class TextMapPropagatorBaggage implements ComponentProvider /** * @param array{} $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): TextMapPropagatorInterface { return BaggagePropagator::getInstance(); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { return $builder->arrayNode('baggage'); diff --git a/src/Config/SDK/ComponentProvider/Propagator/TextMapPropagatorComposite.php b/src/Config/SDK/ComponentProvider/Propagator/TextMapPropagatorComposite.php index 7fc67a917..4ae7a8fbd 100644 --- a/src/Config/SDK/ComponentProvider/Propagator/TextMapPropagatorComposite.php +++ b/src/Config/SDK/ComponentProvider/Propagator/TextMapPropagatorComposite.php @@ -21,6 +21,7 @@ final class TextMapPropagatorComposite implements ComponentProvider /** * @param list> $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): TextMapPropagatorInterface { $propagators = []; @@ -31,6 +32,7 @@ public function createPlugin(array $properties, Context $context): TextMapPropag return new MultiTextMapPropagator($propagators); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { return $registry->componentNames('composite', TextMapPropagatorInterface::class); diff --git a/src/Config/SDK/ComponentProvider/Propagator/TextMapPropagatorJaeger.php b/src/Config/SDK/ComponentProvider/Propagator/TextMapPropagatorJaeger.php index 7e448aa79..4291c6923 100644 --- a/src/Config/SDK/ComponentProvider/Propagator/TextMapPropagatorJaeger.php +++ b/src/Config/SDK/ComponentProvider/Propagator/TextMapPropagatorJaeger.php @@ -22,11 +22,13 @@ final class TextMapPropagatorJaeger implements ComponentProvider /** * @param array{} $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): TextMapPropagatorInterface { return JaegerPropagator::getInstance(); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { return $builder->arrayNode('jaeger'); diff --git a/src/Config/SDK/ComponentProvider/Propagator/TextMapPropagatorTraceContext.php b/src/Config/SDK/ComponentProvider/Propagator/TextMapPropagatorTraceContext.php index 2c1d5c02f..897452b96 100644 --- a/src/Config/SDK/ComponentProvider/Propagator/TextMapPropagatorTraceContext.php +++ b/src/Config/SDK/ComponentProvider/Propagator/TextMapPropagatorTraceContext.php @@ -20,11 +20,13 @@ final class TextMapPropagatorTraceContext implements ComponentProvider /** * @param array{} $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): TextMapPropagatorInterface { return TraceContextPropagator::getInstance(); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { return $builder->arrayNode('tracecontext'); diff --git a/src/Config/SDK/ComponentProvider/Trace/SamplerAlwaysOff.php b/src/Config/SDK/ComponentProvider/Trace/SamplerAlwaysOff.php index b9fbbd270..c06aa0aa8 100644 --- a/src/Config/SDK/ComponentProvider/Trace/SamplerAlwaysOff.php +++ b/src/Config/SDK/ComponentProvider/Trace/SamplerAlwaysOff.php @@ -20,11 +20,13 @@ final class SamplerAlwaysOff implements ComponentProvider /** * @param array{} $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): SamplerInterface { return new AlwaysOffSampler(); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { return $builder->arrayNode('always_off'); diff --git a/src/Config/SDK/ComponentProvider/Trace/SamplerAlwaysOn.php b/src/Config/SDK/ComponentProvider/Trace/SamplerAlwaysOn.php index 4a3733df0..2800657a9 100644 --- a/src/Config/SDK/ComponentProvider/Trace/SamplerAlwaysOn.php +++ b/src/Config/SDK/ComponentProvider/Trace/SamplerAlwaysOn.php @@ -20,11 +20,13 @@ final class SamplerAlwaysOn implements ComponentProvider /** * @param array{} $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): SamplerInterface { return new AlwaysOnSampler(); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { return $builder->arrayNode('always_on'); diff --git a/src/Config/SDK/ComponentProvider/Trace/SamplerParentBased.php b/src/Config/SDK/ComponentProvider/Trace/SamplerParentBased.php index a3d647f94..b165cc96f 100644 --- a/src/Config/SDK/ComponentProvider/Trace/SamplerParentBased.php +++ b/src/Config/SDK/ComponentProvider/Trace/SamplerParentBased.php @@ -29,6 +29,7 @@ final class SamplerParentBased implements ComponentProvider * local_parent_not_sampled: ?ComponentPlugin, * } $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): SamplerInterface { return new ParentBased( @@ -40,6 +41,7 @@ public function createPlugin(array $properties, Context $context): SamplerInterf ); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { $node = $builder->arrayNode('parent_based'); diff --git a/src/Config/SDK/ComponentProvider/Trace/SamplerTraceIdRatioBased.php b/src/Config/SDK/ComponentProvider/Trace/SamplerTraceIdRatioBased.php index 9e8992e07..4c98511bc 100644 --- a/src/Config/SDK/ComponentProvider/Trace/SamplerTraceIdRatioBased.php +++ b/src/Config/SDK/ComponentProvider/Trace/SamplerTraceIdRatioBased.php @@ -22,6 +22,7 @@ final class SamplerTraceIdRatioBased implements ComponentProvider * ratio: float, * } $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): SamplerInterface { return new TraceIdRatioBasedSampler( @@ -29,6 +30,7 @@ public function createPlugin(array $properties, Context $context): SamplerInterf ); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { $node = $builder->arrayNode('trace_id_ratio_based'); diff --git a/src/Config/SDK/ComponentProvider/Trace/SpanExporterConsole.php b/src/Config/SDK/ComponentProvider/Trace/SpanExporterConsole.php index b9b0ad1a0..3141a9818 100644 --- a/src/Config/SDK/ComponentProvider/Trace/SpanExporterConsole.php +++ b/src/Config/SDK/ComponentProvider/Trace/SpanExporterConsole.php @@ -21,6 +21,7 @@ final class SpanExporterConsole implements ComponentProvider /** * @param array{} $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): SpanExporterInterface { return new ConsoleSpanExporter(Registry::transportFactory('stream')->create( @@ -29,6 +30,7 @@ public function createPlugin(array $properties, Context $context): SpanExporterI )); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { return $builder->arrayNode('console'); diff --git a/src/Config/SDK/ComponentProvider/Trace/SpanExporterMemory.php b/src/Config/SDK/ComponentProvider/Trace/SpanExporterMemory.php index b96644729..529318f54 100644 --- a/src/Config/SDK/ComponentProvider/Trace/SpanExporterMemory.php +++ b/src/Config/SDK/ComponentProvider/Trace/SpanExporterMemory.php @@ -20,11 +20,13 @@ final class SpanExporterMemory implements ComponentProvider /** * @param array{} $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): SpanExporterInterface { return new InMemoryExporter(); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { return $builder->arrayNode('memory/development'); diff --git a/src/Config/SDK/ComponentProvider/Trace/SpanExporterOtlpFile.php b/src/Config/SDK/ComponentProvider/Trace/SpanExporterOtlpFile.php index ad08b424c..59e752ea5 100644 --- a/src/Config/SDK/ComponentProvider/Trace/SpanExporterOtlpFile.php +++ b/src/Config/SDK/ComponentProvider/Trace/SpanExporterOtlpFile.php @@ -28,6 +28,7 @@ final class SpanExporterOtlpFile implements ComponentProvider * output_stream: string, * } $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): SpanExporterInterface { $endpoint = OutputStreamParser::parse($properties['output_stream']); @@ -38,6 +39,7 @@ public function createPlugin(array $properties, Context $context): SpanExporterI )); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { $node = $builder->arrayNode('otlp_file/development'); diff --git a/src/Config/SDK/ComponentProvider/Trace/SpanExporterOtlpGrpc.php b/src/Config/SDK/ComponentProvider/Trace/SpanExporterOtlpGrpc.php index c82f8ef22..018a8f8f4 100644 --- a/src/Config/SDK/ComponentProvider/Trace/SpanExporterOtlpGrpc.php +++ b/src/Config/SDK/ComponentProvider/Trace/SpanExporterOtlpGrpc.php @@ -40,6 +40,7 @@ final class SpanExporterOtlpGrpc implements ComponentProvider * insecure: ?bool, * } $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): SpanExporterInterface { $protocol = Protocols::GRPC; @@ -57,6 +58,7 @@ public function createPlugin(array $properties, Context $context): SpanExporterI )); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { $node = $builder->arrayNode('otlp_grpc'); diff --git a/src/Config/SDK/ComponentProvider/Trace/SpanExporterOtlpHttp.php b/src/Config/SDK/ComponentProvider/Trace/SpanExporterOtlpHttp.php index c9f8136cd..2d86f54a7 100644 --- a/src/Config/SDK/ComponentProvider/Trace/SpanExporterOtlpHttp.php +++ b/src/Config/SDK/ComponentProvider/Trace/SpanExporterOtlpHttp.php @@ -37,6 +37,7 @@ final class SpanExporterOtlpHttp implements ComponentProvider * encoding: 'protobuf'|'json', * } $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): SpanExporterInterface { $headers = array_column($properties['headers'], 'value', 'name') + MapParser::parse($properties['headers_list']); @@ -56,6 +57,7 @@ public function createPlugin(array $properties, Context $context): SpanExporterI )); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { $node = $builder->arrayNode('otlp_http'); diff --git a/src/Config/SDK/ComponentProvider/Trace/SpanExporterZipkin.php b/src/Config/SDK/ComponentProvider/Trace/SpanExporterZipkin.php index 5fe128ff4..745bf1669 100644 --- a/src/Config/SDK/ComponentProvider/Trace/SpanExporterZipkin.php +++ b/src/Config/SDK/ComponentProvider/Trace/SpanExporterZipkin.php @@ -28,6 +28,7 @@ final class SpanExporterZipkin implements ComponentProvider * timeout: int<0, max>, * } $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): SpanExporterInterface { return new Zipkin\Exporter(Registry::transportFactory('http')->create( @@ -37,6 +38,7 @@ public function createPlugin(array $properties, Context $context): SpanExporterI )); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { $node = $builder->arrayNode('zipkin'); diff --git a/src/Config/SDK/ComponentProvider/Trace/SpanProcessorBatch.php b/src/Config/SDK/ComponentProvider/Trace/SpanProcessorBatch.php index b1497fc7b..0e240b82f 100644 --- a/src/Config/SDK/ComponentProvider/Trace/SpanProcessorBatch.php +++ b/src/Config/SDK/ComponentProvider/Trace/SpanProcessorBatch.php @@ -29,6 +29,7 @@ final class SpanProcessorBatch implements ComponentProvider * exporter: ComponentPlugin, * } $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): SpanProcessorInterface { return new BatchSpanProcessor( @@ -42,6 +43,7 @@ public function createPlugin(array $properties, Context $context): SpanProcessor ); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { $node = $builder->arrayNode('batch'); diff --git a/src/Config/SDK/ComponentProvider/Trace/SpanProcessorSimple.php b/src/Config/SDK/ComponentProvider/Trace/SpanProcessorSimple.php index 966e1b25c..cc9ac14ce 100644 --- a/src/Config/SDK/ComponentProvider/Trace/SpanProcessorSimple.php +++ b/src/Config/SDK/ComponentProvider/Trace/SpanProcessorSimple.php @@ -24,6 +24,7 @@ final class SpanProcessorSimple implements ComponentProvider * exporter: ComponentPlugin, * } $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): SpanProcessorInterface { return new SimpleSpanProcessor( @@ -31,6 +32,7 @@ public function createPlugin(array $properties, Context $context): SpanProcessor ); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { $node = $builder->arrayNode('simple'); diff --git a/src/Config/SDK/Configuration/Environment/ArrayEnvSource.php b/src/Config/SDK/Configuration/Environment/ArrayEnvSource.php index aeab22fed..f456f9ff1 100644 --- a/src/Config/SDK/Configuration/Environment/ArrayEnvSource.php +++ b/src/Config/SDK/Configuration/Environment/ArrayEnvSource.php @@ -11,6 +11,7 @@ public function __construct( ) { } + #[\Override] public function readRaw(string $name): mixed { return $this->env[$name] ?? null; diff --git a/src/Config/SDK/Configuration/Environment/EnvResource.php b/src/Config/SDK/Configuration/Environment/EnvResource.php index 5ff133cd0..09309f2e8 100644 --- a/src/Config/SDK/Configuration/Environment/EnvResource.php +++ b/src/Config/SDK/Configuration/Environment/EnvResource.php @@ -14,6 +14,7 @@ public function __construct( ) { } + #[\Override] public function __toString(): string { return 'env.' . $this->name; diff --git a/src/Config/SDK/Configuration/Environment/EnvResourceChecker.php b/src/Config/SDK/Configuration/Environment/EnvResourceChecker.php index ab048aa9b..033ed5f2b 100644 --- a/src/Config/SDK/Configuration/Environment/EnvResourceChecker.php +++ b/src/Config/SDK/Configuration/Environment/EnvResourceChecker.php @@ -15,11 +15,13 @@ public function __construct( ) { } + #[\Override] public function supports(ResourceInterface $metadata): bool { return $metadata instanceof EnvResource; } + #[\Override] public function isFresh(ResourceInterface $resource, int $timestamp): bool { assert($resource instanceof EnvResource); diff --git a/src/Config/SDK/Configuration/Environment/EnvSourceReader.php b/src/Config/SDK/Configuration/Environment/EnvSourceReader.php index f9cacf48f..c2f1d84e7 100644 --- a/src/Config/SDK/Configuration/Environment/EnvSourceReader.php +++ b/src/Config/SDK/Configuration/Environment/EnvSourceReader.php @@ -17,6 +17,7 @@ public function __construct( ) { } + #[\Override] public function read(string $name): ?string { foreach ($this->envSources as $envSource) { diff --git a/src/Config/SDK/Configuration/Environment/PhpIniEnvSource.php b/src/Config/SDK/Configuration/Environment/PhpIniEnvSource.php index c5a1f7a35..33457b8c0 100644 --- a/src/Config/SDK/Configuration/Environment/PhpIniEnvSource.php +++ b/src/Config/SDK/Configuration/Environment/PhpIniEnvSource.php @@ -8,6 +8,7 @@ final class PhpIniEnvSource implements EnvSource { + #[\Override] public function readRaw(string $name): string|array|false { return get_cfg_var($name); diff --git a/src/Config/SDK/Configuration/Environment/ServerEnvSource.php b/src/Config/SDK/Configuration/Environment/ServerEnvSource.php index 471a6727f..b5315e50a 100644 --- a/src/Config/SDK/Configuration/Environment/ServerEnvSource.php +++ b/src/Config/SDK/Configuration/Environment/ServerEnvSource.php @@ -6,6 +6,7 @@ final class ServerEnvSource implements EnvSource { + #[\Override] public function readRaw(string $name): mixed { return $_SERVER[$name] ?? null; diff --git a/src/Config/SDK/Configuration/Internal/ComponentPlugin.php b/src/Config/SDK/Configuration/Internal/ComponentPlugin.php index 043a78c5e..f7ac38a4b 100644 --- a/src/Config/SDK/Configuration/Internal/ComponentPlugin.php +++ b/src/Config/SDK/Configuration/Internal/ComponentPlugin.php @@ -25,6 +25,7 @@ public function __construct( ) { } + #[\Override] public function create(Context $context): mixed { return $this->provider->createPlugin($this->properties, $context); diff --git a/src/Config/SDK/Configuration/Internal/ComponentProviderRegistry.php b/src/Config/SDK/Configuration/Internal/ComponentProviderRegistry.php index 284ec96dc..734b5ef1e 100644 --- a/src/Config/SDK/Configuration/Internal/ComponentProviderRegistry.php +++ b/src/Config/SDK/Configuration/Internal/ComponentProviderRegistry.php @@ -61,11 +61,13 @@ public function register(ComponentProvider $provider): void $this->providers[$type][$name] = new ComponentProviderRegistryEntry($provider, $config); } + #[\Override] public function trackResources(?ResourceCollection $resources): void { $this->resources = $resources; } + #[\Override] public function component(string $name, string $type): NodeDefinition { $node = $this->builder->arrayNode($name); @@ -74,6 +76,7 @@ public function component(string $name, string $type): NodeDefinition return $node; } + #[\Override] public function componentList(string $name, string $type): ArrayNodeDefinition { $node = $this->builder->arrayNode($name)->defaultValue([]); @@ -82,6 +85,7 @@ public function componentList(string $name, string $type): ArrayNodeDefinition return $node; } + #[\Override] public function componentMap(string $name, string $type): ArrayNodeDefinition { $node = $this->builder->arrayNode($name); @@ -100,6 +104,7 @@ public function componentMap(string $name, string $type): ArrayNodeDefinition return $node; } + #[\Override] public function componentNames(string $name, string $type): ArrayNodeDefinition { $node = $this->builder->arrayNode($name); diff --git a/src/Config/SDK/Configuration/Internal/ComposerPackageResource.php b/src/Config/SDK/Configuration/Internal/ComposerPackageResource.php index 9e9158a20..04d538e80 100644 --- a/src/Config/SDK/Configuration/Internal/ComposerPackageResource.php +++ b/src/Config/SDK/Configuration/Internal/ComposerPackageResource.php @@ -21,11 +21,13 @@ public function __construct(string $packageName) $this->version = self::getVersion($packageName); } + #[\Override] public function isFresh(int $timestamp): bool { return $this->version === self::getVersion($this->packageName); } + #[\Override] public function __toString(): string { return 'composer.' . $this->packageName; diff --git a/src/Config/SDK/Configuration/Internal/ConfigurationLoader.php b/src/Config/SDK/Configuration/Internal/ConfigurationLoader.php index 77446f3f6..829bc7680 100644 --- a/src/Config/SDK/Configuration/Internal/ConfigurationLoader.php +++ b/src/Config/SDK/Configuration/Internal/ConfigurationLoader.php @@ -20,11 +20,13 @@ public function __construct(?ResourceCollection $resources) $this->resources = $resources; } + #[\Override] public function loadConfiguration(mixed $configuration): void { $this->configurations[] = $configuration; } + #[\Override] public function addResource(ResourceInterface $resource): void { $this->resources?->addResource($resource); diff --git a/src/Config/SDK/Configuration/Internal/EnvSubstitutionNormalization.php b/src/Config/SDK/Configuration/Internal/EnvSubstitutionNormalization.php index 72008b87f..1a2e90c82 100644 --- a/src/Config/SDK/Configuration/Internal/EnvSubstitutionNormalization.php +++ b/src/Config/SDK/Configuration/Internal/EnvSubstitutionNormalization.php @@ -33,6 +33,7 @@ public function __construct( ) { } + #[\Override] public function apply(ArrayNodeDefinition $root): void { foreach ($root->getChildNodeDefinitions() as $childNode) { diff --git a/src/Config/SDK/Configuration/Internal/Node/ArrayNode.php b/src/Config/SDK/Configuration/Internal/Node/ArrayNode.php index e20981791..9cf9a6991 100644 --- a/src/Config/SDK/Configuration/Internal/Node/ArrayNode.php +++ b/src/Config/SDK/Configuration/Internal/Node/ArrayNode.php @@ -33,11 +33,13 @@ public function setDefaultValue(mixed $value): void $this->defaultValueSet = true; } + #[\Override] public function hasDefaultValue(): bool { return $this->defaultValueSet || parent::hasDefaultValue(); } + #[\Override] public function getDefaultValue(): mixed { return $this->defaultValueSet diff --git a/src/Config/SDK/Configuration/Internal/Node/PrototypedArrayNode.php b/src/Config/SDK/Configuration/Internal/Node/PrototypedArrayNode.php index e6b580a20..f278fed73 100644 --- a/src/Config/SDK/Configuration/Internal/Node/PrototypedArrayNode.php +++ b/src/Config/SDK/Configuration/Internal/Node/PrototypedArrayNode.php @@ -22,17 +22,20 @@ public static function fromNode(\Symfony\Component\Config\Definition\PrototypedA return $_node; } + #[\Override] public function setDefaultValue(mixed $value): void { $this->defaultValue_ = $value; $this->defaultValueSet = true; } + #[\Override] public function hasDefaultValue(): bool { return $this->defaultValueSet || parent::hasDefaultValue(); } + #[\Override] public function getDefaultValue(): mixed { return $this->defaultValueSet diff --git a/src/Config/SDK/Configuration/Internal/Node/StringNode.php b/src/Config/SDK/Configuration/Internal/Node/StringNode.php index 8d77245ea..5ea256b24 100644 --- a/src/Config/SDK/Configuration/Internal/Node/StringNode.php +++ b/src/Config/SDK/Configuration/Internal/Node/StringNode.php @@ -14,6 +14,7 @@ class StringNode extends \Symfony\Component\Config\Definition\ScalarNode { use NodeTrait; + #[\Override] protected function validateType(mixed $value): void { if (!is_string($value)) { diff --git a/src/Config/SDK/Configuration/Internal/NodeDefinition/ArrayNodeDefinition.php b/src/Config/SDK/Configuration/Internal/NodeDefinition/ArrayNodeDefinition.php index e400a4a6a..b26cccc58 100644 --- a/src/Config/SDK/Configuration/Internal/NodeDefinition/ArrayNodeDefinition.php +++ b/src/Config/SDK/Configuration/Internal/NodeDefinition/ArrayNodeDefinition.php @@ -22,6 +22,7 @@ public function __construct(?string $name, ?NodeParentInterface $parent = null) $this->nullEquivalent = null; } + #[\Override] protected function createNode(): NodeInterface { $node = parent::createNode(); @@ -40,6 +41,7 @@ protected function createNode(): NodeInterface return $node; } + #[\Override] public function defaultValue(mixed $value): static { $this->defaultValueSet = true; diff --git a/src/Config/SDK/Configuration/Internal/NodeDefinition/BooleanNodeDefinition.php b/src/Config/SDK/Configuration/Internal/NodeDefinition/BooleanNodeDefinition.php index 9201eb069..0f505ca32 100644 --- a/src/Config/SDK/Configuration/Internal/NodeDefinition/BooleanNodeDefinition.php +++ b/src/Config/SDK/Configuration/Internal/NodeDefinition/BooleanNodeDefinition.php @@ -13,6 +13,7 @@ final class BooleanNodeDefinition extends \Symfony\Component\Config\Definition\B { use NodeDefinitionTrait; + #[\Override] protected function instantiateNode(): BooleanNode { return new BooleanNode($this->name, $this->parent, $this->pathSeparator); diff --git a/src/Config/SDK/Configuration/Internal/NodeDefinition/EnumNodeDefinition.php b/src/Config/SDK/Configuration/Internal/NodeDefinition/EnumNodeDefinition.php index e78b696ba..8f0d60ab1 100644 --- a/src/Config/SDK/Configuration/Internal/NodeDefinition/EnumNodeDefinition.php +++ b/src/Config/SDK/Configuration/Internal/NodeDefinition/EnumNodeDefinition.php @@ -13,6 +13,7 @@ final class EnumNodeDefinition extends \Symfony\Component\Config\Definition\Buil { use NodeDefinitionTrait; + #[\Override] protected function instantiateNode(): EnumNode { $node = parent::instantiateNode(); diff --git a/src/Config/SDK/Configuration/Internal/NodeDefinition/FloatNodeDefinition.php b/src/Config/SDK/Configuration/Internal/NodeDefinition/FloatNodeDefinition.php index cafc10ff6..06d208a4a 100644 --- a/src/Config/SDK/Configuration/Internal/NodeDefinition/FloatNodeDefinition.php +++ b/src/Config/SDK/Configuration/Internal/NodeDefinition/FloatNodeDefinition.php @@ -13,6 +13,7 @@ final class FloatNodeDefinition extends \Symfony\Component\Config\Definition\Bui { use NodeDefinitionTrait; + #[\Override] protected function instantiateNode(): FloatNode { return new FloatNode($this->name, $this->parent, $this->min, $this->max, $this->pathSeparator); diff --git a/src/Config/SDK/Configuration/Internal/NodeDefinition/IntegerNodeDefinition.php b/src/Config/SDK/Configuration/Internal/NodeDefinition/IntegerNodeDefinition.php index c62b32252..eb76b8319 100644 --- a/src/Config/SDK/Configuration/Internal/NodeDefinition/IntegerNodeDefinition.php +++ b/src/Config/SDK/Configuration/Internal/NodeDefinition/IntegerNodeDefinition.php @@ -13,6 +13,7 @@ final class IntegerNodeDefinition extends \Symfony\Component\Config\Definition\B { use NodeDefinitionTrait; + #[\Override] protected function instantiateNode(): IntegerNode { return new IntegerNode($this->name, $this->parent, $this->min, $this->max, $this->pathSeparator); diff --git a/src/Config/SDK/Configuration/Internal/NodeDefinition/ScalarNodeDefinition.php b/src/Config/SDK/Configuration/Internal/NodeDefinition/ScalarNodeDefinition.php index 96cefab49..36c268f6c 100644 --- a/src/Config/SDK/Configuration/Internal/NodeDefinition/ScalarNodeDefinition.php +++ b/src/Config/SDK/Configuration/Internal/NodeDefinition/ScalarNodeDefinition.php @@ -13,6 +13,7 @@ final class ScalarNodeDefinition extends \Symfony\Component\Config\Definition\Bu { use NodeDefinitionTrait; + #[\Override] protected function instantiateNode(): ScalarNode { return new ScalarNode($this->name, $this->parent, $this->pathSeparator); diff --git a/src/Config/SDK/Configuration/Internal/NodeDefinition/StringNodeDefinition.php b/src/Config/SDK/Configuration/Internal/NodeDefinition/StringNodeDefinition.php index de4b88545..00daf2a15 100644 --- a/src/Config/SDK/Configuration/Internal/NodeDefinition/StringNodeDefinition.php +++ b/src/Config/SDK/Configuration/Internal/NodeDefinition/StringNodeDefinition.php @@ -14,6 +14,7 @@ final class StringNodeDefinition extends \Symfony\Component\Config\Definition\Bu { use NodeDefinitionTrait; + #[\Override] protected function instantiateNode(): ScalarNode { return new StringNode($this->name, $this->parent, $this->pathSeparator); diff --git a/src/Config/SDK/Configuration/Internal/NodeDefinition/VariableNodeDefinition.php b/src/Config/SDK/Configuration/Internal/NodeDefinition/VariableNodeDefinition.php index 61db25e90..0472d8ff5 100644 --- a/src/Config/SDK/Configuration/Internal/NodeDefinition/VariableNodeDefinition.php +++ b/src/Config/SDK/Configuration/Internal/NodeDefinition/VariableNodeDefinition.php @@ -13,6 +13,7 @@ final class VariableNodeDefinition extends \Symfony\Component\Config\Definition\ { use NodeDefinitionTrait; + #[\Override] protected function instantiateNode(): VariableNode { return new VariableNode($this->name, $this->parent, $this->pathSeparator); diff --git a/src/Config/SDK/Configuration/Internal/ResourceCollection.php b/src/Config/SDK/Configuration/Internal/ResourceCollection.php index de9117091..2fe1341e6 100644 --- a/src/Config/SDK/Configuration/Internal/ResourceCollection.php +++ b/src/Config/SDK/Configuration/Internal/ResourceCollection.php @@ -41,6 +41,7 @@ public function __construct() /** * @psalm-suppress PossiblyInvalidArgument */ + #[\Override] public function addClassResource(object|string $class): void { try { @@ -56,6 +57,7 @@ public function addClassResource(object|string $class): void } } + #[\Override] public function addResource(ResourceInterface $resource): void { $path = match (true) { diff --git a/src/Config/SDK/Configuration/Internal/TrackingEnvReader.php b/src/Config/SDK/Configuration/Internal/TrackingEnvReader.php index 748bb7437..d983eb7e7 100644 --- a/src/Config/SDK/Configuration/Internal/TrackingEnvReader.php +++ b/src/Config/SDK/Configuration/Internal/TrackingEnvReader.php @@ -21,11 +21,13 @@ public function __construct(EnvReader $envReader) $this->envReader = $envReader; } + #[\Override] public function trackResources(?ResourceCollection $resources): void { $this->resources = $resources; } + #[\Override] public function read(string $name): ?string { $value = $this->envReader->read($name); diff --git a/src/Config/SDK/Configuration/Loader/YamlExtensionFileLoader.php b/src/Config/SDK/Configuration/Loader/YamlExtensionFileLoader.php index 37d161e1c..70e766515 100644 --- a/src/Config/SDK/Configuration/Loader/YamlExtensionFileLoader.php +++ b/src/Config/SDK/Configuration/Loader/YamlExtensionFileLoader.php @@ -22,6 +22,7 @@ public function __construct(private readonly ConfigurationLoader $configuration, parent::__construct($locator, $env); } + #[\Override] public function load(mixed $resource, ?string $type = null): mixed { assert(extension_loaded('yaml')); @@ -38,6 +39,7 @@ public function load(mixed $resource, ?string $type = null): mixed return null; } + #[\Override] public function supports(mixed $resource, ?string $type = null): bool { return extension_loaded('yaml') diff --git a/src/Config/SDK/Configuration/Loader/YamlSymfonyFileLoader.php b/src/Config/SDK/Configuration/Loader/YamlSymfonyFileLoader.php index ec1ffd404..58131075b 100644 --- a/src/Config/SDK/Configuration/Loader/YamlSymfonyFileLoader.php +++ b/src/Config/SDK/Configuration/Loader/YamlSymfonyFileLoader.php @@ -24,6 +24,7 @@ public function __construct(private readonly ConfigurationLoader $configuration, parent::__construct($locator, $env); } + #[\Override] public function load(mixed $resource, ?string $type = null): mixed { assert(class_exists(Yaml::class)); @@ -42,6 +43,7 @@ public function load(mixed $resource, ?string $type = null): mixed return null; } + #[\Override] public function supports(mixed $resource, ?string $type = null): bool { return class_exists(Yaml::class) diff --git a/src/Context/Context.php b/src/Context/Context.php index e64e533a4..c97fb5927 100644 --- a/src/Context/Context.php +++ b/src/Context/Context.php @@ -31,6 +31,7 @@ private function __construct() self::$spanContextKey = ContextKeys::span(); } + #[\Override] public static function createKey(string $key): ContextKeyInterface { return new ContextKey($key); @@ -67,11 +68,13 @@ public static function getRoot(): ContextInterface return $empty ??= new self(); } + #[\Override] public static function getCurrent(): ContextInterface { return self::storage()->current(); } + #[\Override] public function activate(): ScopeInterface { $scope = self::storage()->attach($this); @@ -89,11 +92,13 @@ private static function debugScopesDisabled(): bool ); } + #[\Override] public function withContextValue(ImplicitContextKeyedInterface $value): ContextInterface { return $value->storeInContext($this); } + #[\Override] public function with(ContextKeyInterface $key, $value): self { if ($this->get($key) === $value) { @@ -122,6 +127,7 @@ public function with(ContextKeyInterface $key, $value): self return $self; } + #[\Override] public function get(ContextKeyInterface $key) { if ($key === self::$spanContextKey) { diff --git a/src/Context/ContextStorage.php b/src/Context/ContextStorage.php index 614cd37a7..d80bbf0af 100644 --- a/src/Context/ContextStorage.php +++ b/src/Context/ContextStorage.php @@ -19,26 +19,31 @@ public function __construct() $this->current = $this->main = new ContextStorageHead($this); } + #[\Override] public function fork(int|string $id): void { $this->forks[$id] = clone $this->current; } + #[\Override] public function switch(int|string $id): void { $this->current = $this->forks[$id] ?? $this->main; } + #[\Override] public function destroy(int|string $id): void { unset($this->forks[$id]); } + #[\Override] public function head(): ContextStorageHead { return $this->current; } + #[\Override] public function scope(): ?ContextStorageScopeInterface { return ($this->current->node->head ?? null) === $this->current @@ -46,11 +51,13 @@ public function scope(): ?ContextStorageScopeInterface : null; } + #[\Override] public function current(): ContextInterface { return $this->current->node->context ?? Context::getRoot(); } + #[\Override] public function attach(ContextInterface $context): ContextStorageScopeInterface { return $this->current->node = new ContextStorageNode($context, $this->current, $this->current->node); diff --git a/src/Context/ContextStorageNode.php b/src/Context/ContextStorageNode.php index 2d6380790..f8141b8e4 100644 --- a/src/Context/ContextStorageNode.php +++ b/src/Context/ContextStorageNode.php @@ -20,31 +20,37 @@ public function __construct( ) { } + #[\Override] public function offsetExists(mixed $offset): bool { return isset($this->localStorage[$offset]); } + #[\Override] public function offsetGet(mixed $offset): mixed { return $this->localStorage[$offset]; } + #[\Override] public function offsetSet(mixed $offset, mixed $value): void { $this->localStorage[$offset] = $value; } + #[\Override] public function offsetUnset(mixed $offset): void { unset($this->localStorage[$offset]); } + #[\Override] public function context(): ContextInterface { return $this->context; } + #[\Override] public function detach(): int { $flags = 0; diff --git a/src/Context/ContextStorageScopeInterface.php b/src/Context/ContextStorageScopeInterface.php index bacc1b0dc..193f20ffb 100644 --- a/src/Context/ContextStorageScopeInterface.php +++ b/src/Context/ContextStorageScopeInterface.php @@ -21,5 +21,6 @@ public function context(): ContextInterface; /** * @param string $offset */ + #[\Override] public function offsetSet($offset, $value): void; } diff --git a/src/Context/DebugScope.php b/src/Context/DebugScope.php index f78a4ce6a..6d5264a70 100644 --- a/src/Context/DebugScope.php +++ b/src/Context/DebugScope.php @@ -39,6 +39,7 @@ public function __construct(private readonly ContextStorageScopeInterface $scope } } + #[\Override] public function detach(): int { $this->detachedAt ??= debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); diff --git a/src/Context/FiberBoundContextStorage.php b/src/Context/FiberBoundContextStorage.php index 483cb8bd0..78bc583e7 100644 --- a/src/Context/FiberBoundContextStorage.php +++ b/src/Context/FiberBoundContextStorage.php @@ -26,11 +26,13 @@ public function __construct() $this->heads[$this] = new ContextStorageHead($this); } + #[\Override] public function head(): ?ContextStorageHead { return $this->heads[Fiber::getCurrent() ?? $this] ?? null; } + #[\Override] public function scope(): ?ContextStorageScopeInterface { $head = $this->heads[Fiber::getCurrent() ?? $this] ?? null; @@ -45,6 +47,7 @@ public function scope(): ?ContextStorageScopeInterface return $head->node; } + #[\Override] public function current(): ContextInterface { $head = $this->heads[Fiber::getCurrent() ?? $this] ?? null; @@ -59,6 +62,7 @@ public function current(): ContextInterface return $head->node->context ?? Context::getRoot(); } + #[\Override] public function attach(ContextInterface $context): ContextStorageScopeInterface { $head = $this->heads[Fiber::getCurrent() ?? $this] ??= new ContextStorageHead($this); diff --git a/src/Context/FiberBoundContextStorageExecutionAwareBC.php b/src/Context/FiberBoundContextStorageExecutionAwareBC.php index fe54b2261..f0894c2e3 100644 --- a/src/Context/FiberBoundContextStorageExecutionAwareBC.php +++ b/src/Context/FiberBoundContextStorageExecutionAwareBC.php @@ -17,16 +17,19 @@ public function __construct() $this->storage = new FiberBoundContextStorage(); } + #[\Override] public function fork(int|string $id): void { $this->bcStorage()->fork($id); } + #[\Override] public function switch(int|string $id): void { $this->bcStorage()->switch($id); } + #[\Override] public function destroy(int|string $id): void { $this->bcStorage()->destroy($id); @@ -51,6 +54,7 @@ private function bcStorage(): ContextStorage return $this->bc; } + #[\Override] public function scope(): ?ContextStorageScopeInterface { return $this->bc @@ -58,6 +62,7 @@ public function scope(): ?ContextStorageScopeInterface : $this->storage->scope(); } + #[\Override] public function current(): ContextInterface { return $this->bc @@ -65,6 +70,7 @@ public function current(): ContextInterface : $this->storage->current(); } + #[\Override] public function attach(ContextInterface $context): ContextStorageScopeInterface { return $this->bc diff --git a/src/Context/Propagation/ArrayAccessGetterSetter.php b/src/Context/Propagation/ArrayAccessGetterSetter.php index c1cc8d459..899a077b7 100644 --- a/src/Context/Propagation/ArrayAccessGetterSetter.php +++ b/src/Context/Propagation/ArrayAccessGetterSetter.php @@ -36,6 +36,7 @@ public static function getInstance(): self } /** {@inheritdoc} */ + #[\Override] public function keys($carrier): array { if ($this->isSupportedCarrier($carrier)) { @@ -56,6 +57,7 @@ public function keys($carrier): array } /** {@inheritdoc} */ + #[\Override] public function get($carrier, string $key): ?string { if ($this->isSupportedCarrier($carrier)) { @@ -79,6 +81,7 @@ public function get($carrier, string $key): ?string } /** {@inheritdoc} */ + #[\Override] public function getAll($carrier, string $key): array { if ($this->isSupportedCarrier($carrier)) { @@ -102,6 +105,7 @@ public function getAll($carrier, string $key): array } /** {@inheritdoc} */ + #[\Override] public function set(&$carrier, string $key, string $value): void { if ($key === '') { diff --git a/src/Context/Propagation/MultiTextMapPropagator.php b/src/Context/Propagation/MultiTextMapPropagator.php index b1640bbce..def64c2ad 100644 --- a/src/Context/Propagation/MultiTextMapPropagator.php +++ b/src/Context/Propagation/MultiTextMapPropagator.php @@ -27,11 +27,13 @@ public function __construct( $this->fields = $this->extractFields($this->propagators); } + #[\Override] public function fields(): array { return $this->fields; } + #[\Override] public function inject(&$carrier, ?PropagationSetterInterface $setter = null, ?ContextInterface $context = null): void { foreach ($this->propagators as $propagator) { @@ -39,6 +41,7 @@ public function inject(&$carrier, ?PropagationSetterInterface $setter = null, ?C } } + #[\Override] public function extract($carrier, ?PropagationGetterInterface $getter = null, ?ContextInterface $context = null): ContextInterface { $context ??= Context::getCurrent(); diff --git a/src/Context/Propagation/NoopTextMapPropagator.php b/src/Context/Propagation/NoopTextMapPropagator.php index 62892b329..ef96187a8 100644 --- a/src/Context/Propagation/NoopTextMapPropagator.php +++ b/src/Context/Propagation/NoopTextMapPropagator.php @@ -20,16 +20,19 @@ public static function getInstance(): self return self::$instance; } + #[\Override] public function fields(): array { return []; } + #[\Override] public function extract($carrier, ?PropagationGetterInterface $getter = null, ?ContextInterface $context = null): ContextInterface { return $context ?? Context::getCurrent(); } + #[\Override] public function inject(&$carrier, ?PropagationSetterInterface $setter = null, ?ContextInterface $context = null): void { } diff --git a/src/Context/Propagation/SanitizeCombinedHeadersPropagationGetter.php b/src/Context/Propagation/SanitizeCombinedHeadersPropagationGetter.php index 45b62b289..12cc93340 100644 --- a/src/Context/Propagation/SanitizeCombinedHeadersPropagationGetter.php +++ b/src/Context/Propagation/SanitizeCombinedHeadersPropagationGetter.php @@ -22,11 +22,13 @@ public function __construct(private readonly PropagationGetterInterface $getter) { } + #[\Override] public function keys($carrier): array { return $this->getter->keys($carrier); } + #[\Override] public function get($carrier, string $key): ?string { $value = $this->getter->get($carrier, $key); @@ -41,6 +43,7 @@ public function get($carrier, string $key): ?string ); } + #[\Override] public function getAll($carrier, string $key): array { $value = $this->getter instanceof ExtendedPropagationGetterInterface diff --git a/src/Contrib/Grpc/GrpcTransport.php b/src/Contrib/Grpc/GrpcTransport.php index b245ad4ea..f0d7cf5d7 100644 --- a/src/Contrib/Grpc/GrpcTransport.php +++ b/src/Contrib/Grpc/GrpcTransport.php @@ -53,11 +53,13 @@ public function __construct( $this->exportTimeout = new Timeval($timeoutMillis * self::MICROS_PER_MILLISECOND); } + #[\Override] public function contentType(): string { return ContentTypes::PROTOBUF; } + #[\Override] public function send(string $payload, ?CancellationInterface $cancellation = null): FutureInterface { if ($this->closed) { @@ -91,6 +93,7 @@ public function send(string $payload, ?CancellationInterface $cancellation = nul return new ErrorFuture(new RuntimeException($event->status->details, $event->status->code)); } + #[\Override] public function shutdown(?CancellationInterface $cancellation = null): bool { if ($this->closed) { @@ -103,6 +106,7 @@ public function shutdown(?CancellationInterface $cancellation = null): bool return true; } + #[\Override] public function forceFlush(?CancellationInterface $cancellation = null): bool { return !$this->closed; diff --git a/src/Contrib/Grpc/GrpcTransportFactory.php b/src/Contrib/Grpc/GrpcTransportFactory.php index 58cdd8a1d..e580bcbe8 100644 --- a/src/Contrib/Grpc/GrpcTransportFactory.php +++ b/src/Contrib/Grpc/GrpcTransportFactory.php @@ -33,6 +33,7 @@ final class GrpcTransportFactory implements TransportFactoryInterface * @psalm-suppress ImplementedReturnTypeMismatch * @psalm-suppress NoValue */ + #[\Override] public function create( string $endpoint, string $contentType = ContentTypes::PROTOBUF, diff --git a/src/Contrib/Otlp/HttpEndpointResolver.php b/src/Contrib/Otlp/HttpEndpointResolver.php index e63eec4b5..a94d48166 100644 --- a/src/Contrib/Otlp/HttpEndpointResolver.php +++ b/src/Contrib/Otlp/HttpEndpointResolver.php @@ -37,6 +37,7 @@ public static function create(?FactoryResolverInterface $httpFactoryResolver = n return new self($httpFactoryResolver); } + #[\Override] public function resolve(string $endpoint, string $signal): UriInterface { $components = self::parseEndpoint($endpoint); @@ -50,6 +51,7 @@ public function resolve(string $endpoint, string $signal): UriInterface ); } + #[\Override] public function resolveToString(string $endpoint, string $signal): string { return (string) $this->resolve($endpoint, $signal); diff --git a/src/Contrib/Otlp/LogsExporter.php b/src/Contrib/Otlp/LogsExporter.php index 254e407dd..a3055c118 100644 --- a/src/Contrib/Otlp/LogsExporter.php +++ b/src/Contrib/Otlp/LogsExporter.php @@ -36,6 +36,7 @@ public function __construct(private TransportInterface $transport) /** * @param iterable $batch */ + #[\Override] public function export(iterable $batch, ?CancellationInterface $cancellation = null): FutureInterface { return $this->transport @@ -70,11 +71,13 @@ public function export(iterable $batch, ?CancellationInterface $cancellation = n }); } + #[\Override] public function forceFlush(?CancellationInterface $cancellation = null): bool { return $this->transport->forceFlush($cancellation); } + #[\Override] public function shutdown(?CancellationInterface $cancellation = null): bool { return $this->transport->shutdown($cancellation); diff --git a/src/Contrib/Otlp/LogsExporterFactory.php b/src/Contrib/Otlp/LogsExporterFactory.php index a92cffa3b..682004eef 100644 --- a/src/Contrib/Otlp/LogsExporterFactory.php +++ b/src/Contrib/Otlp/LogsExporterFactory.php @@ -25,6 +25,7 @@ public function __construct(private readonly ?TransportFactoryInterface $transpo /** * @psalm-suppress ArgumentTypeCoercion */ + #[\Override] public function create(): LogRecordExporterInterface { $protocol = Configuration::has(Variables::OTEL_EXPORTER_OTLP_LOGS_PROTOCOL) diff --git a/src/Contrib/Otlp/MetricExporter.php b/src/Contrib/Otlp/MetricExporter.php index c5a9ad6bc..8bce1f3e6 100644 --- a/src/Contrib/Otlp/MetricExporter.php +++ b/src/Contrib/Otlp/MetricExporter.php @@ -37,11 +37,13 @@ public function __construct( $this->serializer = ProtobufSerializer::forTransport($this->transport); } + #[\Override] public function temporality(MetricMetadataInterface $metric): Temporality|string|null { return $this->temporality ?? $metric->temporality(); } + #[\Override] public function export(iterable $batch): bool { return $this->transport @@ -77,11 +79,13 @@ public function export(iterable $batch): bool ->await(); } + #[\Override] public function shutdown(): bool { return $this->transport->shutdown(); } + #[\Override] public function forceFlush(): bool { return $this->transport->forceFlush(); diff --git a/src/Contrib/Otlp/MetricExporterFactory.php b/src/Contrib/Otlp/MetricExporterFactory.php index 1ba7488f3..c27577d71 100644 --- a/src/Contrib/Otlp/MetricExporterFactory.php +++ b/src/Contrib/Otlp/MetricExporterFactory.php @@ -26,6 +26,7 @@ public function __construct(private readonly ?TransportFactoryInterface $transpo /** * @psalm-suppress ArgumentTypeCoercion */ + #[\Override] public function create(): MetricExporterInterface { $protocol = Configuration::has(Variables::OTEL_EXPORTER_OTLP_METRICS_PROTOCOL) diff --git a/src/Contrib/Otlp/OtlpHttpTransportFactory.php b/src/Contrib/Otlp/OtlpHttpTransportFactory.php index f8631a124..1e42bf978 100644 --- a/src/Contrib/Otlp/OtlpHttpTransportFactory.php +++ b/src/Contrib/Otlp/OtlpHttpTransportFactory.php @@ -12,6 +12,7 @@ class OtlpHttpTransportFactory implements TransportFactoryInterface { private const DEFAULT_COMPRESSION = 'none'; + #[\Override] public function create( string $endpoint, string $contentType, diff --git a/src/Contrib/Otlp/ProtobufSerializer.php b/src/Contrib/Otlp/ProtobufSerializer.php index ffc741521..0ca44014d 100644 --- a/src/Contrib/Otlp/ProtobufSerializer.php +++ b/src/Contrib/Otlp/ProtobufSerializer.php @@ -117,7 +117,7 @@ private static function serializeToJsonString(Message $message): string return $payload; } - $data = json_decode($payload); + $data = json_decode((string) $payload); unset($payload); self::traverseDescriptor($data, $desc); diff --git a/src/Contrib/Otlp/SpanExporter.php b/src/Contrib/Otlp/SpanExporter.php index f8e8b28e4..11cf66629 100644 --- a/src/Contrib/Otlp/SpanExporter.php +++ b/src/Contrib/Otlp/SpanExporter.php @@ -32,6 +32,7 @@ public function __construct(private TransportInterface $transport) $this->serializer = ProtobufSerializer::forTransport($this->transport); } + #[\Override] public function export(iterable $batch, ?CancellationInterface $cancellation = null): FutureInterface { return $this->transport @@ -66,11 +67,13 @@ public function export(iterable $batch, ?CancellationInterface $cancellation = n }); } + #[\Override] public function shutdown(?CancellationInterface $cancellation = null): bool { return $this->transport->shutdown($cancellation); } + #[\Override] public function forceFlush(?CancellationInterface $cancellation = null): bool { return $this->transport->forceFlush($cancellation); diff --git a/src/Contrib/Otlp/SpanExporterFactory.php b/src/Contrib/Otlp/SpanExporterFactory.php index 1ef7d49aa..c93740c38 100644 --- a/src/Contrib/Otlp/SpanExporterFactory.php +++ b/src/Contrib/Otlp/SpanExporterFactory.php @@ -28,6 +28,7 @@ public function __construct(private readonly ?TransportFactoryInterface $transpo /** * @psalm-suppress ArgumentTypeCoercion */ + #[\Override] public function create(): SpanExporterInterface { $transport = $this->buildTransport(); diff --git a/src/Contrib/Otlp/StdoutLogsExporterFactory.php b/src/Contrib/Otlp/StdoutLogsExporterFactory.php index d39c71e6a..409ff1f0a 100644 --- a/src/Contrib/Otlp/StdoutLogsExporterFactory.php +++ b/src/Contrib/Otlp/StdoutLogsExporterFactory.php @@ -10,6 +10,7 @@ class StdoutLogsExporterFactory implements LogRecordExporterFactoryInterface { + #[\Override] public function create(): LogRecordExporterInterface { $transport = (new StreamTransportFactory())->create('php://stdout', ContentTypes::NDJSON); diff --git a/src/Contrib/Otlp/StdoutMetricExporterFactory.php b/src/Contrib/Otlp/StdoutMetricExporterFactory.php index 3eeba09e2..2b130abc9 100644 --- a/src/Contrib/Otlp/StdoutMetricExporterFactory.php +++ b/src/Contrib/Otlp/StdoutMetricExporterFactory.php @@ -10,6 +10,7 @@ class StdoutMetricExporterFactory implements MetricExporterFactoryInterface { + #[\Override] public function create(): MetricExporterInterface { $transport = (new StreamTransportFactory())->create('php://stdout', ContentTypes::NDJSON); diff --git a/src/Contrib/Otlp/StdoutSpanExporterFactory.php b/src/Contrib/Otlp/StdoutSpanExporterFactory.php index d51cbaa75..033633ae5 100644 --- a/src/Contrib/Otlp/StdoutSpanExporterFactory.php +++ b/src/Contrib/Otlp/StdoutSpanExporterFactory.php @@ -10,6 +10,7 @@ class StdoutSpanExporterFactory implements SpanExporterFactoryInterface { + #[\Override] public function create(): SpanExporterInterface { $transport = (new StreamTransportFactory())->create('php://stdout', ContentTypes::NDJSON); diff --git a/src/Contrib/Zipkin/Exporter.php b/src/Contrib/Zipkin/Exporter.php index d2865dd29..fec31845e 100644 --- a/src/Contrib/Zipkin/Exporter.php +++ b/src/Contrib/Zipkin/Exporter.php @@ -41,6 +41,7 @@ protected function serializeTrace(iterable $spans): string ); } + #[\Override] public function export(iterable $batch, ?CancellationInterface $cancellation = null): FutureInterface { return $this->transport @@ -53,11 +54,13 @@ public function export(iterable $batch, ?CancellationInterface $cancellation = n }); } + #[\Override] public function shutdown(?CancellationInterface $cancellation = null): bool { return $this->transport->shutdown($cancellation); } + #[\Override] public function forceFlush(?CancellationInterface $cancellation = null): bool { return $this->transport->forceFlush($cancellation); diff --git a/src/Contrib/Zipkin/SpanConverter.php b/src/Contrib/Zipkin/SpanConverter.php index e8a7d3045..732cb7f69 100644 --- a/src/Contrib/Zipkin/SpanConverter.php +++ b/src/Contrib/Zipkin/SpanConverter.php @@ -74,6 +74,7 @@ private function sanitiseTagValue($value): string return (string) $value; } + #[\Override] public function convert(iterable $spans): array { $aggregate = []; diff --git a/src/Contrib/Zipkin/SpanExporterFactory.php b/src/Contrib/Zipkin/SpanExporterFactory.php index 0714d48da..35e9fb1b5 100644 --- a/src/Contrib/Zipkin/SpanExporterFactory.php +++ b/src/Contrib/Zipkin/SpanExporterFactory.php @@ -12,6 +12,7 @@ class SpanExporterFactory implements SpanExporterFactoryInterface { + #[\Override] public function create(): SpanExporterInterface { $endpoint = Configuration::getString(Variables::OTEL_EXPORTER_ZIPKIN_ENDPOINT); diff --git a/src/Extension/Propagator/B3/B3MultiPropagator.php b/src/Extension/Propagator/B3/B3MultiPropagator.php index 5d4afbed9..eb29c9952 100644 --- a/src/Extension/Propagator/B3/B3MultiPropagator.php +++ b/src/Extension/Propagator/B3/B3MultiPropagator.php @@ -97,12 +97,14 @@ public static function getInstance(): self } /** {@inheritdoc} */ + #[\Override] public function fields(): array { return self::FIELDS; } /** {@inheritdoc} */ + #[\Override] public function inject(&$carrier, ?PropagationSetterInterface $setter = null, ?ContextInterface $context = null): void { $setter ??= ArrayAccessGetterSetter::getInstance(); @@ -125,6 +127,7 @@ public function inject(&$carrier, ?PropagationSetterInterface $setter = null, ?C } } + #[\Override] public function extract($carrier, ?PropagationGetterInterface $getter = null, ?ContextInterface $context = null): ContextInterface { $getter ??= ArrayAccessGetterSetter::getInstance(); diff --git a/src/Extension/Propagator/B3/B3Propagator.php b/src/Extension/Propagator/B3/B3Propagator.php index 0d8c720dc..3a062deca 100644 --- a/src/Extension/Propagator/B3/B3Propagator.php +++ b/src/Extension/Propagator/B3/B3Propagator.php @@ -36,18 +36,21 @@ public static function getB3MultiHeaderInstance(): self } /** {@inheritdoc} */ + #[\Override] public function fields(): array { return $this->propagator->fields(); } /** {@inheritdoc} */ + #[\Override] public function inject(&$carrier, ?PropagationSetterInterface $setter = null, ?ContextInterface $context = null): void { $this->propagator->inject($carrier, $setter, $context); } /** {@inheritdoc} */ + #[\Override] public function extract($carrier, ?PropagationGetterInterface $getter = null, ?ContextInterface $context = null): ContextInterface { $getter ??= ArrayAccessGetterSetter::getInstance(); diff --git a/src/Extension/Propagator/B3/B3SinglePropagator.php b/src/Extension/Propagator/B3/B3SinglePropagator.php index 7b9ab1ed0..c9f408214 100644 --- a/src/Extension/Propagator/B3/B3SinglePropagator.php +++ b/src/Extension/Propagator/B3/B3SinglePropagator.php @@ -49,12 +49,14 @@ public static function getInstance(): self } /** {@inheritdoc} */ + #[\Override] public function fields(): array { return self::FIELDS; } /** {@inheritdoc} */ + #[\Override] public function inject(&$carrier, ?PropagationSetterInterface $setter = null, ?ContextInterface $context = null): void { $setter ??= ArrayAccessGetterSetter::getInstance(); @@ -78,6 +80,7 @@ public function inject(&$carrier, ?PropagationSetterInterface $setter = null, ?C } /** {@inheritdoc} */ + #[\Override] public function extract($carrier, ?PropagationGetterInterface $getter = null, ?ContextInterface $context = null): ContextInterface { $getter ??= ArrayAccessGetterSetter::getInstance(); diff --git a/src/Extension/Propagator/CloudTrace/CloudTracePropagator.php b/src/Extension/Propagator/CloudTrace/CloudTracePropagator.php index 7a53e3f12..8b1bc7b1c 100644 --- a/src/Extension/Propagator/CloudTrace/CloudTracePropagator.php +++ b/src/Extension/Propagator/CloudTrace/CloudTracePropagator.php @@ -51,12 +51,14 @@ private function __construct(private readonly bool $oneWay) } /** {@inheritdoc} */ + #[\Override] public function fields(): array { return self::FIELDS; } /** {@inheritdoc} */ + #[\Override] public function inject(&$carrier, ?PropagationSetterInterface $setter = null, ?ContextInterface $context = null): void { if ($this->oneWay) { @@ -76,6 +78,7 @@ public function inject(&$carrier, ?PropagationSetterInterface $setter = null, ?C } /** {@inheritdoc} */ + #[\Override] public function extract($carrier, ?PropagationGetterInterface $getter = null, ?ContextInterface $context = null): ContextInterface { $getter ??= ArrayAccessGetterSetter::getInstance(); diff --git a/src/Extension/Propagator/Jaeger/JaegerBaggagePropagator.php b/src/Extension/Propagator/Jaeger/JaegerBaggagePropagator.php index dd53b2238..48eeec1ca 100644 --- a/src/Extension/Propagator/Jaeger/JaegerBaggagePropagator.php +++ b/src/Extension/Propagator/Jaeger/JaegerBaggagePropagator.php @@ -33,12 +33,14 @@ public static function getInstance(): TextMapPropagatorInterface return self::$instance; } + #[\Override] public function fields(): array { return []; } /** {@inheritdoc} */ + #[\Override] public function inject(&$carrier, ?PropagationSetterInterface $setter = null, ?ContextInterface $context = null): void { $setter ??= ArrayAccessGetterSetter::getInstance(); @@ -59,6 +61,7 @@ public function inject(&$carrier, ?PropagationSetterInterface $setter = null, ?C } /** {@inheritdoc} */ + #[\Override] public function extract($carrier, ?PropagationGetterInterface $getter = null, ?ContextInterface $context = null): ContextInterface { $getter ??= ArrayAccessGetterSetter::getInstance(); diff --git a/src/Extension/Propagator/Jaeger/JaegerPropagator.php b/src/Extension/Propagator/Jaeger/JaegerPropagator.php index 31cdcd576..f3768ad59 100644 --- a/src/Extension/Propagator/Jaeger/JaegerPropagator.php +++ b/src/Extension/Propagator/Jaeger/JaegerPropagator.php @@ -45,12 +45,14 @@ public static function getInstance(): TextMapPropagatorInterface return self::$instance; } + #[\Override] public function fields(): array { return self::FIELDS; } /** {@inheritdoc} */ + #[\Override] public function inject(&$carrier, ?PropagationSetterInterface $setter = null, ?ContextInterface $context = null): void { $setter ??= ArrayAccessGetterSetter::getInstance(); @@ -75,6 +77,7 @@ public function inject(&$carrier, ?PropagationSetterInterface $setter = null, ?C } /** {@inheritdoc} */ + #[\Override] public function extract($carrier, ?PropagationGetterInterface $getter = null, ?ContextInterface $context = null): ContextInterface { $getter ??= ArrayAccessGetterSetter::getInstance(); diff --git a/src/SDK/Common/Adapter/HttpDiscovery/DependencyResolver.php b/src/SDK/Common/Adapter/HttpDiscovery/DependencyResolver.php index 7589d6b05..d1771f9f1 100644 --- a/src/SDK/Common/Adapter/HttpDiscovery/DependencyResolver.php +++ b/src/SDK/Common/Adapter/HttpDiscovery/DependencyResolver.php @@ -41,41 +41,49 @@ public static function create( return new self($messageFactoryResolver, $psrClientResolver, $httpPlugClientResolver); } + #[\Override] public function resolveRequestFactory(): RequestFactoryInterface { return $this->messageFactoryResolver->resolveRequestFactory(); } + #[\Override] public function resolveResponseFactory(): ResponseFactoryInterface { return $this->messageFactoryResolver->resolveResponseFactory(); } + #[\Override] public function resolveServerRequestFactory(): ServerRequestFactoryInterface { return $this->messageFactoryResolver->resolveServerRequestFactory(); } + #[\Override] public function resolveStreamFactory(): StreamFactoryInterface { return $this->messageFactoryResolver->resolveStreamFactory(); } + #[\Override] public function resolveUploadedFileFactory(): UploadedFileFactoryInterface { return $this->messageFactoryResolver->resolveUploadedFileFactory(); } + #[\Override] public function resolveUriFactory(): UriFactoryInterface { return $this->messageFactoryResolver->resolveUriFactory(); } + #[\Override] public function resolveHttpPlugAsyncClient(): HttpAsyncClient { return $this->httpPlugClientResolver->resolveHttpPlugAsyncClient(); } + #[\Override] public function resolvePsrClient(): ClientInterface { return $this->psrClientResolver->resolvePsrClient(); diff --git a/src/SDK/Common/Adapter/HttpDiscovery/HttpPlugClientResolver.php b/src/SDK/Common/Adapter/HttpDiscovery/HttpPlugClientResolver.php index d297a1b13..14a4cebab 100644 --- a/src/SDK/Common/Adapter/HttpDiscovery/HttpPlugClientResolver.php +++ b/src/SDK/Common/Adapter/HttpDiscovery/HttpPlugClientResolver.php @@ -19,6 +19,7 @@ public static function create(?HttpAsyncClient $httpAsyncClient = null): self return new self($httpAsyncClient); } + #[\Override] public function resolveHttpPlugAsyncClient(): HttpAsyncClient { return $this->httpAsyncClient ??= HttpAsyncClientDiscovery::find(); diff --git a/src/SDK/Common/Adapter/HttpDiscovery/MessageFactoryResolver.php b/src/SDK/Common/Adapter/HttpDiscovery/MessageFactoryResolver.php index ae4028b61..eac21b370 100644 --- a/src/SDK/Common/Adapter/HttpDiscovery/MessageFactoryResolver.php +++ b/src/SDK/Common/Adapter/HttpDiscovery/MessageFactoryResolver.php @@ -43,31 +43,37 @@ public static function create( ); } + #[\Override] public function resolveRequestFactory(): RequestFactoryInterface { return $this->requestFactory ??= Psr17FactoryDiscovery::findRequestFactory(); } + #[\Override] public function resolveResponseFactory(): ResponseFactoryInterface { return $this->responseFactory ??= Psr17FactoryDiscovery::findResponseFactory(); } + #[\Override] public function resolveServerRequestFactory(): ServerRequestFactoryInterface { return $this->serverRequestFactory ??= Psr17FactoryDiscovery::findServerRequestFactory(); } + #[\Override] public function resolveStreamFactory(): StreamFactoryInterface { return $this->streamFactory ??= Psr17FactoryDiscovery::findStreamFactory(); } + #[\Override] public function resolveUploadedFileFactory(): UploadedFileFactoryInterface { return $this->uploadedFileFactory ??= Psr17FactoryDiscovery::findUploadedFileFactory(); } + #[\Override] public function resolveUriFactory(): UriFactoryInterface { return $this->uriFactory ??= Psr17FactoryDiscovery::findUriFactory(); diff --git a/src/SDK/Common/Adapter/HttpDiscovery/PsrClientResolver.php b/src/SDK/Common/Adapter/HttpDiscovery/PsrClientResolver.php index 1a362c91d..250d83825 100644 --- a/src/SDK/Common/Adapter/HttpDiscovery/PsrClientResolver.php +++ b/src/SDK/Common/Adapter/HttpDiscovery/PsrClientResolver.php @@ -19,6 +19,7 @@ public static function create(?ClientInterface $client = null): self return new self($client); } + #[\Override] public function resolvePsrClient(): ClientInterface { return $this->client ??= Psr18ClientDiscovery::find(); diff --git a/src/SDK/Common/Attribute/AttributeValidator.php b/src/SDK/Common/Attribute/AttributeValidator.php index e9a1f7334..3fa3f08e4 100644 --- a/src/SDK/Common/Attribute/AttributeValidator.php +++ b/src/SDK/Common/Attribute/AttributeValidator.php @@ -21,6 +21,7 @@ class AttributeValidator implements AttributeValidatorInterface * Validate whether a value is a primitive, or a homogeneous array of primitives (treating int/double as equivalent). * @see https://github.com/open-telemetry/opentelemetry-specification/blob/v1.21.0/specification/common/README.md#attribute */ + #[\Override] public function validate($value): bool { if (is_array($value)) { @@ -51,6 +52,7 @@ private function validateArray(array $value): bool return true; } + #[\Override] public function getInvalidMessage(): string { return 'attribute with non-primitive or non-homogeneous array of primitives dropped'; diff --git a/src/SDK/Common/Attribute/Attributes.php b/src/SDK/Common/Attribute/Attributes.php index 1df6a92a1..599bb7c7b 100644 --- a/src/SDK/Common/Attribute/Attributes.php +++ b/src/SDK/Common/Attribute/Attributes.php @@ -33,27 +33,32 @@ public static function factory(?int $attributeCountLimit = null, ?int $attribute return new AttributesFactory($attributeCountLimit, $attributeValueLengthLimit); } + #[\Override] public function has(string $name): bool { return array_key_exists($name, $this->attributes); } + #[\Override] public function get(string $name) { return $this->attributes[$name] ?? null; } /** @psalm-mutation-free */ + #[\Override] public function count(): int { return \count($this->attributes); } + #[\Override] public function jsonSerialize(): mixed { return $this->attributes; } + #[\Override] public function getIterator(): Traversable { foreach ($this->attributes as $key => $value) { @@ -61,11 +66,13 @@ public function getIterator(): Traversable } } + #[\Override] public function toArray(): array { return $this->attributes; } + #[\Override] public function getDroppedAttributesCount(): int { return $this->droppedAttributesCount; diff --git a/src/SDK/Common/Attribute/AttributesBuilder.php b/src/SDK/Common/Attribute/AttributesBuilder.php index 06674389b..e7a3fb984 100644 --- a/src/SDK/Common/Attribute/AttributesBuilder.php +++ b/src/SDK/Common/Attribute/AttributesBuilder.php @@ -22,11 +22,13 @@ public function __construct(private array $attributes, private ?int $attributeCo { } + #[\Override] public function build(): AttributesInterface { return new Attributes($this->attributes, $this->droppedAttributesCount); } + #[\Override] public function merge(AttributesInterface $old, AttributesInterface $updating): AttributesInterface { $new = $old->toArray(); @@ -42,6 +44,7 @@ public function merge(AttributesInterface $old, AttributesInterface $updating): return new Attributes($new, $dropped); } + #[\Override] public function offsetExists($offset): bool { return array_key_exists($offset, $this->attributes); @@ -50,6 +53,7 @@ public function offsetExists($offset): bool /** * @phan-suppress PhanUndeclaredClassAttribute */ + #[\Override] public function offsetGet($offset): mixed { return $this->attributes[$offset] ?? null; @@ -58,6 +62,7 @@ public function offsetGet($offset): mixed /** * @phan-suppress PhanUndeclaredClassAttribute */ + #[\Override] public function offsetSet($offset, $value): void { if ($offset === null) { @@ -86,6 +91,7 @@ public function offsetSet($offset, $value): void /** * @phan-suppress PhanUndeclaredClassAttribute */ + #[\Override] public function offsetUnset($offset): void { unset($this->attributes[$offset]); diff --git a/src/SDK/Common/Attribute/AttributesFactory.php b/src/SDK/Common/Attribute/AttributesFactory.php index c868efd5e..2e9eb2640 100644 --- a/src/SDK/Common/Attribute/AttributesFactory.php +++ b/src/SDK/Common/Attribute/AttributesFactory.php @@ -15,6 +15,7 @@ public function __construct( ) { } + #[\Override] public function builder(iterable $attributes = [], ?AttributeValidatorInterface $attributeValidator = null): AttributesBuilderInterface { $builder = new AttributesBuilder( diff --git a/src/SDK/Common/Attribute/LogRecordAttributeValidator.php b/src/SDK/Common/Attribute/LogRecordAttributeValidator.php index a09d26372..ecac01b3d 100644 --- a/src/SDK/Common/Attribute/LogRecordAttributeValidator.php +++ b/src/SDK/Common/Attribute/LogRecordAttributeValidator.php @@ -6,11 +6,13 @@ class LogRecordAttributeValidator implements AttributeValidatorInterface { + #[\Override] public function validate($value): bool { return true; } + #[\Override] public function getInvalidMessage(): string { //not required as this validator always returns true diff --git a/src/SDK/Common/Configuration/EnvComponentLoaderRegistry.php b/src/SDK/Common/Configuration/EnvComponentLoaderRegistry.php index d9d2ce472..92cd51773 100644 --- a/src/SDK/Common/Configuration/EnvComponentLoaderRegistry.php +++ b/src/SDK/Common/Configuration/EnvComponentLoaderRegistry.php @@ -41,6 +41,7 @@ public function register(EnvComponentLoader $loader): EnvComponentLoaderRegistry return $this; } + #[\Override] public function load(string $type, string $name, EnvResolver $env, Context $context): mixed { if (!$loader = $this->loaders[$type][$name] ?? null) { diff --git a/src/SDK/Common/Configuration/EnvResolver.php b/src/SDK/Common/Configuration/EnvResolver.php index b8c8ca8c3..89bc3cde4 100644 --- a/src/SDK/Common/Configuration/EnvResolver.php +++ b/src/SDK/Common/Configuration/EnvResolver.php @@ -11,6 +11,7 @@ */ final class EnvResolver implements \OpenTelemetry\API\Configuration\ConfigEnv\EnvResolver { + #[\Override] public function string(string $name): ?string { if (!Configuration::has($name)) { @@ -20,6 +21,7 @@ public function string(string $name): ?string return Configuration::getString($name); } + #[\Override] public function enum(string $name, array $values): ?string { if (!Configuration::has($name)) { @@ -34,6 +36,7 @@ public function enum(string $name, array $values): ?string return $value; } + #[\Override] public function bool(string $name): ?bool { if (!Configuration::has($name)) { @@ -43,6 +46,7 @@ public function bool(string $name): ?bool return Configuration::getBoolean($name); } + #[\Override] public function int(string $name, ?int $min = 0, ?int $max = ~(-1 << 31)): int|null { if (!Configuration::has($name)) { @@ -57,6 +61,7 @@ public function int(string $name, ?int $min = 0, ?int $max = ~(-1 << 31)): int|n return $value; } + #[\Override] public function numeric(string $name, float|int|null $min = 0, float|int|null $max = ~(-1 << 31)): float|int|null { if (!Configuration::has($name)) { @@ -71,6 +76,7 @@ public function numeric(string $name, float|int|null $min = 0, float|int|null $m return $value; } + #[\Override] public function list(string $name): ?array { if (!Configuration::has($name)) { @@ -83,6 +89,7 @@ public function list(string $name): ?array return $value; } + #[\Override] public function map(string $name): ?array { if (!Configuration::has($name)) { diff --git a/src/SDK/Common/Configuration/Resolver/EnvironmentResolver.php b/src/SDK/Common/Configuration/Resolver/EnvironmentResolver.php index 453f98e39..91f83879a 100644 --- a/src/SDK/Common/Configuration/Resolver/EnvironmentResolver.php +++ b/src/SDK/Common/Configuration/Resolver/EnvironmentResolver.php @@ -11,6 +11,7 @@ */ class EnvironmentResolver implements ResolverInterface { + #[\Override] public function hasVariable(string $variableName): bool { if (!Configuration::isEmpty($_SERVER[$variableName] ?? null)) { @@ -28,6 +29,7 @@ public function hasVariable(string $variableName): bool * @psalm-suppress InvalidReturnStatement * @psalm-suppress InvalidReturnType */ + #[\Override] public function retrieveValue(string $variableName) { $value = getenv($variableName); diff --git a/src/SDK/Common/Configuration/Resolver/PhpIniResolver.php b/src/SDK/Common/Configuration/Resolver/PhpIniResolver.php index 29445dd88..be171f7e0 100644 --- a/src/SDK/Common/Configuration/Resolver/PhpIniResolver.php +++ b/src/SDK/Common/Configuration/Resolver/PhpIniResolver.php @@ -16,6 +16,7 @@ public function __construct(private readonly PhpIniAccessor $accessor = new PhpI { } + #[\Override] public function retrieveValue(string $variableName) { $value = $this->accessor->get($variableName) ?: ''; @@ -26,6 +27,7 @@ public function retrieveValue(string $variableName) return $value; } + #[\Override] public function hasVariable(string $variableName): bool { $value = $this->accessor->get($variableName); diff --git a/src/SDK/Common/Export/Http/PsrTransport.php b/src/SDK/Common/Export/Http/PsrTransport.php index ef3ab02b4..0ca720b4a 100644 --- a/src/SDK/Common/Export/Http/PsrTransport.php +++ b/src/SDK/Common/Export/Http/PsrTransport.php @@ -48,6 +48,7 @@ public function __construct( ) { } + #[\Override] public function contentType(): string { return $this->contentType; @@ -56,6 +57,7 @@ public function contentType(): string /** * @psalm-suppress ArgumentTypeCoercion */ + #[\Override] public function send(string $payload, ?CancellationInterface $cancellation = null): FutureInterface { if ($this->closed) { @@ -136,6 +138,7 @@ private static function parseContentEncoding(ResponseInterface $response): array return $encodings; } + #[\Override] public function shutdown(?CancellationInterface $cancellation = null): bool { if ($this->closed) { @@ -147,6 +150,7 @@ public function shutdown(?CancellationInterface $cancellation = null): bool return true; } + #[\Override] public function forceFlush(?CancellationInterface $cancellation = null): bool { return !$this->closed; diff --git a/src/SDK/Common/Export/Http/PsrTransportFactory.php b/src/SDK/Common/Export/Http/PsrTransportFactory.php index 23e5dcae3..9fbd43906 100644 --- a/src/SDK/Common/Export/Http/PsrTransportFactory.php +++ b/src/SDK/Common/Export/Http/PsrTransportFactory.php @@ -28,6 +28,7 @@ public function __construct( /** * @phan-suppress PhanTypeMismatchArgumentNullable */ + #[\Override] public function create( string $endpoint, string $contentType, diff --git a/src/SDK/Common/Export/Stream/StreamTransport.php b/src/SDK/Common/Export/Stream/StreamTransport.php index 6b3bf6351..f7c3f21df 100644 --- a/src/SDK/Common/Export/Stream/StreamTransport.php +++ b/src/SDK/Common/Export/Stream/StreamTransport.php @@ -38,11 +38,13 @@ public function __construct( ) { } + #[\Override] public function contentType(): string { return $this->contentType; } + #[\Override] public function send(string $payload, ?CancellationInterface $cancellation = null): FutureInterface { if (!$this->stream) { @@ -68,6 +70,7 @@ public function send(string $payload, ?CancellationInterface $cancellation = nul return new CompletedFuture(null); } + #[\Override] public function shutdown(?CancellationInterface $cancellation = null): bool { if (!$this->stream) { @@ -80,6 +83,7 @@ public function shutdown(?CancellationInterface $cancellation = null): bool return $flush; } + #[\Override] public function forceFlush(?CancellationInterface $cancellation = null): bool { if (!$this->stream) { diff --git a/src/SDK/Common/Export/Stream/StreamTransportFactory.php b/src/SDK/Common/Export/Stream/StreamTransportFactory.php index c6544bbe5..3acd11a68 100644 --- a/src/SDK/Common/Export/Stream/StreamTransportFactory.php +++ b/src/SDK/Common/Export/Stream/StreamTransportFactory.php @@ -31,6 +31,7 @@ final class StreamTransportFactory implements TransportFactoryInterface * @psalm-return TransportInterface * @throws ErrorException */ + #[\Override] public function create( $endpoint, string $contentType, diff --git a/src/SDK/Common/Future/CompletedFuture.php b/src/SDK/Common/Future/CompletedFuture.php index b6e01c41f..c3b8b26b0 100644 --- a/src/SDK/Common/Future/CompletedFuture.php +++ b/src/SDK/Common/Future/CompletedFuture.php @@ -20,11 +20,13 @@ public function __construct(private $value) { } + #[\Override] public function await() { return $this->value; } + #[\Override] public function map(Closure $closure): FutureInterface { $c = $closure; @@ -37,6 +39,7 @@ public function map(Closure $closure): FutureInterface } } + #[\Override] public function catch(Closure $closure): FutureInterface { return $this; diff --git a/src/SDK/Common/Future/ErrorFuture.php b/src/SDK/Common/Future/ErrorFuture.php index 90e3f5495..f2a45a641 100644 --- a/src/SDK/Common/Future/ErrorFuture.php +++ b/src/SDK/Common/Future/ErrorFuture.php @@ -16,16 +16,19 @@ public function __construct(private readonly Throwable $throwable) { } + #[\Override] public function await(): never { throw $this->throwable; } + #[\Override] public function map(Closure $closure): FutureInterface { return $this; } + #[\Override] public function catch(Closure $closure): FutureInterface { $c = $closure; diff --git a/src/SDK/Common/Future/NullCancellation.php b/src/SDK/Common/Future/NullCancellation.php index 5e5b642f9..b91354534 100644 --- a/src/SDK/Common/Future/NullCancellation.php +++ b/src/SDK/Common/Future/NullCancellation.php @@ -8,11 +8,13 @@ final class NullCancellation implements CancellationInterface { + #[\Override] public function subscribe(Closure $callback): string { return self::class; } + #[\Override] public function unsubscribe(string $id): void { // no-op diff --git a/src/SDK/Common/Http/Psr/Client/Discovery/Buzz.php b/src/SDK/Common/Http/Psr/Client/Discovery/Buzz.php index 14733e859..ba7c857cd 100644 --- a/src/SDK/Common/Http/Psr/Client/Discovery/Buzz.php +++ b/src/SDK/Common/Http/Psr/Client/Discovery/Buzz.php @@ -13,6 +13,7 @@ class Buzz implements DiscoveryInterface /** * @phan-suppress PhanUndeclaredClassReference */ + #[\Override] public function available(): bool { return class_exists(FileGetContents::class); @@ -21,6 +22,7 @@ public function available(): bool /** * @phan-suppress PhanUndeclaredClassReference,PhanTypeMismatchReturn,PhanUndeclaredClassMethod */ + #[\Override] public function create(mixed $options): ClientInterface { return new FileGetContents(Psr17FactoryDiscovery::findResponseFactory(), $options); diff --git a/src/SDK/Common/Http/Psr/Client/Discovery/CurlClient.php b/src/SDK/Common/Http/Psr/Client/Discovery/CurlClient.php index 390d56e4b..18da87027 100644 --- a/src/SDK/Common/Http/Psr/Client/Discovery/CurlClient.php +++ b/src/SDK/Common/Http/Psr/Client/Discovery/CurlClient.php @@ -12,6 +12,7 @@ class CurlClient implements DiscoveryInterface /** * @phan-suppress PhanUndeclaredClassReference */ + #[\Override] public function available(): bool { return extension_loaded('curl') && class_exists(Client::class); @@ -21,6 +22,7 @@ public function available(): bool * @phan-suppress PhanUndeclaredClassReference,PhanTypeMismatchReturn,PhanUndeclaredClassMethod * @psalm-suppress UndefinedClass,InvalidReturnType,InvalidReturnStatement */ + #[\Override] public function create(mixed $options): ClientInterface { $options = [ diff --git a/src/SDK/Common/Http/Psr/Client/Discovery/Guzzle.php b/src/SDK/Common/Http/Psr/Client/Discovery/Guzzle.php index d87367416..fc2621fdc 100644 --- a/src/SDK/Common/Http/Psr/Client/Discovery/Guzzle.php +++ b/src/SDK/Common/Http/Psr/Client/Discovery/Guzzle.php @@ -9,11 +9,13 @@ class Guzzle implements DiscoveryInterface { + #[\Override] public function available(): bool { return class_exists(Client::class) && is_a(Client::class, ClientInterface::class, true); } + #[\Override] public function create(mixed $options): ClientInterface { return new Client($options); diff --git a/src/SDK/Common/Http/Psr/Client/Discovery/Symfony.php b/src/SDK/Common/Http/Psr/Client/Discovery/Symfony.php index dcc05884b..da9a414ff 100644 --- a/src/SDK/Common/Http/Psr/Client/Discovery/Symfony.php +++ b/src/SDK/Common/Http/Psr/Client/Discovery/Symfony.php @@ -13,6 +13,7 @@ class Symfony implements DiscoveryInterface /** * @phan-suppress PhanUndeclaredClassReference */ + #[\Override] public function available(): bool { return class_exists(HttpClient::class) && class_exists(Psr18Client::class); @@ -21,6 +22,7 @@ public function available(): bool /** * @phan-suppress PhanTypeMismatchReturn,PhanUndeclaredClassMethod */ + #[\Override] public function create(mixed $options): ClientInterface { if (is_array($options) && array_key_exists('timeout', $options)) { diff --git a/src/SDK/Common/Http/Psr/Message/MessageFactory.php b/src/SDK/Common/Http/Psr/Message/MessageFactory.php index 87e662f79..7ae7f4259 100644 --- a/src/SDK/Common/Http/Psr/Message/MessageFactory.php +++ b/src/SDK/Common/Http/Psr/Message/MessageFactory.php @@ -28,16 +28,19 @@ public static function create( return new self($requestFactory, $responseFactory, $serverRequestFactory); } + #[\Override] public function createRequest(string $method, $uri): RequestInterface { return $this->requestFactory->createRequest($method, $uri); } + #[\Override] public function createResponse(int $code = 200, string $reasonPhrase = ''): ResponseInterface { return $this->responseFactory->createResponse($code, $reasonPhrase); } + #[\Override] public function createServerRequest(string $method, $uri, array $serverParams = []): ServerRequestInterface { return $this->serverRequestFactory->createServerRequest($method, $uri, $serverParams); diff --git a/src/SDK/Common/Instrumentation/InstrumentationScope.php b/src/SDK/Common/Instrumentation/InstrumentationScope.php index eeb2eaf05..5bb2c6a2e 100644 --- a/src/SDK/Common/Instrumentation/InstrumentationScope.php +++ b/src/SDK/Common/Instrumentation/InstrumentationScope.php @@ -19,21 +19,25 @@ public function __construct( ) { } + #[\Override] public function getName(): string { return $this->name; } + #[\Override] public function getVersion(): ?string { return $this->version; } + #[\Override] public function getSchemaUrl(): ?string { return $this->schemaUrl; } + #[\Override] public function getAttributes(): AttributesInterface { return $this->attributes; diff --git a/src/SDK/Common/Instrumentation/InstrumentationScopeFactory.php b/src/SDK/Common/Instrumentation/InstrumentationScopeFactory.php index e4b5fbbb0..c08b442cd 100644 --- a/src/SDK/Common/Instrumentation/InstrumentationScopeFactory.php +++ b/src/SDK/Common/Instrumentation/InstrumentationScopeFactory.php @@ -12,6 +12,7 @@ public function __construct(private readonly AttributesFactoryInterface $attribu { } + #[\Override] public function create( string $name, ?string $version = null, diff --git a/src/SDK/Logs/EventLogger.php b/src/SDK/Logs/EventLogger.php index 1e65c4d63..5ffbdddf3 100644 --- a/src/SDK/Logs/EventLogger.php +++ b/src/SDK/Logs/EventLogger.php @@ -30,6 +30,7 @@ public function __construct( /** * @see https://github.com/open-telemetry/opentelemetry-specification/blob/v1.32.0/specification/logs/event-sdk.md#emit-event */ + #[\Override] public function emit( string $name, mixed $body = null, diff --git a/src/SDK/Logs/EventLoggerProvider.php b/src/SDK/Logs/EventLoggerProvider.php index fa7cdc1e4..31127391a 100644 --- a/src/SDK/Logs/EventLoggerProvider.php +++ b/src/SDK/Logs/EventLoggerProvider.php @@ -19,6 +19,7 @@ public function __construct(private readonly LoggerProviderInterface $loggerProv /** * @phan-suppress PhanDeprecatedClass */ + #[\Override] public function getEventLogger(string $name, ?string $version = null, ?string $schemaUrl = null, iterable $attributes = []): EventLoggerInterface { return new EventLogger( @@ -27,6 +28,7 @@ public function getEventLogger(string $name, ?string $version = null, ?string $s ); } + #[\Override] public function forceFlush(): bool { return $this->loggerProvider->forceFlush(); diff --git a/src/SDK/Logs/Exporter/ConsoleExporter.php b/src/SDK/Logs/Exporter/ConsoleExporter.php index bdda9859f..63170da19 100644 --- a/src/SDK/Logs/Exporter/ConsoleExporter.php +++ b/src/SDK/Logs/Exporter/ConsoleExporter.php @@ -26,6 +26,7 @@ public function __construct(private readonly TransportInterface $transport) /** * @param iterable $batch */ + #[\Override] public function export(iterable $batch, ?CancellationInterface $cancellation = null): FutureInterface { $resource = null; @@ -49,11 +50,13 @@ public function export(iterable $batch, ?CancellationInterface $cancellation = n return new CompletedFuture(true); } + #[\Override] public function forceFlush(?CancellationInterface $cancellation = null): bool { return true; } + #[\Override] public function shutdown(?CancellationInterface $cancellation = null): bool { return true; diff --git a/src/SDK/Logs/Exporter/ConsoleExporterFactory.php b/src/SDK/Logs/Exporter/ConsoleExporterFactory.php index a959540a0..f12e9ab93 100644 --- a/src/SDK/Logs/Exporter/ConsoleExporterFactory.php +++ b/src/SDK/Logs/Exporter/ConsoleExporterFactory.php @@ -10,6 +10,7 @@ class ConsoleExporterFactory implements LogRecordExporterFactoryInterface { + #[\Override] public function create(): LogRecordExporterInterface { $transport = Registry::transportFactory('stream')->create('php://stdout', 'application/json'); diff --git a/src/SDK/Logs/Exporter/InMemoryExporter.php b/src/SDK/Logs/Exporter/InMemoryExporter.php index 3ecaecd3d..3ccf36a57 100644 --- a/src/SDK/Logs/Exporter/InMemoryExporter.php +++ b/src/SDK/Logs/Exporter/InMemoryExporter.php @@ -19,6 +19,7 @@ public function __construct(private readonly ArrayObject $storage = new ArrayObj /** * @inheritDoc */ + #[\Override] public function export(iterable $batch, ?CancellationInterface $cancellation = null): FutureInterface { foreach ($batch as $record) { @@ -28,11 +29,13 @@ public function export(iterable $batch, ?CancellationInterface $cancellation = n return new CompletedFuture(true); } + #[\Override] public function forceFlush(?CancellationInterface $cancellation = null): bool { return true; } + #[\Override] public function shutdown(?CancellationInterface $cancellation = null): bool { return true; diff --git a/src/SDK/Logs/Exporter/InMemoryExporterFactory.php b/src/SDK/Logs/Exporter/InMemoryExporterFactory.php index b61a339ce..3052cabf4 100644 --- a/src/SDK/Logs/Exporter/InMemoryExporterFactory.php +++ b/src/SDK/Logs/Exporter/InMemoryExporterFactory.php @@ -10,6 +10,7 @@ class InMemoryExporterFactory implements LogRecordExporterFactoryInterface { + #[\Override] public function create(): LogRecordExporterInterface { return new InMemoryExporter(InMemoryStorageManager::logs()); diff --git a/src/SDK/Logs/Exporter/NoopExporter.php b/src/SDK/Logs/Exporter/NoopExporter.php index 8eeff62bd..eb7c234e0 100644 --- a/src/SDK/Logs/Exporter/NoopExporter.php +++ b/src/SDK/Logs/Exporter/NoopExporter.php @@ -11,16 +11,19 @@ class NoopExporter implements LogRecordExporterInterface { + #[\Override] public function export(iterable $batch, ?CancellationInterface $cancellation = null): FutureInterface { return new CompletedFuture(true); } + #[\Override] public function forceFlush(?CancellationInterface $cancellation = null): bool { return true; } + #[\Override] public function shutdown(?CancellationInterface $cancellation = null): bool { return true; diff --git a/src/SDK/Logs/Logger.php b/src/SDK/Logs/Logger.php index 471113620..026f3c822 100644 --- a/src/SDK/Logs/Logger.php +++ b/src/SDK/Logs/Logger.php @@ -31,6 +31,7 @@ public function __construct( /** * @see https://github.com/open-telemetry/opentelemetry-specification/blob/v1.44.0/specification/logs/api.md#emit-a-logrecord */ + #[\Override] public function emit(LogRecord $logRecord): void { //If a Logger is disabled, it MUST behave equivalently to No-op Logger. @@ -53,6 +54,7 @@ public function emit(LogRecord $logRecord): void /** * @see https://github.com/open-telemetry/opentelemetry-specification/blob/v1.44.0/specification/logs/api.md#enabled */ + #[\Override] public function isEnabled(?ContextInterface $context = null, ?int $severityNumber = null, ?string $eventName = null): bool { return $this->config->isEnabled(); diff --git a/src/SDK/Logs/LoggerProvider.php b/src/SDK/Logs/LoggerProvider.php index c9ab27824..3ded14d52 100644 --- a/src/SDK/Logs/LoggerProvider.php +++ b/src/SDK/Logs/LoggerProvider.php @@ -38,6 +38,7 @@ public function __construct( /** * @see https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/logs/sdk.md#logger-creation */ + #[\Override] public function getLogger(string $name, ?string $version = null, ?string $schemaUrl = null, iterable $attributes = []): LoggerInterface { if ($this->loggerSharedState->hasShutdown()) { @@ -50,11 +51,13 @@ public function getLogger(string $name, ?string $version = null, ?string $schema return $logger; } + #[\Override] public function shutdown(?CancellationInterface $cancellation = null): bool { return $this->loggerSharedState->shutdown($cancellation); } + #[\Override] public function forceFlush(?CancellationInterface $cancellation = null): bool { return $this->loggerSharedState->forceFlush($cancellation); @@ -70,6 +73,7 @@ public static function builder(): LoggerProviderBuilder * reconfigure all loggers created from the provider. * @experimental */ + #[\Override] public function updateConfigurator(Configurator $configurator): void { $this->configurator = $configurator; diff --git a/src/SDK/Logs/NoopEventLoggerProvider.php b/src/SDK/Logs/NoopEventLoggerProvider.php index a7edd0d6a..8b6f3932b 100644 --- a/src/SDK/Logs/NoopEventLoggerProvider.php +++ b/src/SDK/Logs/NoopEventLoggerProvider.php @@ -11,6 +11,7 @@ */ class NoopEventLoggerProvider extends API\NoopEventLoggerProvider implements EventLoggerProviderInterface { + #[\Override] public static function getInstance(): self { static $instance; @@ -18,6 +19,7 @@ public static function getInstance(): self return $instance ??= new self(); } + #[\Override] public function forceFlush(): bool { return true; diff --git a/src/SDK/Logs/NoopLoggerProvider.php b/src/SDK/Logs/NoopLoggerProvider.php index f27fad10d..362bb567e 100644 --- a/src/SDK/Logs/NoopLoggerProvider.php +++ b/src/SDK/Logs/NoopLoggerProvider.php @@ -17,21 +17,25 @@ public static function getInstance(): self return $instance ??= new self(); } + #[\Override] public function getLogger(string $name, ?string $version = null, ?string $schemaUrl = null, iterable $attributes = []): LoggerInterface { return NoopLogger::getInstance(); } + #[\Override] public function shutdown(): bool { return true; } + #[\Override] public function forceFlush(): bool { return true; } + #[\Override] public function updateConfigurator(Configurator $configurator): void { //no-op diff --git a/src/SDK/Logs/Processor/BatchLogRecordProcessor.php b/src/SDK/Logs/Processor/BatchLogRecordProcessor.php index 8de2d0f30..766979524 100644 --- a/src/SDK/Logs/Processor/BatchLogRecordProcessor.php +++ b/src/SDK/Logs/Processor/BatchLogRecordProcessor.php @@ -134,6 +134,7 @@ public function __construct( }); } + #[\Override] public function onEmit(ReadWriteLogRecord $record, ?ContextInterface $context = null): void { if ($this->closed) { @@ -158,6 +159,7 @@ public function onEmit(ReadWriteLogRecord $record, ?ContextInterface $context = } } + #[\Override] public function forceFlush(?CancellationInterface $cancellation = null): bool { if ($this->closed) { @@ -167,6 +169,7 @@ public function forceFlush(?CancellationInterface $cancellation = null): bool return $this->flush(__FUNCTION__, $cancellation); } + #[\Override] public function shutdown(?CancellationInterface $cancellation = null): bool { if ($this->closed) { diff --git a/src/SDK/Logs/Processor/MultiLogRecordProcessor.php b/src/SDK/Logs/Processor/MultiLogRecordProcessor.php index 6a5791f19..727be558a 100644 --- a/src/SDK/Logs/Processor/MultiLogRecordProcessor.php +++ b/src/SDK/Logs/Processor/MultiLogRecordProcessor.php @@ -22,6 +22,7 @@ public function __construct(array $processors) } } + #[\Override] public function onEmit(ReadWriteLogRecord $record, ?ContextInterface $context = null): void { foreach ($this->processors as $processor) { @@ -33,6 +34,7 @@ public function onEmit(ReadWriteLogRecord $record, ?ContextInterface $context = * Returns `true` if all processors shut down successfully, else `false` * Subsequent calls to `shutdown` are a no-op. */ + #[\Override] public function shutdown(?CancellationInterface $cancellation = null): bool { $result = true; @@ -48,6 +50,7 @@ public function shutdown(?CancellationInterface $cancellation = null): bool /** * Returns `true` if all processors flush successfully, else `false`. */ + #[\Override] public function forceFlush(?CancellationInterface $cancellation = null): bool { $result = true; diff --git a/src/SDK/Logs/Processor/NoopLogRecordProcessor.php b/src/SDK/Logs/Processor/NoopLogRecordProcessor.php index 7028052e1..6a7542e47 100644 --- a/src/SDK/Logs/Processor/NoopLogRecordProcessor.php +++ b/src/SDK/Logs/Processor/NoopLogRecordProcessor.php @@ -21,15 +21,18 @@ public static function getInstance(): self /** * @codeCoverageIgnore */ + #[\Override] public function onEmit(ReadWriteLogRecord $record, ?ContextInterface $context = null): void { } + #[\Override] public function shutdown(?CancellationInterface $cancellation = null): bool { return true; } + #[\Override] public function forceFlush(?CancellationInterface $cancellation = null): bool { return true; diff --git a/src/SDK/Logs/Processor/SimpleLogRecordProcessor.php b/src/SDK/Logs/Processor/SimpleLogRecordProcessor.php index 264a450ae..fa48a848b 100644 --- a/src/SDK/Logs/Processor/SimpleLogRecordProcessor.php +++ b/src/SDK/Logs/Processor/SimpleLogRecordProcessor.php @@ -19,16 +19,19 @@ public function __construct(private readonly LogRecordExporterInterface $exporte /** * @see https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/logs/sdk.md#onemit */ + #[\Override] public function onEmit(ReadWriteLogRecord $record, ?ContextInterface $context = null): void { $this->exporter->export([$record]); } + #[\Override] public function shutdown(?CancellationInterface $cancellation = null): bool { return $this->exporter->shutdown($cancellation); } + #[\Override] public function forceFlush(?CancellationInterface $cancellation = null): bool { return $this->exporter->forceFlush($cancellation); diff --git a/src/SDK/Logs/SimplePsrFileLogger.php b/src/SDK/Logs/SimplePsrFileLogger.php index 8af86b1ad..3b86ae0f7 100644 --- a/src/SDK/Logs/SimplePsrFileLogger.php +++ b/src/SDK/Logs/SimplePsrFileLogger.php @@ -28,6 +28,7 @@ public function __construct( /** * @psalm-suppress MoreSpecificImplementedParamType */ + #[\Override] public function log($level, $message, array $context = []): void { $level = strtolower((string) $level); diff --git a/src/SDK/Metrics/Aggregation/ExplicitBucketHistogramAggregation.php b/src/SDK/Metrics/Aggregation/ExplicitBucketHistogramAggregation.php index 2dacb76ac..5ac1f3f49 100644 --- a/src/SDK/Metrics/Aggregation/ExplicitBucketHistogramAggregation.php +++ b/src/SDK/Metrics/Aggregation/ExplicitBucketHistogramAggregation.php @@ -26,6 +26,7 @@ public function __construct( ) { } + #[\Override] public function initialize(): ExplicitBucketHistogramSummary { return new ExplicitBucketHistogramSummary( @@ -40,6 +41,7 @@ public function initialize(): ExplicitBucketHistogramSummary /** * @param ExplicitBucketHistogramSummary $summary */ + #[\Override] public function record($summary, $value, AttributesInterface $attributes, ContextInterface $context, int $timestamp): void { $boundariesCount = count($this->boundaries); @@ -56,6 +58,7 @@ public function record($summary, $value, AttributesInterface $attributes, Contex * @param ExplicitBucketHistogramSummary $left * @param ExplicitBucketHistogramSummary $right */ + #[\Override] public function merge($left, $right): ExplicitBucketHistogramSummary { $count = $left->count + $right->count; @@ -80,6 +83,7 @@ public function merge($left, $right): ExplicitBucketHistogramSummary * @param ExplicitBucketHistogramSummary $left * @param ExplicitBucketHistogramSummary $right */ + #[\Override] public function diff($left, $right): ExplicitBucketHistogramSummary { $count = -$left->count + $right->count; @@ -103,6 +107,7 @@ public function diff($left, $right): ExplicitBucketHistogramSummary /** * @param array $summaries */ + #[\Override] public function toData( array $attributes, array $summaries, diff --git a/src/SDK/Metrics/Aggregation/LastValueAggregation.php b/src/SDK/Metrics/Aggregation/LastValueAggregation.php index e1eba78e8..87346d604 100644 --- a/src/SDK/Metrics/Aggregation/LastValueAggregation.php +++ b/src/SDK/Metrics/Aggregation/LastValueAggregation.php @@ -14,6 +14,7 @@ */ final class LastValueAggregation implements AggregationInterface { + #[\Override] public function initialize(): LastValueSummary { return new LastValueSummary(null, 0); @@ -22,6 +23,7 @@ public function initialize(): LastValueSummary /** * @param LastValueSummary $summary */ + #[\Override] public function record($summary, $value, AttributesInterface $attributes, ContextInterface $context, int $timestamp): void { if ($summary->value === null || $timestamp >= $summary->timestamp) { @@ -34,6 +36,7 @@ public function record($summary, $value, AttributesInterface $attributes, Contex * @param LastValueSummary $left * @param LastValueSummary $right */ + #[\Override] public function merge($left, $right): LastValueSummary { return $right->timestamp >= $left->timestamp ? $right : $left; @@ -43,6 +46,7 @@ public function merge($left, $right): LastValueSummary * @param LastValueSummary $left * @param LastValueSummary $right */ + #[\Override] public function diff($left, $right): LastValueSummary { return $right->timestamp >= $left->timestamp ? $right : $left; @@ -51,6 +55,7 @@ public function diff($left, $right): LastValueSummary /** * @param array $summaries */ + #[\Override] public function toData( array $attributes, array $summaries, diff --git a/src/SDK/Metrics/Aggregation/SumAggregation.php b/src/SDK/Metrics/Aggregation/SumAggregation.php index 5947f6e9f..06d5155a6 100644 --- a/src/SDK/Metrics/Aggregation/SumAggregation.php +++ b/src/SDK/Metrics/Aggregation/SumAggregation.php @@ -18,6 +18,7 @@ public function __construct(private readonly bool $monotonic = false) { } + #[\Override] public function initialize(): SumSummary { return new SumSummary(0); @@ -26,6 +27,7 @@ public function initialize(): SumSummary /** * @param SumSummary $summary */ + #[\Override] public function record($summary, $value, AttributesInterface $attributes, ContextInterface $context, int $timestamp): void { $summary->value += $value; @@ -35,6 +37,7 @@ public function record($summary, $value, AttributesInterface $attributes, Contex * @param SumSummary $left * @param SumSummary $right */ + #[\Override] public function merge($left, $right): SumSummary { $sum = $left->value + $right->value; @@ -48,6 +51,7 @@ public function merge($left, $right): SumSummary * @param SumSummary $left * @param SumSummary $right */ + #[\Override] public function diff($left, $right): SumSummary { $sum = -$left->value + $right->value; @@ -60,6 +64,7 @@ public function diff($left, $right): SumSummary /** * @param array $summaries */ + #[\Override] public function toData( array $attributes, array $summaries, diff --git a/src/SDK/Metrics/AttributeProcessor/FilteredAttributeProcessor.php b/src/SDK/Metrics/AttributeProcessor/FilteredAttributeProcessor.php index 00b2b460a..a6c87acae 100644 --- a/src/SDK/Metrics/AttributeProcessor/FilteredAttributeProcessor.php +++ b/src/SDK/Metrics/AttributeProcessor/FilteredAttributeProcessor.php @@ -18,6 +18,7 @@ public function __construct(private readonly array $attributeKeys) { } + #[\Override] public function process(AttributesInterface $attributes, ContextInterface $context): AttributesInterface { $filtered = []; diff --git a/src/SDK/Metrics/AttributeProcessor/IdentityAttributeProcessor.php b/src/SDK/Metrics/AttributeProcessor/IdentityAttributeProcessor.php index f261563ea..5fd8083da 100644 --- a/src/SDK/Metrics/AttributeProcessor/IdentityAttributeProcessor.php +++ b/src/SDK/Metrics/AttributeProcessor/IdentityAttributeProcessor.php @@ -13,6 +13,7 @@ */ final class IdentityAttributeProcessor implements AttributeProcessorInterface { + #[\Override] public function process(AttributesInterface $attributes, ContextInterface $context): AttributesInterface { return $attributes; diff --git a/src/SDK/Metrics/Exemplar/ExemplarFilter/AllExemplarFilter.php b/src/SDK/Metrics/Exemplar/ExemplarFilter/AllExemplarFilter.php index b74e738aa..62f8774df 100644 --- a/src/SDK/Metrics/Exemplar/ExemplarFilter/AllExemplarFilter.php +++ b/src/SDK/Metrics/Exemplar/ExemplarFilter/AllExemplarFilter.php @@ -14,6 +14,7 @@ */ final class AllExemplarFilter implements ExemplarFilterInterface { + #[\Override] public function accepts($value, AttributesInterface $attributes, ContextInterface $context, int $timestamp): bool { return true; diff --git a/src/SDK/Metrics/Exemplar/ExemplarFilter/NoneExemplarFilter.php b/src/SDK/Metrics/Exemplar/ExemplarFilter/NoneExemplarFilter.php index 91fdf3b55..23a3761a7 100644 --- a/src/SDK/Metrics/Exemplar/ExemplarFilter/NoneExemplarFilter.php +++ b/src/SDK/Metrics/Exemplar/ExemplarFilter/NoneExemplarFilter.php @@ -14,6 +14,7 @@ */ final class NoneExemplarFilter implements ExemplarFilterInterface { + #[\Override] public function accepts($value, AttributesInterface $attributes, ContextInterface $context, int $timestamp): bool { return false; diff --git a/src/SDK/Metrics/Exemplar/ExemplarFilter/WithSampledTraceExemplarFilter.php b/src/SDK/Metrics/Exemplar/ExemplarFilter/WithSampledTraceExemplarFilter.php index 3e800b416..89a275fc5 100644 --- a/src/SDK/Metrics/Exemplar/ExemplarFilter/WithSampledTraceExemplarFilter.php +++ b/src/SDK/Metrics/Exemplar/ExemplarFilter/WithSampledTraceExemplarFilter.php @@ -15,6 +15,7 @@ */ final class WithSampledTraceExemplarFilter implements ExemplarFilterInterface { + #[\Override] public function accepts($value, AttributesInterface $attributes, ContextInterface $context, int $timestamp): bool { return Span::fromContext($context)->getContext()->isSampled(); diff --git a/src/SDK/Metrics/Exemplar/FilteredReservoir.php b/src/SDK/Metrics/Exemplar/FilteredReservoir.php index d89feb8d2..c2f286231 100644 --- a/src/SDK/Metrics/Exemplar/FilteredReservoir.php +++ b/src/SDK/Metrics/Exemplar/FilteredReservoir.php @@ -19,6 +19,7 @@ public function __construct( ) { } + #[\Override] public function offer($index, $value, AttributesInterface $attributes, ContextInterface $context, int $timestamp): void { if ($this->filter->accepts($value, $attributes, $context, $timestamp)) { @@ -26,6 +27,7 @@ public function offer($index, $value, AttributesInterface $attributes, ContextIn } } + #[\Override] public function collect(array $dataPointAttributes): array { return $this->reservoir->collect($dataPointAttributes); diff --git a/src/SDK/Metrics/Exemplar/FixedSizeReservoir.php b/src/SDK/Metrics/Exemplar/FixedSizeReservoir.php index e02efbe7d..4a7305b8c 100644 --- a/src/SDK/Metrics/Exemplar/FixedSizeReservoir.php +++ b/src/SDK/Metrics/Exemplar/FixedSizeReservoir.php @@ -20,6 +20,7 @@ public function __construct(int $size = 4) $this->size = $size; } + #[\Override] public function offer($index, $value, AttributesInterface $attributes, ContextInterface $context, int $timestamp): void { $bucket = random_int(0, $this->measurements); @@ -29,6 +30,7 @@ public function offer($index, $value, AttributesInterface $attributes, ContextIn } } + #[\Override] public function collect(array $dataPointAttributes): array { $this->measurements = 0; diff --git a/src/SDK/Metrics/Exemplar/HistogramBucketReservoir.php b/src/SDK/Metrics/Exemplar/HistogramBucketReservoir.php index a15d41081..31f0b7a96 100644 --- a/src/SDK/Metrics/Exemplar/HistogramBucketReservoir.php +++ b/src/SDK/Metrics/Exemplar/HistogramBucketReservoir.php @@ -25,6 +25,7 @@ public function __construct(array $boundaries) $this->boundaries = $boundaries; } + #[\Override] public function offer($index, $value, AttributesInterface $attributes, ContextInterface $context, int $timestamp): void { $boundariesCount = count($this->boundaries); @@ -33,6 +34,7 @@ public function offer($index, $value, AttributesInterface $attributes, ContextIn $this->storage->store($i, $index, $value, $attributes, $context, $timestamp); } + #[\Override] public function collect(array $dataPointAttributes): array { return $this->storage->collect($dataPointAttributes); diff --git a/src/SDK/Metrics/Exemplar/NoopReservoir.php b/src/SDK/Metrics/Exemplar/NoopReservoir.php index 010aeff20..df29517f8 100644 --- a/src/SDK/Metrics/Exemplar/NoopReservoir.php +++ b/src/SDK/Metrics/Exemplar/NoopReservoir.php @@ -9,11 +9,13 @@ final class NoopReservoir implements ExemplarReservoirInterface { + #[\Override] public function offer($index, $value, AttributesInterface $attributes, ContextInterface $context, int $timestamp): void { // no-op } + #[\Override] public function collect(array $dataPointAttributes): array { return []; diff --git a/src/SDK/Metrics/Meter.php b/src/SDK/Metrics/Meter.php index db3798f47..f9ffa1a8a 100644 --- a/src/SDK/Metrics/Meter.php +++ b/src/SDK/Metrics/Meter.php @@ -76,6 +76,7 @@ private static function dummyInstrument(): Instrument /** * @internal */ + #[\Override] public function updateConfigurator(Configurator $configurator): void { $this->config = $configurator->resolve($this->instrumentationScope); @@ -118,6 +119,7 @@ public function updateConfigurator(Configurator $configurator): void } } + #[\Override] public function batchObserve(callable $callback, AsynchronousInstrument $instrument, AsynchronousInstrument ...$instruments): ObservableCallbackInterface { $referenceCounters = []; @@ -157,6 +159,7 @@ public function batchObserve(callable $callback, AsynchronousInstrument $instrum ); } + #[\Override] public function createCounter(string $name, ?string $unit = null, ?string $description = null, array $advisory = []): CounterInterface { [$instrument, $referenceCounter] = $this->createSynchronousWriter( @@ -170,6 +173,7 @@ public function createCounter(string $name, ?string $unit = null, ?string $descr return new Counter($this->writer, $instrument, $referenceCounter); } + #[\Override] public function createObservableCounter(string $name, ?string $unit = null, ?string $description = null, $advisory = [], callable ...$callbacks): ObservableCounterInterface { if (is_callable($advisory)) { @@ -192,6 +196,7 @@ public function createObservableCounter(string $name, ?string $unit = null, ?str return new ObservableCounter($this->writer, $instrument, $referenceCounter, $this->destructors); } + #[\Override] public function createHistogram(string $name, ?string $unit = null, ?string $description = null, array $advisory = []): HistogramInterface { [$instrument, $referenceCounter] = $this->createSynchronousWriter( @@ -205,6 +210,7 @@ public function createHistogram(string $name, ?string $unit = null, ?string $des return new Histogram($this->writer, $instrument, $referenceCounter); } + #[\Override] public function createGauge(string $name, ?string $unit = null, ?string $description = null, array $advisory = []): GaugeInterface { [$instrument, $referenceCounter] = $this->createSynchronousWriter( @@ -218,6 +224,7 @@ public function createGauge(string $name, ?string $unit = null, ?string $descrip return new Gauge($this->writer, $instrument, $referenceCounter); } + #[\Override] public function createObservableGauge(string $name, ?string $unit = null, ?string $description = null, $advisory = [], callable ...$callbacks): ObservableGaugeInterface { if (is_callable($advisory)) { @@ -240,6 +247,7 @@ public function createObservableGauge(string $name, ?string $unit = null, ?strin return new ObservableGauge($this->writer, $instrument, $referenceCounter, $this->destructors); } + #[\Override] public function createUpDownCounter(string $name, ?string $unit = null, ?string $description = null, array $advisory = []): UpDownCounterInterface { [$instrument, $referenceCounter] = $this->createSynchronousWriter( @@ -253,6 +261,7 @@ public function createUpDownCounter(string $name, ?string $unit = null, ?string return new UpDownCounter($this->writer, $instrument, $referenceCounter); } + #[\Override] public function createObservableUpDownCounter(string $name, ?string $unit = null, ?string $description = null, $advisory = [], callable ...$callbacks): ObservableUpDownCounterInterface { if (is_callable($advisory)) { diff --git a/src/SDK/Metrics/MeterProvider.php b/src/SDK/Metrics/MeterProvider.php index efd2b4b7b..a852a5049 100644 --- a/src/SDK/Metrics/MeterProvider.php +++ b/src/SDK/Metrics/MeterProvider.php @@ -56,6 +56,7 @@ public function __construct( $this->meters = new WeakMap(); } + #[\Override] public function getMeter( string $name, ?string $version = null, @@ -86,6 +87,7 @@ public function getMeter( return $meter; } + #[\Override] public function shutdown(): bool { if ($this->closed) { @@ -104,6 +106,7 @@ public function shutdown(): bool return $success; } + #[\Override] public function forceFlush(): bool { if ($this->closed) { @@ -131,6 +134,7 @@ public static function builder(): MeterProviderBuilder * * @experimental */ + #[\Override] public function updateConfigurator(Configurator $configurator): void { $this->configurator = $configurator; diff --git a/src/SDK/Metrics/MetricExporter/ConsoleMetricExporter.php b/src/SDK/Metrics/MetricExporter/ConsoleMetricExporter.php index 8b75771d2..7ed892ef0 100644 --- a/src/SDK/Metrics/MetricExporter/ConsoleMetricExporter.php +++ b/src/SDK/Metrics/MetricExporter/ConsoleMetricExporter.php @@ -24,6 +24,7 @@ public function __construct(private readonly Temporality|string|null $temporalit /** * @inheritDoc */ + #[\Override] public function temporality(MetricMetadataInterface $metric): Temporality|string|null { return $this->temporality ?? $metric->temporality(); @@ -32,6 +33,7 @@ public function temporality(MetricMetadataInterface $metric): Temporality|string /** * @inheritDoc */ + #[\Override] public function export(iterable $batch): bool { $resource = null; @@ -56,11 +58,13 @@ public function export(iterable $batch): bool return true; } + #[\Override] public function shutdown(): bool { return true; } + #[\Override] public function forceFlush(): bool { return true; diff --git a/src/SDK/Metrics/MetricExporter/ConsoleMetricExporterFactory.php b/src/SDK/Metrics/MetricExporter/ConsoleMetricExporterFactory.php index 19088738d..4236a6810 100644 --- a/src/SDK/Metrics/MetricExporter/ConsoleMetricExporterFactory.php +++ b/src/SDK/Metrics/MetricExporter/ConsoleMetricExporterFactory.php @@ -9,6 +9,7 @@ class ConsoleMetricExporterFactory implements MetricExporterFactoryInterface { + #[\Override] public function create(): MetricExporterInterface { return new ConsoleMetricExporter(); diff --git a/src/SDK/Metrics/MetricExporter/InMemoryExporter.php b/src/SDK/Metrics/MetricExporter/InMemoryExporter.php index 6feaa5b79..3430aaa1c 100644 --- a/src/SDK/Metrics/MetricExporter/InMemoryExporter.php +++ b/src/SDK/Metrics/MetricExporter/InMemoryExporter.php @@ -30,6 +30,7 @@ public function __construct( ) { } + #[\Override] public function temporality(MetricMetadataInterface $metric): string|Temporality|null { return $this->temporality ?? $metric->temporality(); @@ -48,6 +49,7 @@ public function collect(bool $reset = false): array return $metrics; } + #[\Override] public function export(iterable $batch): bool { if ($this->closed) { @@ -61,6 +63,7 @@ public function export(iterable $batch): bool return true; } + #[\Override] public function shutdown(): bool { if ($this->closed) { @@ -72,6 +75,7 @@ public function shutdown(): bool return true; } + #[\Override] public function forceFlush(): bool { return true; diff --git a/src/SDK/Metrics/MetricExporter/InMemoryExporterFactory.php b/src/SDK/Metrics/MetricExporter/InMemoryExporterFactory.php index d2cea7298..d17761b0d 100644 --- a/src/SDK/Metrics/MetricExporter/InMemoryExporterFactory.php +++ b/src/SDK/Metrics/MetricExporter/InMemoryExporterFactory.php @@ -10,6 +10,7 @@ class InMemoryExporterFactory implements MetricExporterFactoryInterface { + #[\Override] public function create(): MetricExporterInterface { return new InMemoryExporter(InMemoryStorageManager::metrics()); diff --git a/src/SDK/Metrics/MetricExporter/NoopMetricExporter.php b/src/SDK/Metrics/MetricExporter/NoopMetricExporter.php index 0cac12fae..1f2a97543 100644 --- a/src/SDK/Metrics/MetricExporter/NoopMetricExporter.php +++ b/src/SDK/Metrics/MetricExporter/NoopMetricExporter.php @@ -11,11 +11,13 @@ class NoopMetricExporter implements MetricExporterInterface /** * @inheritDoc */ + #[\Override] public function export(iterable $batch): bool { return true; } + #[\Override] public function shutdown(): bool { return true; diff --git a/src/SDK/Metrics/MetricExporter/NoopMetricExporterFactory.php b/src/SDK/Metrics/MetricExporter/NoopMetricExporterFactory.php index ab2ab2af3..50e03a9cd 100644 --- a/src/SDK/Metrics/MetricExporter/NoopMetricExporterFactory.php +++ b/src/SDK/Metrics/MetricExporter/NoopMetricExporterFactory.php @@ -9,6 +9,7 @@ class NoopMetricExporterFactory implements MetricExporterFactoryInterface { + #[\Override] public function create(): MetricExporterInterface { return new NoopMetricExporter(); diff --git a/src/SDK/Metrics/MetricFactory/StreamFactory.php b/src/SDK/Metrics/MetricFactory/StreamFactory.php index b5b944275..513b65414 100644 --- a/src/SDK/Metrics/MetricFactory/StreamFactory.php +++ b/src/SDK/Metrics/MetricFactory/StreamFactory.php @@ -36,6 +36,7 @@ */ final class StreamFactory implements MetricFactoryInterface { + #[\Override] public function createAsynchronousObserver( MetricRegistryInterface $registry, ResourceInfo $resource, @@ -78,6 +79,7 @@ public function createAsynchronousObserver( return array_keys($streams); } + #[\Override] public function createSynchronousWriter( MetricRegistryInterface $registry, ResourceInfo $resource, diff --git a/src/SDK/Metrics/MetricFactory/StreamMetricSource.php b/src/SDK/Metrics/MetricFactory/StreamMetricSource.php index 5b105a5a5..3f6a354cf 100644 --- a/src/SDK/Metrics/MetricFactory/StreamMetricSource.php +++ b/src/SDK/Metrics/MetricFactory/StreamMetricSource.php @@ -18,11 +18,13 @@ public function __construct( ) { } + #[\Override] public function collectionTimestamp(): int { return $this->provider->stream->timestamp(); } + #[\Override] public function collect(): Metric { return new Metric( diff --git a/src/SDK/Metrics/MetricFactory/StreamMetricSourceProvider.php b/src/SDK/Metrics/MetricFactory/StreamMetricSourceProvider.php index ec42fc416..d0c92fa7b 100644 --- a/src/SDK/Metrics/MetricFactory/StreamMetricSourceProvider.php +++ b/src/SDK/Metrics/MetricFactory/StreamMetricSourceProvider.php @@ -30,31 +30,37 @@ public function __construct( ) { } + #[\Override] public function create($temporality): MetricSourceInterface { return new StreamMetricSource($this, $this->stream->register($temporality)); } + #[\Override] public function instrumentType() { return $this->instrument->type; } + #[\Override] public function name(): string { return $this->view->name; } + #[\Override] public function unit(): ?string { return $this->view->unit; } + #[\Override] public function description(): ?string { return $this->view->description; } + #[\Override] public function temporality() { return $this->stream->temporality(); diff --git a/src/SDK/Metrics/MetricReader/ExportingReader.php b/src/SDK/Metrics/MetricReader/ExportingReader.php index b1230d714..430940149 100644 --- a/src/SDK/Metrics/MetricReader/ExportingReader.php +++ b/src/SDK/Metrics/MetricReader/ExportingReader.php @@ -39,6 +39,7 @@ public function __construct(private readonly MetricExporterInterface $exporter) { } + #[\Override] public function defaultAggregation($instrumentType, array $advisory = []): ?AggregationInterface { if ($this->exporter instanceof DefaultAggregationProviderInterface) { @@ -49,6 +50,7 @@ public function defaultAggregation($instrumentType, array $advisory = []): ?Aggr return $this->_defaultAggregation($instrumentType, $advisory); } + #[\Override] public function add(MetricSourceProviderInterface $provider, MetricMetadataInterface $metadata, StalenessHandlerInterface $stalenessHandler): void { if ($this->closed) { @@ -81,6 +83,7 @@ public function add(MetricSourceProviderInterface $provider, MetricMetadataInter $this->streamIds[$registryId][$streamId][] = $sourceId; } + #[\Override] public function unregisterStream(MetricCollectorInterface $collector, int $streamId): void { $registryId = spl_object_id($collector); @@ -115,6 +118,7 @@ private function doCollect(): bool return $this->exporter->export($metrics); } + #[\Override] public function collect(): bool { if ($this->closed) { @@ -124,6 +128,7 @@ public function collect(): bool return $this->doCollect(); } + #[\Override] public function shutdown(): bool { if ($this->closed) { @@ -140,6 +145,7 @@ public function shutdown(): bool return $collect && $shutdown; } + #[\Override] public function forceFlush(): bool { if ($this->closed) { diff --git a/src/SDK/Metrics/MetricRegistration/MultiRegistryRegistration.php b/src/SDK/Metrics/MetricRegistration/MultiRegistryRegistration.php index 47509c03c..f0d71b497 100644 --- a/src/SDK/Metrics/MetricRegistration/MultiRegistryRegistration.php +++ b/src/SDK/Metrics/MetricRegistration/MultiRegistryRegistration.php @@ -24,6 +24,7 @@ public function __construct( ) { } + #[\Override] public function register(MetricSourceProviderInterface $provider, MetricMetadataInterface $metadata): void { foreach ($this->registries as $registry) { diff --git a/src/SDK/Metrics/MetricRegistration/RegistryRegistration.php b/src/SDK/Metrics/MetricRegistration/RegistryRegistration.php index c3bfed02c..3e227e9b3 100644 --- a/src/SDK/Metrics/MetricRegistration/RegistryRegistration.php +++ b/src/SDK/Metrics/MetricRegistration/RegistryRegistration.php @@ -21,6 +21,7 @@ public function __construct( ) { } + #[\Override] public function register(MetricSourceProviderInterface $provider, MetricMetadataInterface $metadata): void { $this->registry->add($provider, $metadata, $this->stalenessHandler); diff --git a/src/SDK/Metrics/MetricRegistry/MetricRegistry.php b/src/SDK/Metrics/MetricRegistry/MetricRegistry.php index ea68865a3..9ca211941 100644 --- a/src/SDK/Metrics/MetricRegistry/MetricRegistry.php +++ b/src/SDK/Metrics/MetricRegistry/MetricRegistry.php @@ -46,6 +46,7 @@ public function __construct( ) { } + #[\Override] public function registerSynchronousStream(Instrument $instrument, MetricStreamInterface $stream, MetricAggregatorInterface $aggregator): int { $this->streams[] = $stream; @@ -59,6 +60,7 @@ public function registerSynchronousStream(Instrument $instrument, MetricStreamIn return $streamId; } + #[\Override] public function registerAsynchronousStream(Instrument $instrument, MetricStreamInterface $stream, MetricAggregatorFactoryInterface $aggregatorFactory): int { $this->streams[] = $stream; @@ -72,6 +74,7 @@ public function registerAsynchronousStream(Instrument $instrument, MetricStreamI return $streamId; } + #[\Override] public function unregisterStreams(Instrument $instrument): array { $instrumentId = spl_object_id($instrument); @@ -90,6 +93,7 @@ public function unregisterStreams(Instrument $instrument): array return $streamIds; } + #[\Override] public function record(Instrument $instrument, $value, iterable $attributes = [], $context = null): void { $context = Context::resolve($context, $this->contextStorage); @@ -103,6 +107,7 @@ public function record(Instrument $instrument, $value, iterable $attributes = [] } } + #[\Override] public function registerCallback(Closure $callback, Instrument $instrument, Instrument ...$instruments): int { $callbackId = array_key_last($this->asynchronousCallbacks) + 1; @@ -120,6 +125,7 @@ public function registerCallback(Closure $callback, Instrument $instrument, Inst return $callbackId; } + #[\Override] public function unregisterCallback(int $callbackId): void { $instrumentIds = $this->asynchronousCallbackArguments[$callbackId]; @@ -135,6 +141,7 @@ public function unregisterCallback(int $callbackId): void } } + #[\Override] public function collectAndPush(iterable $streamIds): void { $timestamp = $this->clock->now(); @@ -178,6 +185,7 @@ public function collectAndPush(iterable $streamIds): void } } + #[\Override] public function enabled(Instrument $instrument): bool { return isset($this->instrumentToStreams[spl_object_id($instrument)]); diff --git a/src/SDK/Metrics/MetricRegistry/MultiObserver.php b/src/SDK/Metrics/MetricRegistry/MultiObserver.php index 96155a5b8..b1a28a08e 100644 --- a/src/SDK/Metrics/MetricRegistry/MultiObserver.php +++ b/src/SDK/Metrics/MetricRegistry/MultiObserver.php @@ -23,6 +23,7 @@ public function __construct( ) { } + #[\Override] public function observe($amount, iterable $attributes = []): void { $context = Context::getRoot(); diff --git a/src/SDK/Metrics/MetricRegistry/NoopObserver.php b/src/SDK/Metrics/MetricRegistry/NoopObserver.php index efbd94dac..005007b00 100644 --- a/src/SDK/Metrics/MetricRegistry/NoopObserver.php +++ b/src/SDK/Metrics/MetricRegistry/NoopObserver.php @@ -11,6 +11,7 @@ */ final class NoopObserver implements ObserverInterface { + #[\Override] public function observe($amount, iterable $attributes = []): void { // no-op diff --git a/src/SDK/Metrics/NoopMeterProvider.php b/src/SDK/Metrics/NoopMeterProvider.php index 2af13f206..63f627cd9 100644 --- a/src/SDK/Metrics/NoopMeterProvider.php +++ b/src/SDK/Metrics/NoopMeterProvider.php @@ -10,21 +10,25 @@ class NoopMeterProvider implements MeterProviderInterface { + #[\Override] public function shutdown(): bool { return true; } + #[\Override] public function forceFlush(): bool { return true; } + #[\Override] public function getMeter(string $name, ?string $version = null, ?string $schemaUrl = null, iterable $attributes = []): MeterInterface { return new NoopMeter(); } + #[\Override] public function updateConfigurator(Configurator $configurator): void { // no-op diff --git a/src/SDK/Metrics/ObservableCallback.php b/src/SDK/Metrics/ObservableCallback.php index b4852e98c..259c99013 100644 --- a/src/SDK/Metrics/ObservableCallback.php +++ b/src/SDK/Metrics/ObservableCallback.php @@ -22,6 +22,7 @@ public function __construct( ) { } + #[\Override] public function detach(): void { if ($this->callbackId === null) { diff --git a/src/SDK/Metrics/StalenessHandler/DelayedStalenessHandler.php b/src/SDK/Metrics/StalenessHandler/DelayedStalenessHandler.php index 19b26e4b0..e8a275150 100644 --- a/src/SDK/Metrics/StalenessHandler/DelayedStalenessHandler.php +++ b/src/SDK/Metrics/StalenessHandler/DelayedStalenessHandler.php @@ -24,6 +24,7 @@ public function __construct( ) { } + #[\Override] public function acquire(bool $persistent = false): void { if ($this->count === 0) { @@ -37,6 +38,7 @@ public function acquire(bool $persistent = false): void } } + #[\Override] public function release(): void { if (--$this->count || $this->onStale === null) { @@ -46,6 +48,7 @@ public function release(): void ($this->stale)($this); } + #[\Override] public function onStale(Closure $callback): void { if ($this->onStale === null) { diff --git a/src/SDK/Metrics/StalenessHandler/DelayedStalenessHandlerFactory.php b/src/SDK/Metrics/StalenessHandler/DelayedStalenessHandlerFactory.php index 6e59649e9..1faf0d11e 100644 --- a/src/SDK/Metrics/StalenessHandler/DelayedStalenessHandlerFactory.php +++ b/src/SDK/Metrics/StalenessHandler/DelayedStalenessHandlerFactory.php @@ -41,6 +41,7 @@ public function __construct( $this->staleHandlers = new WeakMap(); } + #[\Override] public function create(): ReferenceCounterInterface&StalenessHandlerInterface { $this->triggerStaleHandlers(); diff --git a/src/SDK/Metrics/StalenessHandler/ImmediateStalenessHandler.php b/src/SDK/Metrics/StalenessHandler/ImmediateStalenessHandler.php index a5b32d5c4..34ff85910 100644 --- a/src/SDK/Metrics/StalenessHandler/ImmediateStalenessHandler.php +++ b/src/SDK/Metrics/StalenessHandler/ImmediateStalenessHandler.php @@ -17,6 +17,7 @@ final class ImmediateStalenessHandler implements StalenessHandlerInterface, Refe private ?array $onStale = []; private int $count = 0; + #[\Override] public function acquire(bool $persistent = false): void { $this->count++; @@ -26,6 +27,7 @@ public function acquire(bool $persistent = false): void } } + #[\Override] public function release(): void { if (--$this->count !== 0 || !$this->onStale) { @@ -39,6 +41,7 @@ public function release(): void } } + #[\Override] public function onStale(Closure $callback): void { if ($this->onStale === null) { diff --git a/src/SDK/Metrics/StalenessHandler/ImmediateStalenessHandlerFactory.php b/src/SDK/Metrics/StalenessHandler/ImmediateStalenessHandlerFactory.php index dec5ed6c8..3ddcb1d4a 100644 --- a/src/SDK/Metrics/StalenessHandler/ImmediateStalenessHandlerFactory.php +++ b/src/SDK/Metrics/StalenessHandler/ImmediateStalenessHandlerFactory.php @@ -10,6 +10,7 @@ final class ImmediateStalenessHandlerFactory implements StalenessHandlerFactoryInterface { + #[\Override] public function create(): ReferenceCounterInterface&StalenessHandlerInterface { return new ImmediateStalenessHandler(); diff --git a/src/SDK/Metrics/StalenessHandler/MultiReferenceCounter.php b/src/SDK/Metrics/StalenessHandler/MultiReferenceCounter.php index a3b17b6d6..f41772c3a 100644 --- a/src/SDK/Metrics/StalenessHandler/MultiReferenceCounter.php +++ b/src/SDK/Metrics/StalenessHandler/MultiReferenceCounter.php @@ -18,6 +18,7 @@ public function __construct(private readonly array $referenceCounters) { } + #[\Override] public function acquire(bool $persistent = false): void { foreach ($this->referenceCounters as $referenceCounter) { @@ -25,6 +26,7 @@ public function acquire(bool $persistent = false): void } } + #[\Override] public function release(): void { foreach ($this->referenceCounters as $referenceCounter) { diff --git a/src/SDK/Metrics/StalenessHandler/NoopStalenessHandler.php b/src/SDK/Metrics/StalenessHandler/NoopStalenessHandler.php index 00d432b6b..a4b1117e2 100644 --- a/src/SDK/Metrics/StalenessHandler/NoopStalenessHandler.php +++ b/src/SDK/Metrics/StalenessHandler/NoopStalenessHandler.php @@ -13,16 +13,19 @@ */ final class NoopStalenessHandler implements StalenessHandlerInterface, ReferenceCounterInterface { + #[\Override] public function acquire(bool $persistent = false): void { // no-op } + #[\Override] public function release(): void { // no-op } + #[\Override] public function onStale(Closure $callback): void { // no-op diff --git a/src/SDK/Metrics/StalenessHandler/NoopStalenessHandlerFactory.php b/src/SDK/Metrics/StalenessHandler/NoopStalenessHandlerFactory.php index 03e5b7e73..6f65d3589 100644 --- a/src/SDK/Metrics/StalenessHandler/NoopStalenessHandlerFactory.php +++ b/src/SDK/Metrics/StalenessHandler/NoopStalenessHandlerFactory.php @@ -10,6 +10,7 @@ final class NoopStalenessHandlerFactory implements StalenessHandlerFactoryInterface { + #[\Override] public function create(): ReferenceCounterInterface&StalenessHandlerInterface { static $instance; diff --git a/src/SDK/Metrics/Stream/AsynchronousMetricStream.php b/src/SDK/Metrics/Stream/AsynchronousMetricStream.php index a6a8930fc..065cc102f 100644 --- a/src/SDK/Metrics/Stream/AsynchronousMetricStream.php +++ b/src/SDK/Metrics/Stream/AsynchronousMetricStream.php @@ -28,21 +28,25 @@ public function __construct( $this->metric = new Metric([], [], $startTimestamp); } + #[\Override] public function temporality(): Temporality|string { return Temporality::CUMULATIVE; } + #[\Override] public function timestamp(): int { return $this->metric->timestamp; } + #[\Override] public function push(Metric $metric): void { $this->metric = $metric; } + #[\Override] public function register($temporality): int { if ($temporality === Temporality::CUMULATIVE) { @@ -58,6 +62,7 @@ public function register($temporality): int return $reader; } + #[\Override] public function unregister(int $reader): void { if (!isset($this->lastReads[$reader])) { @@ -67,6 +72,7 @@ public function unregister(int $reader): void $this->lastReads[$reader] = null; } + #[\Override] public function collect(int $reader): DataInterface { $metric = $this->metric; diff --git a/src/SDK/Metrics/Stream/MetricAggregator.php b/src/SDK/Metrics/Stream/MetricAggregator.php index d381a94f8..304c3f9a8 100644 --- a/src/SDK/Metrics/Stream/MetricAggregator.php +++ b/src/SDK/Metrics/Stream/MetricAggregator.php @@ -27,6 +27,7 @@ public function __construct( ) { } + #[\Override] public function record(float|int $value, AttributesInterface $attributes, ContextInterface $context, int $timestamp): void { $filteredAttributes = $this->attributeProcessor !== null @@ -48,6 +49,7 @@ public function record(float|int $value, AttributesInterface $attributes, Contex } } + #[\Override] public function collect(int $timestamp): Metric { $exemplars = $this->exemplarReservoir diff --git a/src/SDK/Metrics/Stream/MetricAggregatorFactory.php b/src/SDK/Metrics/Stream/MetricAggregatorFactory.php index 9012fda00..f00315747 100644 --- a/src/SDK/Metrics/Stream/MetricAggregatorFactory.php +++ b/src/SDK/Metrics/Stream/MetricAggregatorFactory.php @@ -18,6 +18,7 @@ public function __construct( ) { } + #[\Override] public function create(): MetricAggregatorInterface { return new MetricAggregator($this->attributeProcessor, $this->aggregation); diff --git a/src/SDK/Metrics/Stream/SynchronousMetricStream.php b/src/SDK/Metrics/Stream/SynchronousMetricStream.php index 2e1290402..ffb4f3fab 100644 --- a/src/SDK/Metrics/Stream/SynchronousMetricStream.php +++ b/src/SDK/Metrics/Stream/SynchronousMetricStream.php @@ -39,22 +39,26 @@ public function __construct( $this->delta = new DeltaStorage($this->aggregation); } + #[\Override] public function temporality(): Temporality|string { return Temporality::DELTA; } + #[\Override] public function timestamp(): int { return $this->timestamp; } + #[\Override] public function push(Metric $metric): void { [$this->timestamp, $metric->timestamp] = [$metric->timestamp, $this->timestamp]; $this->delta->add($metric, $this->readers); } + #[\Override] public function register($temporality): int { $reader = 0; @@ -81,6 +85,7 @@ public function register($temporality): int return $reader; } + #[\Override] public function unregister(int $reader): void { $readerMask = ($this->readers & 1 | 1) << $reader; @@ -96,6 +101,7 @@ public function unregister(int $reader): void } } + #[\Override] public function collect(int $reader): DataInterface { $cumulative = ($this->cumulative >> $reader & 1) != 0; diff --git a/src/SDK/Metrics/View/CriteriaViewRegistry.php b/src/SDK/Metrics/View/CriteriaViewRegistry.php index 254c87286..a62f6e144 100644 --- a/src/SDK/Metrics/View/CriteriaViewRegistry.php +++ b/src/SDK/Metrics/View/CriteriaViewRegistry.php @@ -25,6 +25,7 @@ public function register(SelectionCriteriaInterface $criteria, ViewTemplate $vie /** * @todo is null the best return type here? what about empty array or exception? */ + #[\Override] public function find(Instrument $instrument, InstrumentationScopeInterface $instrumentationScope): ?iterable { $views = $this->generateViews($instrument, $instrumentationScope); diff --git a/src/SDK/Metrics/View/SelectionCriteria/AllCriteria.php b/src/SDK/Metrics/View/SelectionCriteria/AllCriteria.php index 138e2a5c9..7b22b649f 100644 --- a/src/SDK/Metrics/View/SelectionCriteria/AllCriteria.php +++ b/src/SDK/Metrics/View/SelectionCriteria/AllCriteria.php @@ -17,6 +17,7 @@ public function __construct(private readonly iterable $criteria) { } + #[\Override] public function accepts(Instrument $instrument, InstrumentationScopeInterface $instrumentationScope): bool { foreach ($this->criteria as $criterion) { diff --git a/src/SDK/Metrics/View/SelectionCriteria/InstrumentNameCriteria.php b/src/SDK/Metrics/View/SelectionCriteria/InstrumentNameCriteria.php index 104771efe..4c3d96005 100644 --- a/src/SDK/Metrics/View/SelectionCriteria/InstrumentNameCriteria.php +++ b/src/SDK/Metrics/View/SelectionCriteria/InstrumentNameCriteria.php @@ -27,6 +27,7 @@ public function __construct(string $name) /** * @psalm-suppress ArgumentTypeCoercion */ + #[\Override] public function accepts(Instrument $instrument, InstrumentationScopeInterface $instrumentationScope): bool { return (bool) preg_match($this->pattern, $instrument->name); diff --git a/src/SDK/Metrics/View/SelectionCriteria/InstrumentTypeCriteria.php b/src/SDK/Metrics/View/SelectionCriteria/InstrumentTypeCriteria.php index 35868e8a9..5d8f25be9 100644 --- a/src/SDK/Metrics/View/SelectionCriteria/InstrumentTypeCriteria.php +++ b/src/SDK/Metrics/View/SelectionCriteria/InstrumentTypeCriteria.php @@ -22,6 +22,7 @@ public function __construct($instrumentType) $this->instrumentTypes = (array) $instrumentType; } + #[\Override] public function accepts(Instrument $instrument, InstrumentationScopeInterface $instrumentationScope): bool { return in_array($instrument->type, $this->instrumentTypes, true); diff --git a/src/SDK/Metrics/View/SelectionCriteria/InstrumentationScopeNameCriteria.php b/src/SDK/Metrics/View/SelectionCriteria/InstrumentationScopeNameCriteria.php index 006b6154f..e05750929 100644 --- a/src/SDK/Metrics/View/SelectionCriteria/InstrumentationScopeNameCriteria.php +++ b/src/SDK/Metrics/View/SelectionCriteria/InstrumentationScopeNameCriteria.php @@ -14,6 +14,7 @@ public function __construct(private readonly string $name) { } + #[\Override] public function accepts(Instrument $instrument, InstrumentationScopeInterface $instrumentationScope): bool { return $this->name === $instrumentationScope->getName(); diff --git a/src/SDK/Metrics/View/SelectionCriteria/InstrumentationScopeSchemaUrlCriteria.php b/src/SDK/Metrics/View/SelectionCriteria/InstrumentationScopeSchemaUrlCriteria.php index d6bb8a873..24302a75d 100644 --- a/src/SDK/Metrics/View/SelectionCriteria/InstrumentationScopeSchemaUrlCriteria.php +++ b/src/SDK/Metrics/View/SelectionCriteria/InstrumentationScopeSchemaUrlCriteria.php @@ -14,6 +14,7 @@ public function __construct(private readonly ?string $schemaUrl) { } + #[\Override] public function accepts(Instrument $instrument, InstrumentationScopeInterface $instrumentationScope): bool { return $this->schemaUrl === $instrumentationScope->getSchemaUrl(); diff --git a/src/SDK/Metrics/View/SelectionCriteria/InstrumentationScopeVersionCriteria.php b/src/SDK/Metrics/View/SelectionCriteria/InstrumentationScopeVersionCriteria.php index e61ffd177..9e3a6c917 100644 --- a/src/SDK/Metrics/View/SelectionCriteria/InstrumentationScopeVersionCriteria.php +++ b/src/SDK/Metrics/View/SelectionCriteria/InstrumentationScopeVersionCriteria.php @@ -14,6 +14,7 @@ public function __construct(private readonly ?string $version) { } + #[\Override] public function accepts(Instrument $instrument, InstrumentationScopeInterface $instrumentationScope): bool { return $this->version === $instrumentationScope->getVersion(); diff --git a/src/SDK/Propagation/LateBindingTextMapPropagator.php b/src/SDK/Propagation/LateBindingTextMapPropagator.php index 814c3000f..3a14da1b9 100644 --- a/src/SDK/Propagation/LateBindingTextMapPropagator.php +++ b/src/SDK/Propagation/LateBindingTextMapPropagator.php @@ -23,6 +23,7 @@ public function __construct( ) { } + #[\Override] public function fields(): array { if (!$this->propagator instanceof TextMapPropagatorInterface) { @@ -32,6 +33,7 @@ public function fields(): array return $this->propagator->fields(); } + #[\Override] public function inject(mixed &$carrier, ?PropagationSetterInterface $setter = null, ?ContextInterface $context = null): void { if (!$this->propagator instanceof TextMapPropagatorInterface) { @@ -41,6 +43,7 @@ public function inject(mixed &$carrier, ?PropagationSetterInterface $setter = nu $this->propagator->inject($carrier, $setter, $context); } + #[\Override] public function extract($carrier, ?PropagationGetterInterface $getter = null, ?ContextInterface $context = null): ContextInterface { if (!$this->propagator instanceof TextMapPropagatorInterface) { diff --git a/src/SDK/Resource/Detectors/Composer.php b/src/SDK/Resource/Detectors/Composer.php index 0302f6cad..954043059 100644 --- a/src/SDK/Resource/Detectors/Composer.php +++ b/src/SDK/Resource/Detectors/Composer.php @@ -17,6 +17,7 @@ */ final class Composer implements ResourceDetectorInterface { + #[\Override] public function getResource(): ResourceInfo { if (!class_exists(InstalledVersions::class)) { diff --git a/src/SDK/Resource/Detectors/Composite.php b/src/SDK/Resource/Detectors/Composite.php index 36996a2b3..52d72c5e9 100644 --- a/src/SDK/Resource/Detectors/Composite.php +++ b/src/SDK/Resource/Detectors/Composite.php @@ -17,6 +17,7 @@ public function __construct(private readonly iterable $resourceDetectors) { } + #[\Override] public function getResource(): ResourceInfo { $resource = ResourceInfoFactory::mandatoryResource(); diff --git a/src/SDK/Resource/Detectors/Constant.php b/src/SDK/Resource/Detectors/Constant.php index 13fe613a5..13a683245 100644 --- a/src/SDK/Resource/Detectors/Constant.php +++ b/src/SDK/Resource/Detectors/Constant.php @@ -13,6 +13,7 @@ public function __construct(private readonly ResourceInfo $resourceInfo) { } + #[\Override] public function getResource(): ResourceInfo { return $this->resourceInfo; diff --git a/src/SDK/Resource/Detectors/Environment.php b/src/SDK/Resource/Detectors/Environment.php index 2e7ba5035..47371b657 100644 --- a/src/SDK/Resource/Detectors/Environment.php +++ b/src/SDK/Resource/Detectors/Environment.php @@ -16,6 +16,7 @@ */ final class Environment implements ResourceDetectorInterface { + #[\Override] public function getResource(): ResourceInfo { $attributes = Configuration::has(Variables::OTEL_RESOURCE_ATTRIBUTES) diff --git a/src/SDK/Resource/Detectors/Host.php b/src/SDK/Resource/Detectors/Host.php index 9bc0b6c6e..84cf3ef3f 100644 --- a/src/SDK/Resource/Detectors/Host.php +++ b/src/SDK/Resource/Detectors/Host.php @@ -29,6 +29,7 @@ public function __construct( ) { } + #[\Override] public function getResource(): ResourceInfo { $attributes = [ diff --git a/src/SDK/Resource/Detectors/OperatingSystem.php b/src/SDK/Resource/Detectors/OperatingSystem.php index 99b29397c..20579c696 100644 --- a/src/SDK/Resource/Detectors/OperatingSystem.php +++ b/src/SDK/Resource/Detectors/OperatingSystem.php @@ -12,6 +12,7 @@ */ final class OperatingSystem implements ResourceDetectorInterface { + #[\Override] public function getResource(): ResourceInfo { return ResourceInfo::emptyResource(); diff --git a/src/SDK/Resource/Detectors/Process.php b/src/SDK/Resource/Detectors/Process.php index db636b9cf..4a31912b9 100644 --- a/src/SDK/Resource/Detectors/Process.php +++ b/src/SDK/Resource/Detectors/Process.php @@ -23,6 +23,7 @@ final class Process implements ResourceDetectorInterface /** * @psalm-suppress PossiblyUndefinedArrayOffset */ + #[\Override] public function getResource(): ResourceInfo { $attributes = [ diff --git a/src/SDK/Resource/Detectors/ProcessRuntime.php b/src/SDK/Resource/Detectors/ProcessRuntime.php index 81dafd805..4ffe65c37 100644 --- a/src/SDK/Resource/Detectors/ProcessRuntime.php +++ b/src/SDK/Resource/Detectors/ProcessRuntime.php @@ -12,6 +12,7 @@ */ final class ProcessRuntime implements ResourceDetectorInterface { + #[\Override] public function getResource(): ResourceInfo { return ResourceInfo::emptyResource(); diff --git a/src/SDK/Resource/Detectors/Sdk.php b/src/SDK/Resource/Detectors/Sdk.php index 0c17f64a2..81fc9d3f5 100644 --- a/src/SDK/Resource/Detectors/Sdk.php +++ b/src/SDK/Resource/Detectors/Sdk.php @@ -22,6 +22,7 @@ final class Sdk implements ResourceDetectorInterface 'open-telemetry/opentelemetry', ]; + #[\Override] public function getResource(): ResourceInfo { $attributes = [ diff --git a/src/SDK/Resource/Detectors/SdkProvided.php b/src/SDK/Resource/Detectors/SdkProvided.php index 212e6f8af..6e4f29813 100644 --- a/src/SDK/Resource/Detectors/SdkProvided.php +++ b/src/SDK/Resource/Detectors/SdkProvided.php @@ -12,6 +12,7 @@ */ final class SdkProvided implements ResourceDetectorInterface { + #[\Override] public function getResource(): ResourceInfo { return ResourceInfo::emptyResource(); diff --git a/src/SDK/Resource/Detectors/Service.php b/src/SDK/Resource/Detectors/Service.php index 700987571..773c4a19d 100644 --- a/src/SDK/Resource/Detectors/Service.php +++ b/src/SDK/Resource/Detectors/Service.php @@ -17,6 +17,7 @@ */ final class Service implements ResourceDetectorInterface { + #[\Override] public function getResource(): ResourceInfo { static $serviceInstanceId; diff --git a/src/SDK/Trace/Event.php b/src/SDK/Trace/Event.php index 45c23218a..f64d34988 100644 --- a/src/SDK/Trace/Event.php +++ b/src/SDK/Trace/Event.php @@ -16,21 +16,25 @@ public function __construct( ) { } + #[\Override] public function getAttributes(): AttributesInterface { return $this->attributes; } + #[\Override] public function getName(): string { return $this->name; } + #[\Override] public function getEpochNanos(): int { return $this->timestamp; } + #[\Override] public function getTotalAttributeCount(): int { return count($this->attributes); diff --git a/src/SDK/Trace/ImmutableSpan.php b/src/SDK/Trace/ImmutableSpan.php index b960941ef..668ab8971 100644 --- a/src/SDK/Trace/ImmutableSpan.php +++ b/src/SDK/Trace/ImmutableSpan.php @@ -34,93 +34,111 @@ public function __construct( ) { } + #[\Override] public function getKind(): int { return $this->span->getKind(); } + #[\Override] public function getContext(): API\SpanContextInterface { return $this->span->getContext(); } + #[\Override] public function getParentContext(): API\SpanContextInterface { return $this->span->getParentContext(); } + #[\Override] public function getTraceId(): string { return $this->getContext()->getTraceId(); } + #[\Override] public function getSpanId(): string { return $this->getContext()->getSpanId(); } + #[\Override] public function getParentSpanId(): string { return $this->getParentContext()->getSpanId(); } + #[\Override] public function getStartEpochNanos(): int { return $this->span->getStartEpochNanos(); } + #[\Override] public function getEndEpochNanos(): int { return $this->endEpochNanos; } + #[\Override] public function getInstrumentationScope(): InstrumentationScopeInterface { return $this->span->getInstrumentationScope(); } + #[\Override] public function getResource(): ResourceInfo { return $this->span->getResource(); } + #[\Override] public function getName(): string { return $this->name; } /** @inheritDoc */ + #[\Override] public function getLinks(): array { return $this->links; } /** @inheritDoc */ + #[\Override] public function getEvents(): array { return $this->events; } + #[\Override] public function getAttributes(): AttributesInterface { return $this->attributes; } + #[\Override] public function getTotalDroppedEvents(): int { return max(0, $this->totalRecordedEvents - count($this->events)); } + #[\Override] public function getTotalDroppedLinks(): int { return max(0, $this->totalRecordedLinks - count($this->links)); } + #[\Override] public function getStatus(): StatusDataInterface { return $this->status; } + #[\Override] public function hasEnded(): bool { return $this->hasEnded; diff --git a/src/SDK/Trace/Link.php b/src/SDK/Trace/Link.php index 871378297..cfea0187c 100644 --- a/src/SDK/Trace/Link.php +++ b/src/SDK/Trace/Link.php @@ -15,11 +15,13 @@ public function __construct( ) { } + #[\Override] public function getSpanContext(): API\SpanContextInterface { return $this->context; } + #[\Override] public function getAttributes(): AttributesInterface { return $this->attributes; diff --git a/src/SDK/Trace/NoopTracerProvider.php b/src/SDK/Trace/NoopTracerProvider.php index e29edbf8a..bcb0f8975 100644 --- a/src/SDK/Trace/NoopTracerProvider.php +++ b/src/SDK/Trace/NoopTracerProvider.php @@ -10,16 +10,19 @@ class NoopTracerProvider extends API\Trace\NoopTracerProvider implements TracerProviderInterface { + #[\Override] public function forceFlush(?CancellationInterface $cancellation = null): bool { return true; } + #[\Override] public function shutdown(?CancellationInterface $cancellation = null): bool { return true; } + #[\Override] public function updateConfigurator(Configurator $configurator): void { } diff --git a/src/SDK/Trace/RandomIdGenerator.php b/src/SDK/Trace/RandomIdGenerator.php index 0024a1a64..d9db2a61e 100644 --- a/src/SDK/Trace/RandomIdGenerator.php +++ b/src/SDK/Trace/RandomIdGenerator.php @@ -12,6 +12,7 @@ class RandomIdGenerator implements IdGeneratorInterface private const TRACE_ID_HEX_LENGTH = 32; private const SPAN_ID_HEX_LENGTH = 16; + #[\Override] public function generateTraceId(): string { do { @@ -21,6 +22,7 @@ public function generateTraceId(): string return $traceId; } + #[\Override] public function generateSpanId(): string { do { diff --git a/src/SDK/Trace/Sampler/AlwaysOffSampler.php b/src/SDK/Trace/Sampler/AlwaysOffSampler.php index 3ee5dcc8e..4d6882bd9 100644 --- a/src/SDK/Trace/Sampler/AlwaysOffSampler.php +++ b/src/SDK/Trace/Sampler/AlwaysOffSampler.php @@ -24,6 +24,7 @@ class AlwaysOffSampler implements SamplerInterface * Returns false because we never want to sample. * {@inheritdoc} */ + #[\Override] public function shouldSample( ContextInterface $parentContext, string $traceId, @@ -43,6 +44,7 @@ public function shouldSample( ); } + #[\Override] public function getDescription(): string { return 'AlwaysOffSampler'; diff --git a/src/SDK/Trace/Sampler/AlwaysOnSampler.php b/src/SDK/Trace/Sampler/AlwaysOnSampler.php index 29a45a35f..48c777848 100644 --- a/src/SDK/Trace/Sampler/AlwaysOnSampler.php +++ b/src/SDK/Trace/Sampler/AlwaysOnSampler.php @@ -24,6 +24,7 @@ class AlwaysOnSampler implements SamplerInterface * Returns true because we always want to sample. * {@inheritdoc} */ + #[\Override] public function shouldSample( ContextInterface $parentContext, string $traceId, @@ -43,6 +44,7 @@ public function shouldSample( ); } + #[\Override] public function getDescription(): string { return 'AlwaysOnSampler'; diff --git a/src/SDK/Trace/Sampler/ParentBased.php b/src/SDK/Trace/Sampler/ParentBased.php index fd34a7e58..e7dfee68c 100644 --- a/src/SDK/Trace/Sampler/ParentBased.php +++ b/src/SDK/Trace/Sampler/ParentBased.php @@ -60,6 +60,7 @@ public function __construct( * Invokes the respective delegate sampler when parent is set or uses root sampler for the root span. * {@inheritdoc} */ + #[\Override] public function shouldSample( ContextInterface $parentContext, string $traceId, @@ -87,6 +88,7 @@ public function shouldSample( : $this->localParentNotSampler->shouldSample(...func_get_args()); } + #[\Override] public function getDescription(): string { return 'ParentBased+' . $this->root->getDescription(); diff --git a/src/SDK/Trace/Sampler/TraceIdRatioBasedSampler.php b/src/SDK/Trace/Sampler/TraceIdRatioBasedSampler.php index 10d58eeb6..8fdec75bc 100644 --- a/src/SDK/Trace/Sampler/TraceIdRatioBasedSampler.php +++ b/src/SDK/Trace/Sampler/TraceIdRatioBasedSampler.php @@ -46,6 +46,7 @@ public function __construct(float $probability, int $precision = 4) $this->tv = rtrim(bin2hex(substr(pack('J', self::computeTValue($probability, $precision, 4)), 1)), '0') ?: '0'; } + #[\Override] public function shouldSample( ContextInterface $parentContext, string $traceId, @@ -110,6 +111,7 @@ public static function computeTValue(float $probability, int $precision, int $wo return $t - $m >> 1 & $m; } + #[\Override] public function getDescription(): string { return sprintf('%s{%.6F}', 'TraceIdRatioBasedSampler', $this->probability); diff --git a/src/SDK/Trace/Span.php b/src/SDK/Trace/Span.php index 894f19389..47caa7de3 100644 --- a/src/SDK/Trace/Span.php +++ b/src/SDK/Trace/Span.php @@ -112,18 +112,21 @@ public static function formatStackTrace(Throwable $e, ?array &$seen = null): str } /** @inheritDoc */ + #[\Override] public function getContext(): API\SpanContextInterface { return $this->context; } /** @inheritDoc */ + #[\Override] public function isRecording(): bool { return !$this->hasEnded; } /** @inheritDoc */ + #[\Override] public function setAttribute(string $key, $value): self { if ($this->hasEnded) { @@ -136,6 +139,7 @@ public function setAttribute(string $key, $value): self } /** @inheritDoc */ + #[\Override] public function setAttributes(iterable $attributes): self { foreach ($attributes as $key => $value) { @@ -145,6 +149,7 @@ public function setAttributes(iterable $attributes): self return $this; } + #[\Override] public function addLink(SpanContextInterface $context, iterable $attributes = []): self { if ($this->hasEnded) { @@ -169,6 +174,7 @@ public function addLink(SpanContextInterface $context, iterable $attributes = [] } /** @inheritDoc */ + #[\Override] public function addEvent(string $name, iterable $attributes = [], ?int $timestamp = null): self { if ($this->hasEnded) { @@ -187,6 +193,7 @@ public function addEvent(string $name, iterable $attributes = [], ?int $timestam } /** @inheritDoc */ + #[\Override] public function recordException(Throwable $exception, iterable $attributes = [], ?int $timestamp = null): self { if ($this->hasEnded) { @@ -213,6 +220,7 @@ public function recordException(Throwable $exception, iterable $attributes = [], } /** @inheritDoc */ + #[\Override] public function updateName(string $name): self { if ($this->hasEnded) { @@ -224,6 +232,7 @@ public function updateName(string $name): self } /** @inheritDoc */ + #[\Override] public function setStatus(string $code, ?string $description = null): self { if ($this->hasEnded) { @@ -245,6 +254,7 @@ public function setStatus(string $code, ?string $description = null): self } /** @inheritDoc */ + #[\Override] public function end(?int $endEpochNanos = null): void { if ($this->hasEnded) { @@ -260,26 +270,31 @@ public function end(?int $endEpochNanos = null): void } /** @inheritDoc */ + #[\Override] public function getName(): string { return $this->name; } + #[\Override] public function getParentContext(): API\SpanContextInterface { return $this->parentSpanContext; } + #[\Override] public function getInstrumentationScope(): InstrumentationScopeInterface { return $this->instrumentationScope; } + #[\Override] public function hasEnded(): bool { return $this->hasEnded; } + #[\Override] public function toSpanData(): SpanDataInterface { return new ImmutableSpan( @@ -297,18 +312,21 @@ public function toSpanData(): SpanDataInterface } /** @inheritDoc */ + #[\Override] public function getDuration(): int { return ($this->hasEnded ? $this->endEpochNanos : Clock::getDefault()->now()) - $this->startEpochNanos; } /** @inheritDoc */ + #[\Override] public function getKind(): int { return $this->kind; } /** @inheritDoc */ + #[\Override] public function getAttribute(string $key) { return $this->attributesBuilder[$key]; diff --git a/src/SDK/Trace/SpanBuilder.php b/src/SDK/Trace/SpanBuilder.php index 6df9b2b6b..844175d79 100644 --- a/src/SDK/Trace/SpanBuilder.php +++ b/src/SDK/Trace/SpanBuilder.php @@ -37,6 +37,7 @@ public function __construct( } /** @inheritDoc */ + #[\Override] public function setParent(ContextInterface|false|null $context): API\SpanBuilderInterface { $this->parentContext = $context; @@ -45,6 +46,7 @@ public function setParent(ContextInterface|false|null $context): API\SpanBuilder } /** @inheritDoc */ + #[\Override] public function addLink(API\SpanContextInterface $context, iterable $attributes = []): API\SpanBuilderInterface { if (!$context->isValid()) { @@ -70,6 +72,7 @@ public function addLink(API\SpanContextInterface $context, iterable $attributes } /** @inheritDoc */ + #[\Override] public function setAttribute(string $key, mixed $value): API\SpanBuilderInterface { $this->attributesBuilder[$key] = $value; @@ -78,6 +81,7 @@ public function setAttribute(string $key, mixed $value): API\SpanBuilderInterfac } /** @inheritDoc */ + #[\Override] public function setAttributes(iterable $attributes): API\SpanBuilderInterface { foreach ($attributes as $key => $value) { @@ -92,6 +96,7 @@ public function setAttributes(iterable $attributes): API\SpanBuilderInterface * * @psalm-param API\SpanKind::KIND_* $spanKind */ + #[\Override] public function setSpanKind(int $spanKind): API\SpanBuilderInterface { $this->spanKind = $spanKind; @@ -100,6 +105,7 @@ public function setSpanKind(int $spanKind): API\SpanBuilderInterface } /** @inheritDoc */ + #[\Override] public function setStartTimestamp(int $timestampNanos): API\SpanBuilderInterface { if (0 > $timestampNanos) { @@ -112,6 +118,7 @@ public function setStartTimestamp(int $timestampNanos): API\SpanBuilderInterface } /** @inheritDoc */ + #[\Override] public function startSpan(): API\SpanInterface { $parentContext = Context::resolve($this->parentContext); diff --git a/src/SDK/Trace/SpanExporter/ConsoleSpanExporter.php b/src/SDK/Trace/SpanExporter/ConsoleSpanExporter.php index dbe3651c2..621ceec16 100644 --- a/src/SDK/Trace/SpanExporter/ConsoleSpanExporter.php +++ b/src/SDK/Trace/SpanExporter/ConsoleSpanExporter.php @@ -25,6 +25,7 @@ public function __construct( $this->setSpanConverter($converter ?? new FriendlySpanConverter()); } + #[\Override] public function export(iterable $batch, ?CancellationInterface $cancellation = null): FutureInterface { $payload = ''; @@ -44,11 +45,13 @@ public function export(iterable $batch, ?CancellationInterface $cancellation = n ->catch(fn () => false); } + #[\Override] public function shutdown(?CancellationInterface $cancellation = null): bool { return $this->transport->shutdown(); } + #[\Override] public function forceFlush(?CancellationInterface $cancellation = null): bool { return $this->transport->forceFlush(); diff --git a/src/SDK/Trace/SpanExporter/ConsoleSpanExporterFactory.php b/src/SDK/Trace/SpanExporter/ConsoleSpanExporterFactory.php index 7e45fb549..8db982caa 100644 --- a/src/SDK/Trace/SpanExporter/ConsoleSpanExporterFactory.php +++ b/src/SDK/Trace/SpanExporter/ConsoleSpanExporterFactory.php @@ -9,6 +9,7 @@ class ConsoleSpanExporterFactory implements SpanExporterFactoryInterface { + #[\Override] public function create(): SpanExporterInterface { $transport = Registry::transportFactory('stream')->create('php://stdout', 'application/json'); diff --git a/src/SDK/Trace/SpanExporter/FriendlySpanConverter.php b/src/SDK/Trace/SpanExporter/FriendlySpanConverter.php index eacd95c56..9b25fb971 100644 --- a/src/SDK/Trace/SpanExporter/FriendlySpanConverter.php +++ b/src/SDK/Trace/SpanExporter/FriendlySpanConverter.php @@ -37,6 +37,7 @@ class FriendlySpanConverter implements SpanConverterInterface private const LINKS_ATTR = 'links'; private const SCHEMA_URL_ATTR = 'schema_url'; + #[\Override] public function convert(iterable $spans): array { $aggregate = []; diff --git a/src/SDK/Trace/SpanExporter/InMemoryExporter.php b/src/SDK/Trace/SpanExporter/InMemoryExporter.php index dd87b8ea1..3c5e872bd 100644 --- a/src/SDK/Trace/SpanExporter/InMemoryExporter.php +++ b/src/SDK/Trace/SpanExporter/InMemoryExporter.php @@ -16,6 +16,7 @@ public function __construct(private readonly ArrayObject $storage = new ArrayObj { } + #[\Override] protected function doExport(iterable $spans): bool { foreach ($spans as $span) { diff --git a/src/SDK/Trace/SpanExporter/InMemorySpanExporterFactory.php b/src/SDK/Trace/SpanExporter/InMemorySpanExporterFactory.php index d47398901..30d9d9e36 100644 --- a/src/SDK/Trace/SpanExporter/InMemorySpanExporterFactory.php +++ b/src/SDK/Trace/SpanExporter/InMemorySpanExporterFactory.php @@ -9,6 +9,7 @@ class InMemorySpanExporterFactory implements SpanExporterFactoryInterface { + #[\Override] public function create(): SpanExporterInterface { return new InMemoryExporter(InMemoryStorageManager::spans()); diff --git a/src/SDK/Trace/SpanExporter/LoggerDecorator.php b/src/SDK/Trace/SpanExporter/LoggerDecorator.php index f50740467..dcf593e33 100644 --- a/src/SDK/Trace/SpanExporter/LoggerDecorator.php +++ b/src/SDK/Trace/SpanExporter/LoggerDecorator.php @@ -30,11 +30,13 @@ public function __construct( $this->setSpanConverter($converter ?? new FriendlySpanConverter()); } + #[\Override] protected function beforeExport(iterable $spans): iterable { return $spans; } + #[\Override] protected function afterExport(iterable $spans, bool $exportSuccess): void { if ($exportSuccess) { diff --git a/src/SDK/Trace/SpanExporter/LoggerExporter.php b/src/SDK/Trace/SpanExporter/LoggerExporter.php index 5e2ca59ce..7346f2a2a 100644 --- a/src/SDK/Trace/SpanExporter/LoggerExporter.php +++ b/src/SDK/Trace/SpanExporter/LoggerExporter.php @@ -42,6 +42,7 @@ public function __construct( } /** @inheritDoc */ + #[\Override] public function doExport(iterable $spans): bool { try { diff --git a/src/SDK/Trace/SpanExporter/NullSpanConverter.php b/src/SDK/Trace/SpanExporter/NullSpanConverter.php index 1e55431a8..6bd173488 100644 --- a/src/SDK/Trace/SpanExporter/NullSpanConverter.php +++ b/src/SDK/Trace/SpanExporter/NullSpanConverter.php @@ -8,6 +8,7 @@ class NullSpanConverter implements SpanConverterInterface { + #[\Override] public function convert(iterable $spans): array { return [[]]; diff --git a/src/SDK/Trace/SpanProcessor/BatchSpanProcessor.php b/src/SDK/Trace/SpanProcessor/BatchSpanProcessor.php index e1a3ff438..307e1e07f 100644 --- a/src/SDK/Trace/SpanProcessor/BatchSpanProcessor.php +++ b/src/SDK/Trace/SpanProcessor/BatchSpanProcessor.php @@ -139,10 +139,12 @@ public function __construct( }); } + #[\Override] public function onStart(ReadWriteSpanInterface $span, ContextInterface $parentContext): void { } + #[\Override] public function onEnd(ReadableSpanInterface $span): void { if ($this->closed) { @@ -170,6 +172,7 @@ public function onEnd(ReadableSpanInterface $span): void } } + #[\Override] public function forceFlush(?CancellationInterface $cancellation = null): bool { if ($this->closed) { @@ -179,6 +182,7 @@ public function forceFlush(?CancellationInterface $cancellation = null): bool return $this->flush(__FUNCTION__, $cancellation); } + #[\Override] public function shutdown(?CancellationInterface $cancellation = null): bool { if ($this->closed) { diff --git a/src/SDK/Trace/SpanProcessor/MultiSpanProcessor.php b/src/SDK/Trace/SpanProcessor/MultiSpanProcessor.php index e690791f2..177fe7f39 100644 --- a/src/SDK/Trace/SpanProcessor/MultiSpanProcessor.php +++ b/src/SDK/Trace/SpanProcessor/MultiSpanProcessor.php @@ -38,6 +38,7 @@ public function getSpanProcessors(): array } /** @inheritDoc */ + #[\Override] public function onStart(ReadWriteSpanInterface $span, ContextInterface $parentContext): void { foreach ($this->processors as $processor) { @@ -46,6 +47,7 @@ public function onStart(ReadWriteSpanInterface $span, ContextInterface $parentCo } /** @inheritDoc */ + #[\Override] public function onEnd(ReadableSpanInterface $span): void { foreach ($this->processors as $processor) { @@ -54,6 +56,7 @@ public function onEnd(ReadableSpanInterface $span): void } /** @inheritDoc */ + #[\Override] public function shutdown(?CancellationInterface $cancellation = null): bool { $result = true; @@ -66,6 +69,7 @@ public function shutdown(?CancellationInterface $cancellation = null): bool } /** @inheritDoc */ + #[\Override] public function forceFlush(?CancellationInterface $cancellation = null): bool { $result = true; diff --git a/src/SDK/Trace/SpanProcessor/NoopSpanProcessor.php b/src/SDK/Trace/SpanProcessor/NoopSpanProcessor.php index 9c4d1eabe..c90b6f8ef 100644 --- a/src/SDK/Trace/SpanProcessor/NoopSpanProcessor.php +++ b/src/SDK/Trace/SpanProcessor/NoopSpanProcessor.php @@ -24,22 +24,26 @@ public static function getInstance(): SpanProcessorInterface } /** @inheritDoc */ + #[\Override] public function onStart(ReadWriteSpanInterface $span, ContextInterface $parentContext): void { } //@codeCoverageIgnore /** @inheritDoc */ + #[\Override] public function onEnd(ReadableSpanInterface $span): void { } //@codeCoverageIgnore /** @inheritDoc */ + #[\Override] public function forceFlush(?CancellationInterface $cancellation = null): bool { return true; } /** @inheritDoc */ + #[\Override] public function shutdown(?CancellationInterface $cancellation = null): bool { return $this->forceFlush(); diff --git a/src/SDK/Trace/SpanProcessor/SimpleSpanProcessor.php b/src/SDK/Trace/SpanProcessor/SimpleSpanProcessor.php index 7b65e58f4..a1b833ca0 100644 --- a/src/SDK/Trace/SpanProcessor/SimpleSpanProcessor.php +++ b/src/SDK/Trace/SpanProcessor/SimpleSpanProcessor.php @@ -34,10 +34,12 @@ public function __construct(private readonly SpanExporterInterface $exporter) $this->queue = new SplQueue(); } + #[\Override] public function onStart(ReadWriteSpanInterface $span, ContextInterface $parentContext): void { } + #[\Override] public function onEnd(ReadableSpanInterface $span): void { if ($this->closed) { @@ -51,6 +53,7 @@ public function onEnd(ReadableSpanInterface $span): void $this->flush(fn () => $this->exporter->export([$spanData])->await(), 'export', false, $this->exportContext); } + #[\Override] public function forceFlush(?CancellationInterface $cancellation = null): bool { if ($this->closed) { @@ -60,6 +63,7 @@ public function forceFlush(?CancellationInterface $cancellation = null): bool return $this->flush(fn (): bool => $this->exporter->forceFlush($cancellation), __FUNCTION__, true, Context::getCurrent()); } + #[\Override] public function shutdown(?CancellationInterface $cancellation = null): bool { if ($this->closed) { diff --git a/src/SDK/Trace/StatusData.php b/src/SDK/Trace/StatusData.php index f1bd72789..9b4a6d18c 100644 --- a/src/SDK/Trace/StatusData.php +++ b/src/SDK/Trace/StatusData.php @@ -41,6 +41,7 @@ public static function create(string $code, ?string $description = null): self return new self($code, $description); /** @phan-suppress-current-line PhanTypeMismatchArgumentNullable */ } + #[\Override] public static function ok(): self { if (null === self::$ok) { @@ -50,6 +51,7 @@ public static function ok(): self return self::$ok; } + #[\Override] public static function error(): self { if (null === self::$error) { @@ -59,6 +61,7 @@ public static function error(): self return self::$error; } + #[\Override] public static function unset(): self { if (null === self::$unset) { @@ -68,11 +71,13 @@ public static function unset(): self return self::$unset; } + #[\Override] public function getCode(): string { return $this->code; } + #[\Override] public function getDescription(): string { return $this->description; diff --git a/src/SDK/Trace/Tracer.php b/src/SDK/Trace/Tracer.php index 8e67a90f2..e95c02a51 100644 --- a/src/SDK/Trace/Tracer.php +++ b/src/SDK/Trace/Tracer.php @@ -25,6 +25,7 @@ public function __construct( } /** @inheritDoc */ + #[\Override] public function spanBuilder(string $spanName): API\SpanBuilderInterface { if (ctype_space($spanName)) { @@ -47,6 +48,7 @@ public function getInstrumentationScope(): InstrumentationScopeInterface return $this->instrumentationScope; } + #[\Override] public function isEnabled(): bool { return $this->config->isEnabled(); diff --git a/src/SDK/Trace/TracerProvider.php b/src/SDK/Trace/TracerProvider.php index 72ec106dc..420054085 100644 --- a/src/SDK/Trace/TracerProvider.php +++ b/src/SDK/Trace/TracerProvider.php @@ -52,6 +52,7 @@ public function __construct( $this->tracers = new WeakMap(); } + #[\Override] public function forceFlush(?CancellationInterface $cancellation = null): bool { return $this->tracerSharedState->getSpanProcessor()->forceFlush($cancellation); @@ -60,6 +61,7 @@ public function forceFlush(?CancellationInterface $cancellation = null): bool /** * @inheritDoc */ + #[\Override] public function getTracer( string $name, ?string $version = null, @@ -89,6 +91,7 @@ public function getSampler(): SamplerInterface /** * Returns `false` is the provider is already shutdown, otherwise `true`. */ + #[\Override] public function shutdown(?CancellationInterface $cancellation = null): bool { if ($this->tracerSharedState->hasShutdown()) { @@ -108,6 +111,7 @@ public static function builder(): TracerProviderBuilder * reconfigure all tracers created from the provider. * @experimental */ + #[\Override] public function updateConfigurator(Configurator $configurator): void { $this->configurator = $configurator; diff --git a/tests/Benchmark/OtlpBench.php b/tests/Benchmark/OtlpBench.php index 59ecfa498..0bc2fde49 100644 --- a/tests/Benchmark/OtlpBench.php +++ b/tests/Benchmark/OtlpBench.php @@ -64,21 +64,25 @@ public function __construct(string $contentType) $this->contentType = $contentType; } + #[\Override] public function contentType(): string { return $this->contentType; } + #[\Override] public function send(string $payload, ?CancellationInterface $cancellation = null): FutureInterface { return new CompletedFuture(''); } + #[\Override] public function shutdown(?CancellationInterface $cancellation = null): bool { return true; } + #[\Override] public function forceFlush(?CancellationInterface $cancellation = null): bool { return true; diff --git a/tests/Integration/Config/ComponentProvider/Detector/Container.php b/tests/Integration/Config/ComponentProvider/Detector/Container.php index 643f7ad7e..8bae9e9c3 100644 --- a/tests/Integration/Config/ComponentProvider/Detector/Container.php +++ b/tests/Integration/Config/ComponentProvider/Detector/Container.php @@ -18,9 +18,11 @@ */ final class Container implements ComponentProvider { + #[\Override] public function createPlugin(array $properties, Context $context): ResourceDetectorInterface { return new class() implements ResourceDetectorInterface { + #[\Override] public function getResource(): ResourceInfo { return ResourceInfoFactory::emptyResource(); @@ -28,6 +30,7 @@ public function getResource(): ResourceInfo }; } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { return $builder->arrayNode('container'); diff --git a/tests/Integration/Config/ComponentProvider/Detector/Os.php b/tests/Integration/Config/ComponentProvider/Detector/Os.php index 035470538..64ba33868 100644 --- a/tests/Integration/Config/ComponentProvider/Detector/Os.php +++ b/tests/Integration/Config/ComponentProvider/Detector/Os.php @@ -18,9 +18,11 @@ */ final class Os implements ComponentProvider { + #[\Override] public function createPlugin(array $properties, Context $context): ResourceDetectorInterface { return new class() implements ResourceDetectorInterface { + #[\Override] public function getResource(): ResourceInfo { return ResourceInfoFactory::emptyResource(); @@ -28,6 +30,7 @@ public function getResource(): ResourceInfo }; } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { return $builder->arrayNode('os'); diff --git a/tests/Integration/Config/ComponentProvider/Metrics/AggregationResolverExplicitBucketHistogram.php b/tests/Integration/Config/ComponentProvider/Metrics/AggregationResolverExplicitBucketHistogram.php index 255c8adb1..097316eab 100644 --- a/tests/Integration/Config/ComponentProvider/Metrics/AggregationResolverExplicitBucketHistogram.php +++ b/tests/Integration/Config/ComponentProvider/Metrics/AggregationResolverExplicitBucketHistogram.php @@ -24,6 +24,7 @@ final class AggregationResolverExplicitBucketHistogram implements ComponentProvi * record_min_max: bool, * } $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): DefaultAggregationProviderInterface { return new class() implements DefaultAggregationProviderInterface { @@ -31,6 +32,7 @@ public function createPlugin(array $properties, Context $context): DefaultAggreg }; } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { $node = $builder->arrayNode('explicit_bucket_histogram'); diff --git a/tests/Integration/Config/ComponentProvider/Metrics/MetricExporterPrometheus.php b/tests/Integration/Config/ComponentProvider/Metrics/MetricExporterPrometheus.php index 342d99e95..f7c2b40b1 100644 --- a/tests/Integration/Config/ComponentProvider/Metrics/MetricExporterPrometheus.php +++ b/tests/Integration/Config/ComponentProvider/Metrics/MetricExporterPrometheus.php @@ -30,14 +30,17 @@ final class MetricExporterPrometheus implements ComponentProvider * }, * } $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): MetricExporterInterface { return new class() implements MetricExporterInterface { + #[\Override] public function export(iterable $batch): bool { return true; } + #[\Override] public function shutdown(): bool { return true; @@ -45,6 +48,7 @@ public function shutdown(): bool }; } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { $node = $builder->arrayNode('prometheus/development'); diff --git a/tests/Integration/Config/ComponentProvider/Metrics/MetricReaderPull.php b/tests/Integration/Config/ComponentProvider/Metrics/MetricReaderPull.php index 80179becd..115f88a20 100644 --- a/tests/Integration/Config/ComponentProvider/Metrics/MetricReaderPull.php +++ b/tests/Integration/Config/ComponentProvider/Metrics/MetricReaderPull.php @@ -25,19 +25,23 @@ final class MetricReaderPull implements ComponentProvider * cardinality_limits: array, * } $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): MetricReaderInterface { return new class() implements MetricReaderInterface { + #[\Override] public function collect(): bool { return true; } + #[\Override] public function shutdown(): bool { return true; } + #[\Override] public function forceFlush(): bool { return true; @@ -45,6 +49,7 @@ public function forceFlush(): bool }; } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { $node = $builder->arrayNode('pull'); diff --git a/tests/Integration/Config/ComponentProvider/Propagator/TextMapPropagatorOtTrace.php b/tests/Integration/Config/ComponentProvider/Propagator/TextMapPropagatorOtTrace.php index e40dc32e8..96a54521c 100644 --- a/tests/Integration/Config/ComponentProvider/Propagator/TextMapPropagatorOtTrace.php +++ b/tests/Integration/Config/ComponentProvider/Propagator/TextMapPropagatorOtTrace.php @@ -20,19 +20,23 @@ */ final class TextMapPropagatorOtTrace implements ComponentProvider { + #[\Override] public function createPlugin(array $properties, Context $context): TextMapPropagatorInterface { return new class() implements TextMapPropagatorInterface { + #[\Override] public function fields(): array { return []; } + #[\Override] public function inject(mixed &$carrier, ?PropagationSetterInterface $setter = null, ?ContextInterface $context = null): void { //no-op } + #[\Override] public function extract($carrier, ?PropagationGetterInterface $getter = null, ?ContextInterface $context = null): ContextInterface { return $context ?? Ctx::getCurrent(); @@ -40,6 +44,7 @@ public function extract($carrier, ?PropagationGetterInterface $getter = null, ?C }; } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { return $builder->arrayNode('ottrace'); diff --git a/tests/Integration/Config/ComponentProvider/Propagator/TextMapPropagatorXray.php b/tests/Integration/Config/ComponentProvider/Propagator/TextMapPropagatorXray.php index 316c944dc..e686654d2 100644 --- a/tests/Integration/Config/ComponentProvider/Propagator/TextMapPropagatorXray.php +++ b/tests/Integration/Config/ComponentProvider/Propagator/TextMapPropagatorXray.php @@ -20,19 +20,23 @@ */ final class TextMapPropagatorXray implements ComponentProvider { + #[\Override] public function createPlugin(array $properties, Context $context): TextMapPropagatorInterface { return new class() implements TextMapPropagatorInterface { + #[\Override] public function fields(): array { return []; } + #[\Override] public function inject(mixed &$carrier, ?PropagationSetterInterface $setter = null, ?ContextInterface $context = null): void { //no-op } + #[\Override] public function extract($carrier, ?PropagationGetterInterface $getter = null, ?ContextInterface $context = null): ContextInterface { return $context ?? Ctx::getCurrent(); @@ -40,6 +44,7 @@ public function extract($carrier, ?PropagationGetterInterface $getter = null, ?C }; } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { return $builder->arrayNode('xray'); diff --git a/tests/Integration/Config/ConfigurationTest.php b/tests/Integration/Config/ConfigurationTest.php index 974848806..e963f57f7 100644 --- a/tests/Integration/Config/ConfigurationTest.php +++ b/tests/Integration/Config/ConfigurationTest.php @@ -18,6 +18,7 @@ #[CoversNothing] final class ConfigurationTest extends TestCase { + #[\Override] public function setUp(): void { // set up mock file system with /var/log directory, for otlp_file exporter. @@ -26,6 +27,7 @@ public function setUp(): void OutputStreamParser::setRoot($root); } + #[\Override] public function tearDown(): void { OutputStreamParser::reset(); diff --git a/tests/Integration/SDK/Common/InMemoryStorageManagerWithSKDAutoload.php b/tests/Integration/SDK/Common/InMemoryStorageManagerWithSKDAutoload.php index 8828b6936..3ae2ebca8 100644 --- a/tests/Integration/SDK/Common/InMemoryStorageManagerWithSKDAutoload.php +++ b/tests/Integration/SDK/Common/InMemoryStorageManagerWithSKDAutoload.php @@ -24,6 +24,7 @@ class InMemoryStorageManagerWithSKDAutoload extends TestCase protected LoggerInterface&MockObject $logger; + #[\Override] public function setUp(): void { $this->logger = $this->createMock(LoggerInterface::class); diff --git a/tests/Integration/SDK/LocalRootSpanTest.php b/tests/Integration/SDK/LocalRootSpanTest.php index 7e2a2b16e..d99eb742e 100644 --- a/tests/Integration/SDK/LocalRootSpanTest.php +++ b/tests/Integration/SDK/LocalRootSpanTest.php @@ -17,6 +17,7 @@ class LocalRootSpanTest extends TestCase { private SpanInterface $span; + #[\Override] public function setUp(): void { $tracerProvider = new TracerProvider(); diff --git a/tests/Integration/SDK/SpanBuilderTest.php b/tests/Integration/SDK/SpanBuilderTest.php index 12cd77a16..1eb4c9c09 100644 --- a/tests/Integration/SDK/SpanBuilderTest.php +++ b/tests/Integration/SDK/SpanBuilderTest.php @@ -40,6 +40,7 @@ class SpanBuilderTest extends MockeryTestCase /** @var MockInterface&SpanProcessorInterface */ private $spanProcessor; + #[\Override] protected function setUp(): void { $this->spanProcessor = Mockery::spy(SpanProcessorInterface::class); @@ -335,6 +336,7 @@ public function test_set_attribute_dropping(): void public function test_add_attributes_via_sampler(): void { $sampler = new class() implements SamplerInterface { + #[\Override] public function shouldSample( ContextInterface $parentContext, string $traceId, @@ -346,6 +348,7 @@ public function shouldSample( return new SamplingResult(SamplingResult::RECORD_AND_SAMPLE, ['cat' => 'meow']); } + #[\Override] public function getDescription(): string { return 'test'; diff --git a/tests/Unit/API/Baggage/Propagation/ParserTest.php b/tests/Unit/API/Baggage/Propagation/ParserTest.php index ef8b0e346..0ef74d75f 100644 --- a/tests/Unit/API/Baggage/Propagation/ParserTest.php +++ b/tests/Unit/API/Baggage/Propagation/ParserTest.php @@ -18,6 +18,7 @@ class ParserTest extends TestCase /** @var BaggageBuilderInterface&MockObject */ private BaggageBuilderInterface $builder; + #[\Override] public function setUp(): void { $this->builder = $this->createMock(BaggageBuilderInterface::class); diff --git a/tests/Unit/API/Behavior/Internal/LogWriterFactoryTest.php b/tests/Unit/API/Behavior/Internal/LogWriterFactoryTest.php index 1d781d390..41eac85e1 100644 --- a/tests/Unit/API/Behavior/Internal/LogWriterFactoryTest.php +++ b/tests/Unit/API/Behavior/Internal/LogWriterFactoryTest.php @@ -21,6 +21,7 @@ class LogWriterFactoryTest extends TestCase { use TestState; + #[\Override] public function setUp(): void { LoggerHolder::unset(); diff --git a/tests/Unit/API/Behavior/LogsMessagesTraitTest.php b/tests/Unit/API/Behavior/LogsMessagesTraitTest.php index 3a7479629..6030fa26b 100644 --- a/tests/Unit/API/Behavior/LogsMessagesTraitTest.php +++ b/tests/Unit/API/Behavior/LogsMessagesTraitTest.php @@ -22,6 +22,7 @@ class LogsMessagesTraitTest extends TestCase protected MockObject $writer; + #[\Override] public function setUp(): void { Logging::reset(); diff --git a/tests/Unit/API/Common/Time/ClockTest.php b/tests/Unit/API/Common/Time/ClockTest.php index 51799799c..858ab6908 100644 --- a/tests/Unit/API/Common/Time/ClockTest.php +++ b/tests/Unit/API/Common/Time/ClockTest.php @@ -13,6 +13,7 @@ #[CoversClass(Clock::class)] class ClockTest extends TestCase { + #[\Override] public function setUp(): void { Clock::reset(); diff --git a/tests/Unit/API/Instrumentation/AutoInstrumentation/ExtensionHookManagerTest.php b/tests/Unit/API/Instrumentation/AutoInstrumentation/ExtensionHookManagerTest.php index e97f51cc1..99250230d 100644 --- a/tests/Unit/API/Instrumentation/AutoInstrumentation/ExtensionHookManagerTest.php +++ b/tests/Unit/API/Instrumentation/AutoInstrumentation/ExtensionHookManagerTest.php @@ -28,6 +28,7 @@ class ExtensionHookManagerTest extends TestCase private HookManagerInterface $hookManager; private InstrumentationContext $context; + #[\Override] public function setUp(): void { if (!extension_loaded('opentelemetry')) { @@ -46,6 +47,7 @@ public function setUp(): void ); } + #[\Override] public function tearDown(): void { $this->scope->detach(); @@ -133,6 +135,7 @@ public function __construct( $this->post = $post; } + #[\Override] public function register(HookManagerInterface $hookManager, ConfigProperties $configuration, InstrumentationContext $context): void { $hookManager->hook($this->class, $this->method, $this->pre, $this->post); diff --git a/tests/Unit/API/Instrumentation/AutoInstrumentation/LateBindingProviderTest.php b/tests/Unit/API/Instrumentation/AutoInstrumentation/LateBindingProviderTest.php index e2cc4d945..ad03e9db6 100644 --- a/tests/Unit/API/Instrumentation/AutoInstrumentation/LateBindingProviderTest.php +++ b/tests/Unit/API/Instrumentation/AutoInstrumentation/LateBindingProviderTest.php @@ -51,6 +51,7 @@ class LateBindingProviderTest extends TestCase use TestState; use ProphecyTrait; + #[\Override] public function setUp(): void { Logging::disable(); @@ -60,6 +61,7 @@ public function test_late_binding_providers(): void { $instrumentation = new class() implements Instrumentation { private static ?Context $context; + #[\Override] public function register(HookManagerInterface $hookManager, ConfigProperties $configuration, Context $context): void { self::$context = $context; diff --git a/tests/Unit/API/Instrumentation/ConfigurationResolverTest.php b/tests/Unit/API/Instrumentation/ConfigurationResolverTest.php index 81aafbf9b..da09d9a5d 100644 --- a/tests/Unit/API/Instrumentation/ConfigurationResolverTest.php +++ b/tests/Unit/API/Instrumentation/ConfigurationResolverTest.php @@ -17,6 +17,7 @@ class ConfigurationResolverTest extends TestCase private ConfigurationResolver $resolver; + #[\Override] public function setUp(): void { $this->resolver = new ConfigurationResolver(); diff --git a/tests/Unit/API/Instrumentation/InstrumentationTest.php b/tests/Unit/API/Instrumentation/InstrumentationTest.php index 847d0c1db..84ec313c7 100644 --- a/tests/Unit/API/Instrumentation/InstrumentationTest.php +++ b/tests/Unit/API/Instrumentation/InstrumentationTest.php @@ -39,12 +39,14 @@ final class InstrumentationTest extends TestCase { private LogWriterInterface&MockObject $logWriter; + #[\Override] public function setUp(): void { $this->logWriter = $this->createMock(LogWriterInterface::class); Logging::setLogWriter($this->logWriter); } + #[\Override] public function tearDown(): void { Globals::reset(); diff --git a/tests/Unit/API/Instrumentation/InstrumentationTraitTest.php b/tests/Unit/API/Instrumentation/InstrumentationTraitTest.php index 11812e30a..486f0606f 100644 --- a/tests/Unit/API/Instrumentation/InstrumentationTraitTest.php +++ b/tests/Unit/API/Instrumentation/InstrumentationTraitTest.php @@ -128,21 +128,25 @@ class ValidInstrumentation implements InstrumentationInterface { use InstrumentationTrait; + #[\Override] public function getName(): string { return InstrumentationTraitTest::INSTRUMENTATION_NAME; } + #[\Override] public function getVersion(): ?string { return InstrumentationTraitTest::INSTRUMENTATION_VERSION; } + #[\Override] public function getSchemaUrl(): ?string { return InstrumentationTraitTest::INSTRUMENTATION_SCHEMA_URL; } + #[\Override] public function init(): bool { return true; @@ -153,21 +157,25 @@ class InvalidInstrumentation { use InstrumentationTrait; + #[\Override] public function getName(): string { return InstrumentationTraitTest::INSTRUMENTATION_NAME; } + #[\Override] public function getVersion(): ?string { return InstrumentationTraitTest::INSTRUMENTATION_VERSION; } + #[\Override] public function getSchemaUrl(): ?string { return InstrumentationTraitTest::INSTRUMENTATION_SCHEMA_URL; } + #[\Override] public function init(): bool { return true; diff --git a/tests/Unit/API/Instrumentation/WithSpanHandlerTest.php b/tests/Unit/API/Instrumentation/WithSpanHandlerTest.php index 24094e92d..a6cfd5ca0 100644 --- a/tests/Unit/API/Instrumentation/WithSpanHandlerTest.php +++ b/tests/Unit/API/Instrumentation/WithSpanHandlerTest.php @@ -23,6 +23,7 @@ class WithSpanHandlerTest extends TestCase private ScopeInterface $scope; private ArrayObject $storage; + #[\Override] public function setUp(): void { $this->storage = new ArrayObject(); @@ -37,6 +38,7 @@ public function setUp(): void ->activate(); } + #[\Override] public function tearDown(): void { $this->scope->detach(); diff --git a/tests/Unit/API/LoggerHolderTest.php b/tests/Unit/API/LoggerHolderTest.php index 7b6387bf1..bb8ff2618 100644 --- a/tests/Unit/API/LoggerHolderTest.php +++ b/tests/Unit/API/LoggerHolderTest.php @@ -13,6 +13,7 @@ #[CoversClass(LoggerHolder::class)] class LoggerHolderTest extends TestCase { + #[\Override] public function setUp(): void { LoggerHolder::unset(); diff --git a/tests/Unit/API/Trace/Propagation/TraceContextPropagatorTest.php b/tests/Unit/API/Trace/Propagation/TraceContextPropagatorTest.php index 2d1863bea..e97d658f2 100644 --- a/tests/Unit/API/Trace/Propagation/TraceContextPropagatorTest.php +++ b/tests/Unit/API/Trace/Propagation/TraceContextPropagatorTest.php @@ -31,6 +31,7 @@ class TraceContextPropagatorTest extends TestCase private TraceContextPropagator $traceContextPropagator; private TraceStateInterface $traceState; + #[\Override] protected function setUp(): void { Logging::disable(); diff --git a/tests/Unit/API/Trace/SpanContextTest.php b/tests/Unit/API/Trace/SpanContextTest.php index 7786ef562..616b31399 100644 --- a/tests/Unit/API/Trace/SpanContextTest.php +++ b/tests/Unit/API/Trace/SpanContextTest.php @@ -23,6 +23,7 @@ class SpanContextTest extends TestCase private API\SpanContextInterface $second; private API\SpanContextInterface $remote; + #[\Override] protected function setUp(): void { $this->first = SpanContext::create(self::FIRST_TRACE_ID, self::FIRST_SPAN_ID, API\TraceFlags::DEFAULT, new TraceState('foo=bar')); diff --git a/tests/Unit/API/Trace/TraceStateTest.php b/tests/Unit/API/Trace/TraceStateTest.php index 595d88b4d..b8f280e98 100644 --- a/tests/Unit/API/Trace/TraceStateTest.php +++ b/tests/Unit/API/Trace/TraceStateTest.php @@ -22,6 +22,7 @@ class TraceStateTest extends TestCase { private LoggerInterface $logger; + #[\Override] public function setUp(): void { $this->logger = $this->createMock(LoggerInterface::class); diff --git a/tests/Unit/Config/SDK/Configuration/ConfigurationFactoryTest.php b/tests/Unit/Config/SDK/Configuration/ConfigurationFactoryTest.php index a6f3f6a77..59a390e14 100644 --- a/tests/Unit/Config/SDK/Configuration/ConfigurationFactoryTest.php +++ b/tests/Unit/Config/SDK/Configuration/ConfigurationFactoryTest.php @@ -30,11 +30,13 @@ final class ConfigurationFactoryTest extends TestCase public string $cacheDir; public $properties; + #[\Override] public function setUp(): void { $this->cacheDir = __DIR__ . '/configurations'; } + #[\Override] public function tearDown(): void { array_map('unlink', array_filter((array) glob($this->cacheDir . '/*cache*'))); @@ -49,6 +51,7 @@ public function test_env_substitution_spec_examples(): void $factory = new ConfigurationFactory( [], new class() implements \OpenTelemetry\API\Configuration\Config\ComponentProvider { + #[\Override] public function createPlugin(array $properties, Context $context): mixed { throw new BadMethodCallException(); @@ -57,6 +60,7 @@ public function createPlugin(array $properties, Context $context): mixed /** * @psalm-suppress UndefinedInterfaceMethod,PossiblyNullReference */ + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { $node = new ArrayNodeDefinition('env_substitution'); diff --git a/tests/Unit/Config/SDK/Configuration/ExampleSdk/Logs/LogRecordExporterConsole.php b/tests/Unit/Config/SDK/Configuration/ExampleSdk/Logs/LogRecordExporterConsole.php index 470204cce..71ada2d76 100644 --- a/tests/Unit/Config/SDK/Configuration/ExampleSdk/Logs/LogRecordExporterConsole.php +++ b/tests/Unit/Config/SDK/Configuration/ExampleSdk/Logs/LogRecordExporterConsole.php @@ -17,11 +17,13 @@ final class LogRecordExporterConsole implements ComponentProvider /** * @param array{} $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): LogRecordExporter { throw new BadMethodCallException('not implemented'); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { return $builder->arrayNode('console'); diff --git a/tests/Unit/Config/SDK/Configuration/ExampleSdk/Logs/LogRecordExporterOtlp.php b/tests/Unit/Config/SDK/Configuration/ExampleSdk/Logs/LogRecordExporterOtlp.php index 346cdad20..ca2b9e50b 100644 --- a/tests/Unit/Config/SDK/Configuration/ExampleSdk/Logs/LogRecordExporterOtlp.php +++ b/tests/Unit/Config/SDK/Configuration/ExampleSdk/Logs/LogRecordExporterOtlp.php @@ -27,11 +27,13 @@ final class LogRecordExporterOtlp implements ComponentProvider * timeout: int<0, max>, * } $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): LogRecordExporter { throw new BadMethodCallException('not implemented'); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { $node = $builder->arrayNode('otlp'); diff --git a/tests/Unit/Config/SDK/Configuration/ExampleSdk/Logs/LogRecordProcessorBatch.php b/tests/Unit/Config/SDK/Configuration/ExampleSdk/Logs/LogRecordProcessorBatch.php index 31c8b2dc0..6103be8de 100644 --- a/tests/Unit/Config/SDK/Configuration/ExampleSdk/Logs/LogRecordProcessorBatch.php +++ b/tests/Unit/Config/SDK/Configuration/ExampleSdk/Logs/LogRecordProcessorBatch.php @@ -25,11 +25,13 @@ final class LogRecordProcessorBatch implements ComponentProvider * exporter: ComponentPlugin, * } $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): LogRecordProcessor { throw new BadMethodCallException('not implemented'); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { $node = $builder->arrayNode('batch'); diff --git a/tests/Unit/Config/SDK/Configuration/ExampleSdk/Logs/LogRecordProcessorSimple.php b/tests/Unit/Config/SDK/Configuration/ExampleSdk/Logs/LogRecordProcessorSimple.php index 189c3b162..3537dc45b 100644 --- a/tests/Unit/Config/SDK/Configuration/ExampleSdk/Logs/LogRecordProcessorSimple.php +++ b/tests/Unit/Config/SDK/Configuration/ExampleSdk/Logs/LogRecordProcessorSimple.php @@ -21,11 +21,13 @@ final class LogRecordProcessorSimple implements ComponentProvider * exporter: ComponentPlugin, * } $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): LogRecordProcessor { throw new BadMethodCallException('not implemented'); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { $node = $builder->arrayNode('simple'); diff --git a/tests/Unit/Config/SDK/Configuration/ExampleSdk/Metrics/AggregationResolverDefault.php b/tests/Unit/Config/SDK/Configuration/ExampleSdk/Metrics/AggregationResolverDefault.php index 77c7208a0..422c2b3e8 100644 --- a/tests/Unit/Config/SDK/Configuration/ExampleSdk/Metrics/AggregationResolverDefault.php +++ b/tests/Unit/Config/SDK/Configuration/ExampleSdk/Metrics/AggregationResolverDefault.php @@ -17,11 +17,13 @@ final class AggregationResolverDefault implements ComponentProvider /** * @param array{} $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): AggregationResolver { throw new BadMethodCallException('not implemented'); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { return $builder->arrayNode('default'); diff --git a/tests/Unit/Config/SDK/Configuration/ExampleSdk/Metrics/AggregationResolverDrop.php b/tests/Unit/Config/SDK/Configuration/ExampleSdk/Metrics/AggregationResolverDrop.php index f8ae259f2..ac53da992 100644 --- a/tests/Unit/Config/SDK/Configuration/ExampleSdk/Metrics/AggregationResolverDrop.php +++ b/tests/Unit/Config/SDK/Configuration/ExampleSdk/Metrics/AggregationResolverDrop.php @@ -17,11 +17,13 @@ final class AggregationResolverDrop implements ComponentProvider /** * @param array{} $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): AggregationResolver { throw new BadMethodCallException('not implemented'); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { return $builder->arrayNode('drop'); diff --git a/tests/Unit/Config/SDK/Configuration/ExampleSdk/Metrics/AggregationResolverExplicitBucketHistogram.php b/tests/Unit/Config/SDK/Configuration/ExampleSdk/Metrics/AggregationResolverExplicitBucketHistogram.php index f0e32033f..26ec6dfb2 100644 --- a/tests/Unit/Config/SDK/Configuration/ExampleSdk/Metrics/AggregationResolverExplicitBucketHistogram.php +++ b/tests/Unit/Config/SDK/Configuration/ExampleSdk/Metrics/AggregationResolverExplicitBucketHistogram.php @@ -21,11 +21,13 @@ final class AggregationResolverExplicitBucketHistogram implements ComponentProvi * record_min_max: bool, * } $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): AggregationResolver { throw new BadMethodCallException('not implemented'); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { $node = $builder->arrayNode('explicit_bucket_histogram'); diff --git a/tests/Unit/Config/SDK/Configuration/ExampleSdk/Metrics/AggregationResolverLastValue.php b/tests/Unit/Config/SDK/Configuration/ExampleSdk/Metrics/AggregationResolverLastValue.php index e475193cd..1d1745d37 100644 --- a/tests/Unit/Config/SDK/Configuration/ExampleSdk/Metrics/AggregationResolverLastValue.php +++ b/tests/Unit/Config/SDK/Configuration/ExampleSdk/Metrics/AggregationResolverLastValue.php @@ -17,11 +17,13 @@ final class AggregationResolverLastValue implements ComponentProvider /** * @param array{} $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): AggregationResolver { throw new BadMethodCallException('not implemented'); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { return $builder->arrayNode('last_value'); diff --git a/tests/Unit/Config/SDK/Configuration/ExampleSdk/Metrics/AggregationResolverSum.php b/tests/Unit/Config/SDK/Configuration/ExampleSdk/Metrics/AggregationResolverSum.php index 0c3c11d4f..89583a46d 100644 --- a/tests/Unit/Config/SDK/Configuration/ExampleSdk/Metrics/AggregationResolverSum.php +++ b/tests/Unit/Config/SDK/Configuration/ExampleSdk/Metrics/AggregationResolverSum.php @@ -17,11 +17,13 @@ final class AggregationResolverSum implements ComponentProvider /** * @param array{} $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): AggregationResolver { throw new BadMethodCallException('not implemented'); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { return $builder->arrayNode('sum'); diff --git a/tests/Unit/Config/SDK/Configuration/ExampleSdk/Metrics/MetricExporterConsole.php b/tests/Unit/Config/SDK/Configuration/ExampleSdk/Metrics/MetricExporterConsole.php index ec9db9b84..3a42905de 100644 --- a/tests/Unit/Config/SDK/Configuration/ExampleSdk/Metrics/MetricExporterConsole.php +++ b/tests/Unit/Config/SDK/Configuration/ExampleSdk/Metrics/MetricExporterConsole.php @@ -17,11 +17,13 @@ final class MetricExporterConsole implements ComponentProvider /** * @param array{} $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): MetricExporter { throw new BadMethodCallException('not implemented'); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { return $builder->arrayNode('console'); diff --git a/tests/Unit/Config/SDK/Configuration/ExampleSdk/Metrics/MetricExporterOtlp.php b/tests/Unit/Config/SDK/Configuration/ExampleSdk/Metrics/MetricExporterOtlp.php index 516d9039e..24879b6aa 100644 --- a/tests/Unit/Config/SDK/Configuration/ExampleSdk/Metrics/MetricExporterOtlp.php +++ b/tests/Unit/Config/SDK/Configuration/ExampleSdk/Metrics/MetricExporterOtlp.php @@ -29,11 +29,13 @@ final class MetricExporterOtlp implements ComponentProvider * default_histogram_aggregation: 'explicit_bucket_histogram', * } $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): MetricExporter { throw new BadMethodCallException('not implemented'); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { $node = $builder->arrayNode('otlp'); diff --git a/tests/Unit/Config/SDK/Configuration/ExampleSdk/Metrics/MetricExporterPrometheus.php b/tests/Unit/Config/SDK/Configuration/ExampleSdk/Metrics/MetricExporterPrometheus.php index 757b6ee5c..a2e687c45 100644 --- a/tests/Unit/Config/SDK/Configuration/ExampleSdk/Metrics/MetricExporterPrometheus.php +++ b/tests/Unit/Config/SDK/Configuration/ExampleSdk/Metrics/MetricExporterPrometheus.php @@ -24,11 +24,13 @@ final class MetricExporterPrometheus implements ComponentProvider * without_scope_info: bool, * } $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): MetricExporter { throw new BadMethodCallException('not implemented'); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { $node = $builder->arrayNode('prometheus'); diff --git a/tests/Unit/Config/SDK/Configuration/ExampleSdk/Metrics/MetricReaderPeriodic.php b/tests/Unit/Config/SDK/Configuration/ExampleSdk/Metrics/MetricReaderPeriodic.php index f15663a41..2b5263ad8 100644 --- a/tests/Unit/Config/SDK/Configuration/ExampleSdk/Metrics/MetricReaderPeriodic.php +++ b/tests/Unit/Config/SDK/Configuration/ExampleSdk/Metrics/MetricReaderPeriodic.php @@ -23,11 +23,13 @@ final class MetricReaderPeriodic implements ComponentProvider * exporter: ComponentPlugin, * } $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): MetricReader { throw new BadMethodCallException('not implemented'); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { $node = $builder->arrayNode('periodic'); diff --git a/tests/Unit/Config/SDK/Configuration/ExampleSdk/Metrics/MetricReaderPull.php b/tests/Unit/Config/SDK/Configuration/ExampleSdk/Metrics/MetricReaderPull.php index 0dbb00845..cc9d44228 100644 --- a/tests/Unit/Config/SDK/Configuration/ExampleSdk/Metrics/MetricReaderPull.php +++ b/tests/Unit/Config/SDK/Configuration/ExampleSdk/Metrics/MetricReaderPull.php @@ -21,11 +21,13 @@ final class MetricReaderPull implements ComponentProvider * exporter: ComponentPlugin, * } $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): MetricReader { throw new BadMethodCallException('not implemented'); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { $node = $builder->arrayNode('pull'); diff --git a/tests/Unit/Config/SDK/Configuration/ExampleSdk/OpenTelemetryConfiguration.php b/tests/Unit/Config/SDK/Configuration/ExampleSdk/OpenTelemetryConfiguration.php index a23731e56..e049894d5 100644 --- a/tests/Unit/Config/SDK/Configuration/ExampleSdk/OpenTelemetryConfiguration.php +++ b/tests/Unit/Config/SDK/Configuration/ExampleSdk/OpenTelemetryConfiguration.php @@ -75,11 +75,13 @@ final class OpenTelemetryConfiguration implements ComponentProvider * }, * } $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): Configuration { throw new BadMethodCallException('not implemented'); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { $node = $builder->arrayNode('open_telemetry'); diff --git a/tests/Unit/Config/SDK/Configuration/ExampleSdk/Propagator/TextMapPropagatorB3.php b/tests/Unit/Config/SDK/Configuration/ExampleSdk/Propagator/TextMapPropagatorB3.php index 2f6781779..f77481f8d 100644 --- a/tests/Unit/Config/SDK/Configuration/ExampleSdk/Propagator/TextMapPropagatorB3.php +++ b/tests/Unit/Config/SDK/Configuration/ExampleSdk/Propagator/TextMapPropagatorB3.php @@ -17,11 +17,13 @@ final class TextMapPropagatorB3 implements ComponentProvider /** * @param array{} $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): TextMapPropagatorInterface { throw new BadMethodCallException('not implemented'); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { return $builder->arrayNode('b3'); diff --git a/tests/Unit/Config/SDK/Configuration/ExampleSdk/Propagator/TextMapPropagatorB3Multi.php b/tests/Unit/Config/SDK/Configuration/ExampleSdk/Propagator/TextMapPropagatorB3Multi.php index 5060f0710..048aeb82c 100644 --- a/tests/Unit/Config/SDK/Configuration/ExampleSdk/Propagator/TextMapPropagatorB3Multi.php +++ b/tests/Unit/Config/SDK/Configuration/ExampleSdk/Propagator/TextMapPropagatorB3Multi.php @@ -17,11 +17,13 @@ final class TextMapPropagatorB3Multi implements ComponentProvider /** * @param array{} $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): TextMapPropagatorInterface { throw new BadMethodCallException('not implemented'); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { return $builder->arrayNode('b3multi'); diff --git a/tests/Unit/Config/SDK/Configuration/ExampleSdk/Propagator/TextMapPropagatorBaggage.php b/tests/Unit/Config/SDK/Configuration/ExampleSdk/Propagator/TextMapPropagatorBaggage.php index 674af9228..89f083b2f 100644 --- a/tests/Unit/Config/SDK/Configuration/ExampleSdk/Propagator/TextMapPropagatorBaggage.php +++ b/tests/Unit/Config/SDK/Configuration/ExampleSdk/Propagator/TextMapPropagatorBaggage.php @@ -17,11 +17,13 @@ final class TextMapPropagatorBaggage implements ComponentProvider /** * @param array{} $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): TextMapPropagatorInterface { throw new BadMethodCallException('not implemented'); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { return $builder->arrayNode('baggage'); diff --git a/tests/Unit/Config/SDK/Configuration/ExampleSdk/Propagator/TextMapPropagatorComposite.php b/tests/Unit/Config/SDK/Configuration/ExampleSdk/Propagator/TextMapPropagatorComposite.php index 1cfe98652..cc6ff8c1f 100644 --- a/tests/Unit/Config/SDK/Configuration/ExampleSdk/Propagator/TextMapPropagatorComposite.php +++ b/tests/Unit/Config/SDK/Configuration/ExampleSdk/Propagator/TextMapPropagatorComposite.php @@ -18,11 +18,13 @@ final class TextMapPropagatorComposite implements ComponentProvider /** * @param list> $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): TextMapPropagatorInterface { throw new BadMethodCallException('not implemented'); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { return $registry->componentNames('composite', TextMapPropagatorInterface::class); diff --git a/tests/Unit/Config/SDK/Configuration/ExampleSdk/Propagator/TextMapPropagatorJaeger.php b/tests/Unit/Config/SDK/Configuration/ExampleSdk/Propagator/TextMapPropagatorJaeger.php index b90dc3bb7..8da5a9768 100644 --- a/tests/Unit/Config/SDK/Configuration/ExampleSdk/Propagator/TextMapPropagatorJaeger.php +++ b/tests/Unit/Config/SDK/Configuration/ExampleSdk/Propagator/TextMapPropagatorJaeger.php @@ -17,11 +17,13 @@ final class TextMapPropagatorJaeger implements ComponentProvider /** * @param array{} $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): TextMapPropagatorInterface { throw new BadMethodCallException('not implemented'); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { return $builder->arrayNode('jaeger'); diff --git a/tests/Unit/Config/SDK/Configuration/ExampleSdk/Propagator/TextMapPropagatorOTTrace.php b/tests/Unit/Config/SDK/Configuration/ExampleSdk/Propagator/TextMapPropagatorOTTrace.php index ce4957f71..32ec3fae7 100644 --- a/tests/Unit/Config/SDK/Configuration/ExampleSdk/Propagator/TextMapPropagatorOTTrace.php +++ b/tests/Unit/Config/SDK/Configuration/ExampleSdk/Propagator/TextMapPropagatorOTTrace.php @@ -17,11 +17,13 @@ final class TextMapPropagatorOTTrace implements ComponentProvider /** * @param array{} $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): TextMapPropagatorInterface { throw new BadMethodCallException('not implemented'); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { return $builder->arrayNode('ottrace'); diff --git a/tests/Unit/Config/SDK/Configuration/ExampleSdk/Propagator/TextMapPropagatorTraceContext.php b/tests/Unit/Config/SDK/Configuration/ExampleSdk/Propagator/TextMapPropagatorTraceContext.php index 548259ae9..08c086bcf 100644 --- a/tests/Unit/Config/SDK/Configuration/ExampleSdk/Propagator/TextMapPropagatorTraceContext.php +++ b/tests/Unit/Config/SDK/Configuration/ExampleSdk/Propagator/TextMapPropagatorTraceContext.php @@ -17,11 +17,13 @@ final class TextMapPropagatorTraceContext implements ComponentProvider /** * @param array{} $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): TextMapPropagatorInterface { throw new BadMethodCallException('not implemented'); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { return $builder->arrayNode('tracecontext'); diff --git a/tests/Unit/Config/SDK/Configuration/ExampleSdk/Propagator/TextMapPropagatorXRay.php b/tests/Unit/Config/SDK/Configuration/ExampleSdk/Propagator/TextMapPropagatorXRay.php index 1e71324e5..a944e0b05 100644 --- a/tests/Unit/Config/SDK/Configuration/ExampleSdk/Propagator/TextMapPropagatorXRay.php +++ b/tests/Unit/Config/SDK/Configuration/ExampleSdk/Propagator/TextMapPropagatorXRay.php @@ -17,11 +17,13 @@ final class TextMapPropagatorXRay implements ComponentProvider /** * @param array{} $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): TextMapPropagatorInterface { throw new BadMethodCallException('not implemented'); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { return $builder->arrayNode('xray'); diff --git a/tests/Unit/Config/SDK/Configuration/ExampleSdk/Trace/SamplerAlwaysOff.php b/tests/Unit/Config/SDK/Configuration/ExampleSdk/Trace/SamplerAlwaysOff.php index e308cfc33..c4894cd44 100644 --- a/tests/Unit/Config/SDK/Configuration/ExampleSdk/Trace/SamplerAlwaysOff.php +++ b/tests/Unit/Config/SDK/Configuration/ExampleSdk/Trace/SamplerAlwaysOff.php @@ -17,11 +17,13 @@ final class SamplerAlwaysOff implements ComponentProvider /** * @param array{} $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): Sampler { throw new BadMethodCallException('not implemented'); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { return $builder->arrayNode('always_off'); diff --git a/tests/Unit/Config/SDK/Configuration/ExampleSdk/Trace/SamplerAlwaysOn.php b/tests/Unit/Config/SDK/Configuration/ExampleSdk/Trace/SamplerAlwaysOn.php index 6cdbe546d..66df4a05e 100644 --- a/tests/Unit/Config/SDK/Configuration/ExampleSdk/Trace/SamplerAlwaysOn.php +++ b/tests/Unit/Config/SDK/Configuration/ExampleSdk/Trace/SamplerAlwaysOn.php @@ -17,11 +17,13 @@ final class SamplerAlwaysOn implements ComponentProvider /** * @param array{} $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): Sampler { throw new BadMethodCallException('not implemented'); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { return $builder->arrayNode('always_on'); diff --git a/tests/Unit/Config/SDK/Configuration/ExampleSdk/Trace/SamplerParentBased.php b/tests/Unit/Config/SDK/Configuration/ExampleSdk/Trace/SamplerParentBased.php index 9a734d7d7..fdf97e424 100644 --- a/tests/Unit/Config/SDK/Configuration/ExampleSdk/Trace/SamplerParentBased.php +++ b/tests/Unit/Config/SDK/Configuration/ExampleSdk/Trace/SamplerParentBased.php @@ -24,11 +24,13 @@ final class SamplerParentBased implements ComponentProvider * local_parent_not_sampled: ?ComponentPlugin, * } $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): Sampler { throw new BadMethodCallException('not implemented'); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { $node = $builder->arrayNode('parent_based'); diff --git a/tests/Unit/Config/SDK/Configuration/ExampleSdk/Trace/SamplerTraceIdRatioBased.php b/tests/Unit/Config/SDK/Configuration/ExampleSdk/Trace/SamplerTraceIdRatioBased.php index 91aeac3fd..e3114b9ac 100644 --- a/tests/Unit/Config/SDK/Configuration/ExampleSdk/Trace/SamplerTraceIdRatioBased.php +++ b/tests/Unit/Config/SDK/Configuration/ExampleSdk/Trace/SamplerTraceIdRatioBased.php @@ -19,11 +19,13 @@ final class SamplerTraceIdRatioBased implements ComponentProvider * ratio: float, * } $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): Sampler { throw new BadMethodCallException('not implemented'); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { $node = $builder->arrayNode('trace_id_ratio_based'); diff --git a/tests/Unit/Config/SDK/Configuration/ExampleSdk/Trace/SpanExporterConsole.php b/tests/Unit/Config/SDK/Configuration/ExampleSdk/Trace/SpanExporterConsole.php index 58fbcb672..88909b845 100644 --- a/tests/Unit/Config/SDK/Configuration/ExampleSdk/Trace/SpanExporterConsole.php +++ b/tests/Unit/Config/SDK/Configuration/ExampleSdk/Trace/SpanExporterConsole.php @@ -17,11 +17,13 @@ final class SpanExporterConsole implements ComponentProvider /** * @param array{} $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): SpanExporter { throw new BadMethodCallException('not implemented'); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { return $builder->arrayNode('console'); diff --git a/tests/Unit/Config/SDK/Configuration/ExampleSdk/Trace/SpanExporterOtlp.php b/tests/Unit/Config/SDK/Configuration/ExampleSdk/Trace/SpanExporterOtlp.php index f9b2d0793..e565083fc 100644 --- a/tests/Unit/Config/SDK/Configuration/ExampleSdk/Trace/SpanExporterOtlp.php +++ b/tests/Unit/Config/SDK/Configuration/ExampleSdk/Trace/SpanExporterOtlp.php @@ -27,11 +27,13 @@ final class SpanExporterOtlp implements ComponentProvider * timeout: int<0, max>, * } $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): SpanExporter { throw new BadMethodCallException('not implemented'); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { $node = $builder->arrayNode('otlp'); diff --git a/tests/Unit/Config/SDK/Configuration/ExampleSdk/Trace/SpanExporterZipkin.php b/tests/Unit/Config/SDK/Configuration/ExampleSdk/Trace/SpanExporterZipkin.php index a17d6614f..12cdee669 100644 --- a/tests/Unit/Config/SDK/Configuration/ExampleSdk/Trace/SpanExporterZipkin.php +++ b/tests/Unit/Config/SDK/Configuration/ExampleSdk/Trace/SpanExporterZipkin.php @@ -21,11 +21,13 @@ final class SpanExporterZipkin implements ComponentProvider * timeout: int<0, max>, * } $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): SpanExporter { throw new BadMethodCallException('not implemented'); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { $node = $builder->arrayNode('zipkin'); diff --git a/tests/Unit/Config/SDK/Configuration/ExampleSdk/Trace/SpanProcessorBatch.php b/tests/Unit/Config/SDK/Configuration/ExampleSdk/Trace/SpanProcessorBatch.php index b3c579b42..1bd619509 100644 --- a/tests/Unit/Config/SDK/Configuration/ExampleSdk/Trace/SpanProcessorBatch.php +++ b/tests/Unit/Config/SDK/Configuration/ExampleSdk/Trace/SpanProcessorBatch.php @@ -25,11 +25,13 @@ final class SpanProcessorBatch implements ComponentProvider * exporter: ComponentPlugin, * } $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): SpanProcessor { throw new BadMethodCallException('not implemented'); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { $node = $builder->arrayNode('batch'); diff --git a/tests/Unit/Config/SDK/Configuration/ExampleSdk/Trace/SpanProcessorSimple.php b/tests/Unit/Config/SDK/Configuration/ExampleSdk/Trace/SpanProcessorSimple.php index 7c418192a..9095ad151 100644 --- a/tests/Unit/Config/SDK/Configuration/ExampleSdk/Trace/SpanProcessorSimple.php +++ b/tests/Unit/Config/SDK/Configuration/ExampleSdk/Trace/SpanProcessorSimple.php @@ -21,11 +21,13 @@ final class SpanProcessorSimple implements ComponentProvider * exporter: ComponentPlugin, * } $properties */ + #[\Override] public function createPlugin(array $properties, Context $context): SpanProcessor { throw new BadMethodCallException('not implemented'); } + #[\Override] public function getConfig(ComponentProviderRegistry $registry, NodeBuilder $builder): ArrayNodeDefinition { $node = $builder->arrayNode('simple'); diff --git a/tests/Unit/Context/DebugScopeTest.php b/tests/Unit/Context/DebugScopeTest.php index 93dda01f2..a46d3ebbd 100644 --- a/tests/Unit/Context/DebugScopeTest.php +++ b/tests/Unit/Context/DebugScopeTest.php @@ -17,6 +17,7 @@ #[CoversClass(Context::class)] final class DebugScopeTest extends TestCase { + #[\Override] public function setUp(): void { set_error_handler(static function (int $errno, string $errstr): never { @@ -24,6 +25,7 @@ public function setUp(): void }, E_USER_NOTICE); } + #[\Override] public function tearDown(): void { restore_error_handler(); diff --git a/tests/Unit/Context/Propagation/MultiTextMapPropagatorTest.php b/tests/Unit/Context/Propagation/MultiTextMapPropagatorTest.php index 0df7327f4..8282c6558 100644 --- a/tests/Unit/Context/Propagation/MultiTextMapPropagatorTest.php +++ b/tests/Unit/Context/Propagation/MultiTextMapPropagatorTest.php @@ -23,6 +23,7 @@ class MultiTextMapPropagatorTest extends MockeryTestCase /** @var Mockery\MockInterface&TextMapPropagatorInterface */ private $propagator3; + #[\Override] protected function setUp(): void { $this->propagator1 = Mockery::mock(TextMapPropagatorInterface::class); diff --git a/tests/Unit/Context/Propagation/SanitizeCombinedHeadersPropagationGetterTest.php b/tests/Unit/Context/Propagation/SanitizeCombinedHeadersPropagationGetterTest.php index 37f6e89eb..8b6f7f91c 100644 --- a/tests/Unit/Context/Propagation/SanitizeCombinedHeadersPropagationGetterTest.php +++ b/tests/Unit/Context/Propagation/SanitizeCombinedHeadersPropagationGetterTest.php @@ -20,6 +20,7 @@ class SanitizeCombinedHeadersPropagationGetterTest extends MockeryTestCase /** @var Mockery\MockInterface&ExtendedPropagationGetterInterface */ private $extendedPropagationGetter; + #[\Override] protected function setUp(): void { $this->propagationGetter = Mockery::mock(PropagationGetterInterface::class); diff --git a/tests/Unit/Contrib/Grpc/GrpcTransportTest.php b/tests/Unit/Contrib/Grpc/GrpcTransportTest.php index bfca24ba8..d92f04927 100644 --- a/tests/Unit/Contrib/Grpc/GrpcTransportTest.php +++ b/tests/Unit/Contrib/Grpc/GrpcTransportTest.php @@ -16,6 +16,7 @@ final class GrpcTransportTest extends TestCase { private GrpcTransport $transport; + #[\Override] public function setUp(): void { $this->transport = new GrpcTransport('http://localhost:4317', [], '/method', [], 123); diff --git a/tests/Unit/Contrib/Otlp/LogsConverterTest.php b/tests/Unit/Contrib/Otlp/LogsConverterTest.php index 705746d75..4ed7da8a1 100644 --- a/tests/Unit/Contrib/Otlp/LogsConverterTest.php +++ b/tests/Unit/Contrib/Otlp/LogsConverterTest.php @@ -24,6 +24,7 @@ class LogsConverterTest extends TestCase private $record; private LogsConverter $converter; + #[\Override] public function setUp(): void { $this->converter = new LogsConverter(); diff --git a/tests/Unit/Contrib/Otlp/LogsExporterFactoryTest.php b/tests/Unit/Contrib/Otlp/LogsExporterFactoryTest.php index 9a2d22f57..5b774de9b 100644 --- a/tests/Unit/Contrib/Otlp/LogsExporterFactoryTest.php +++ b/tests/Unit/Contrib/Otlp/LogsExporterFactoryTest.php @@ -26,6 +26,7 @@ class LogsExporterFactoryTest extends TestCase /** @var TransportInterface&MockObject $record */ private TransportInterface $transport; + #[\Override] public function setUp(): void { $this->transportFactory = $this->createMock(TransportFactoryInterface::class); diff --git a/tests/Unit/Contrib/Otlp/LogsExporterTest.php b/tests/Unit/Contrib/Otlp/LogsExporterTest.php index a5e3857cb..425ecd6ee 100644 --- a/tests/Unit/Contrib/Otlp/LogsExporterTest.php +++ b/tests/Unit/Contrib/Otlp/LogsExporterTest.php @@ -19,6 +19,7 @@ class LogsExporterTest extends TestCase private MockObject $transport; private LogsExporter $exporter; + #[\Override] public function setUp(): void { $this->transport = $this->createMock(TransportInterface::class); diff --git a/tests/Unit/Contrib/Otlp/MetricExporterFactoryTest.php b/tests/Unit/Contrib/Otlp/MetricExporterFactoryTest.php index 774800dd4..7a4a08aaf 100644 --- a/tests/Unit/Contrib/Otlp/MetricExporterFactoryTest.php +++ b/tests/Unit/Contrib/Otlp/MetricExporterFactoryTest.php @@ -28,6 +28,7 @@ class MetricExporterFactoryTest extends TestCase private TransportFactoryInterface $transportFactory; private TransportInterface $transport; + #[\Override] public function setUp(): void { $this->transportFactory = $this->createMock(TransportFactoryInterface::class); diff --git a/tests/Unit/Contrib/Otlp/MetricExporterTest.php b/tests/Unit/Contrib/Otlp/MetricExporterTest.php index 8471596f7..63d7391d0 100644 --- a/tests/Unit/Contrib/Otlp/MetricExporterTest.php +++ b/tests/Unit/Contrib/Otlp/MetricExporterTest.php @@ -25,6 +25,7 @@ final class MetricExporterTest extends TestCase private $stream; private MetricExporter $exporter; + #[\Override] public function setUp(): void { $this->stream = fopen('php://memory', 'a+b'); diff --git a/tests/Unit/Contrib/Otlp/OtlpHttpTransportFactoryTest.php b/tests/Unit/Contrib/Otlp/OtlpHttpTransportFactoryTest.php index a0c11ddeb..fb1751ee9 100644 --- a/tests/Unit/Contrib/Otlp/OtlpHttpTransportFactoryTest.php +++ b/tests/Unit/Contrib/Otlp/OtlpHttpTransportFactoryTest.php @@ -14,6 +14,7 @@ class OtlpHttpTransportFactoryTest extends TestCase { private OtlpHttpTransportFactory $factory; + #[\Override] public function setUp(): void { $this->factory = new OtlpHttpTransportFactory(); diff --git a/tests/Unit/Contrib/Otlp/SpanExporterFactoryTest.php b/tests/Unit/Contrib/Otlp/SpanExporterFactoryTest.php index 015801562..5a936d82d 100644 --- a/tests/Unit/Contrib/Otlp/SpanExporterFactoryTest.php +++ b/tests/Unit/Contrib/Otlp/SpanExporterFactoryTest.php @@ -25,6 +25,7 @@ class SpanExporterFactoryTest extends TestCase private TransportFactoryInterface $transportFactory; private TransportInterface $transport; + #[\Override] public function setUp(): void { $this->transportFactory = $this->createMock(TransportFactoryInterface::class); diff --git a/tests/Unit/Contrib/Otlp/SpanExporterTest.php b/tests/Unit/Contrib/Otlp/SpanExporterTest.php index 213ee193f..473f17b61 100644 --- a/tests/Unit/Contrib/Otlp/SpanExporterTest.php +++ b/tests/Unit/Contrib/Otlp/SpanExporterTest.php @@ -24,6 +24,7 @@ class SpanExporterTest extends TestCase private MockObject $transport; private SpanExporter $exporter; + #[\Override] public function setUp(): void { Logging::disable(); diff --git a/tests/Unit/Contrib/Zipkin/ZipkinExporterTest.php b/tests/Unit/Contrib/Zipkin/ZipkinExporterTest.php index e2a29eb70..b9803c2e1 100644 --- a/tests/Unit/Contrib/Zipkin/ZipkinExporterTest.php +++ b/tests/Unit/Contrib/Zipkin/ZipkinExporterTest.php @@ -16,6 +16,7 @@ class ZipkinExporterTest extends AbstractExporterTestCase /** * @psalm-suppress PossiblyInvalidArgument */ + #[\Override] public function createExporterWithTransport(TransportInterface $transport): Exporter { return new Exporter( @@ -23,6 +24,7 @@ public function createExporterWithTransport(TransportInterface $transport): Expo ); } + #[\Override] public function getExporterClass(): string { return Exporter::class; diff --git a/tests/Unit/Extension/Propagator/B3/B3MultiPropagatorTest.php b/tests/Unit/Extension/Propagator/B3/B3MultiPropagatorTest.php index 5ee44e54b..c9d8b9a2c 100644 --- a/tests/Unit/Extension/Propagator/B3/B3MultiPropagatorTest.php +++ b/tests/Unit/Extension/Propagator/B3/B3MultiPropagatorTest.php @@ -32,6 +32,7 @@ class B3MultiPropagatorTest extends TestCase private B3MultiPropagator $b3MultiPropagator; + #[\Override] protected function setUp(): void { $this->b3MultiPropagator = B3MultiPropagator::getInstance(); diff --git a/tests/Unit/Extension/Propagator/B3/B3PropagatorTest.php b/tests/Unit/Extension/Propagator/B3/B3PropagatorTest.php index 8cf8598ca..5e778b84f 100644 --- a/tests/Unit/Extension/Propagator/B3/B3PropagatorTest.php +++ b/tests/Unit/Extension/Propagator/B3/B3PropagatorTest.php @@ -36,6 +36,7 @@ class B3PropagatorTest extends TestCase /** * @psalm-suppress PossiblyUndefinedArrayOffset */ + #[\Override] public function setUp(): void { [$this->b3] = B3SinglePropagator::getInstance()->fields(); diff --git a/tests/Unit/Extension/Propagator/B3/B3SinglePropagatorTest.php b/tests/Unit/Extension/Propagator/B3/B3SinglePropagatorTest.php index c2b2033df..45165a894 100644 --- a/tests/Unit/Extension/Propagator/B3/B3SinglePropagatorTest.php +++ b/tests/Unit/Extension/Propagator/B3/B3SinglePropagatorTest.php @@ -35,6 +35,7 @@ class B3SinglePropagatorTest extends TestCase /** * @psalm-suppress PossiblyUndefinedArrayOffset */ + #[\Override] protected function setUp(): void { $this->b3SinglePropagator = B3SinglePropagator::getInstance(); diff --git a/tests/Unit/Extension/Propagator/CloudTrace/CloudTracePropagatorOneWayTest.php b/tests/Unit/Extension/Propagator/CloudTrace/CloudTracePropagatorOneWayTest.php index cf104ac0f..5d5388e12 100644 --- a/tests/Unit/Extension/Propagator/CloudTrace/CloudTracePropagatorOneWayTest.php +++ b/tests/Unit/Extension/Propagator/CloudTrace/CloudTracePropagatorOneWayTest.php @@ -32,6 +32,7 @@ class CloudTracePropagatorOneWayTest extends TestCase /** * @psalm-suppress PossiblyUndefinedArrayOffset */ + #[\Override] protected function setUp(): void { $this->cloudTracePropagator = CloudTracePropagator::getOneWayInstance(); diff --git a/tests/Unit/Extension/Propagator/CloudTrace/CloudTracePropagatorTest.php b/tests/Unit/Extension/Propagator/CloudTrace/CloudTracePropagatorTest.php index 66aacc5d2..5397cda23 100644 --- a/tests/Unit/Extension/Propagator/CloudTrace/CloudTracePropagatorTest.php +++ b/tests/Unit/Extension/Propagator/CloudTrace/CloudTracePropagatorTest.php @@ -32,6 +32,7 @@ class CloudTracePropagatorTest extends TestCase /** * @psalm-suppress PossiblyUndefinedArrayOffset */ + #[\Override] protected function setUp(): void { $this->cloudTracePropagator = CloudTracePropagator::getInstance(); diff --git a/tests/Unit/Extension/Propagator/Jaeger/JaegerBaggagePropagatorTest.php b/tests/Unit/Extension/Propagator/Jaeger/JaegerBaggagePropagatorTest.php index fdaa1b867..7bf838c16 100644 --- a/tests/Unit/Extension/Propagator/Jaeger/JaegerBaggagePropagatorTest.php +++ b/tests/Unit/Extension/Propagator/Jaeger/JaegerBaggagePropagatorTest.php @@ -16,6 +16,7 @@ class JaegerBaggagePropagatorTest extends TestCase { private TextMapPropagatorInterface $propagator; + #[\Override] protected function setUp(): void { $this->propagator = JaegerBaggagePropagator::getInstance(); diff --git a/tests/Unit/Extension/Propagator/Jaeger/JaegerPropagatorTest.php b/tests/Unit/Extension/Propagator/Jaeger/JaegerPropagatorTest.php index 8e18045b7..2ad2c50b2 100644 --- a/tests/Unit/Extension/Propagator/Jaeger/JaegerPropagatorTest.php +++ b/tests/Unit/Extension/Propagator/Jaeger/JaegerPropagatorTest.php @@ -50,6 +50,7 @@ private function generateTraceIdHeaderValue( /** * @psalm-suppress PossiblyUndefinedArrayOffset */ + #[\Override] protected function setUp(): void { $this->propagator = JaegerPropagator::getInstance(); diff --git a/tests/Unit/SDK/Common/Adapter/HttpDiscovery/MessageFactoryResolverTest.php b/tests/Unit/SDK/Common/Adapter/HttpDiscovery/MessageFactoryResolverTest.php index ea81d137c..5ffda9487 100644 --- a/tests/Unit/SDK/Common/Adapter/HttpDiscovery/MessageFactoryResolverTest.php +++ b/tests/Unit/SDK/Common/Adapter/HttpDiscovery/MessageFactoryResolverTest.php @@ -32,6 +32,7 @@ class MessageFactoryResolverTest extends TestCase UriFactoryInterface::class, ]; + #[\Override] public function setUp(): void { Psr18ClientDiscovery::prependStrategy(MockClientStrategy::class); diff --git a/tests/Unit/SDK/Common/Adapter/HttpDiscovery/PsrClientResolverTest.php b/tests/Unit/SDK/Common/Adapter/HttpDiscovery/PsrClientResolverTest.php index aeb0878fe..9518d3922 100644 --- a/tests/Unit/SDK/Common/Adapter/HttpDiscovery/PsrClientResolverTest.php +++ b/tests/Unit/SDK/Common/Adapter/HttpDiscovery/PsrClientResolverTest.php @@ -14,6 +14,7 @@ #[CoversClass(PsrClientResolver::class)] class PsrClientResolverTest extends TestCase { + #[\Override] public function setUp(): void { HttpClientDiscovery::prependStrategy(MockClientStrategy::class); diff --git a/tests/Unit/SDK/Common/Attribute/AttributeValidatorTest.php b/tests/Unit/SDK/Common/Attribute/AttributeValidatorTest.php index b2ebbe7db..963b39a3d 100644 --- a/tests/Unit/SDK/Common/Attribute/AttributeValidatorTest.php +++ b/tests/Unit/SDK/Common/Attribute/AttributeValidatorTest.php @@ -14,6 +14,7 @@ class AttributeValidatorTest extends TestCase { private AttributeValidator $validator; + #[\Override] public function setUp(): void { $this->validator = new AttributeValidator(); diff --git a/tests/Unit/SDK/Common/Configuration/Resolver/CompositeResolverTest.php b/tests/Unit/SDK/Common/Configuration/Resolver/CompositeResolverTest.php index 479a3a8e5..769dd26eb 100644 --- a/tests/Unit/SDK/Common/Configuration/Resolver/CompositeResolverTest.php +++ b/tests/Unit/SDK/Common/Configuration/Resolver/CompositeResolverTest.php @@ -22,6 +22,7 @@ class CompositeResolverTest extends TestCase private ResolverInterface $two; private CompositeResolver $resolver; + #[\Override] public function setUp(): void { $this->one = $this->createMock(ResolverInterface::class); diff --git a/tests/Unit/SDK/Common/Configuration/Resolver/EnvironmentResolverTest.php b/tests/Unit/SDK/Common/Configuration/Resolver/EnvironmentResolverTest.php index 3681927a5..3279df6fc 100644 --- a/tests/Unit/SDK/Common/Configuration/Resolver/EnvironmentResolverTest.php +++ b/tests/Unit/SDK/Common/Configuration/Resolver/EnvironmentResolverTest.php @@ -25,6 +25,7 @@ class EnvironmentResolverTest extends TestCase private EnvironmentResolver $resolver; + #[\Override] public function setUp(): void { $this->resolver = new EnvironmentResolver(); diff --git a/tests/Unit/SDK/Common/Configuration/Resolver/PhpIniResolverTest.php b/tests/Unit/SDK/Common/Configuration/Resolver/PhpIniResolverTest.php index cd008b60d..575e40255 100644 --- a/tests/Unit/SDK/Common/Configuration/Resolver/PhpIniResolverTest.php +++ b/tests/Unit/SDK/Common/Configuration/Resolver/PhpIniResolverTest.php @@ -19,6 +19,7 @@ class PhpIniResolverTest extends TestCase private PhpIniAccessor $accessor; private PhpIniResolver $resolver; + #[\Override] public function setUp(): void { $this->accessor = $this->createMock(PhpIniAccessor::class); diff --git a/tests/Unit/SDK/Common/Dev/Compatibility/UtilTest.php b/tests/Unit/SDK/Common/Dev/Compatibility/UtilTest.php index e45ed18b6..50382b629 100644 --- a/tests/Unit/SDK/Common/Dev/Compatibility/UtilTest.php +++ b/tests/Unit/SDK/Common/Dev/Compatibility/UtilTest.php @@ -14,6 +14,7 @@ #[CoversClass(Util::class)] class UtilTest extends TestCase { + #[\Override] public function setUp(): void { set_error_handler(static function (int $errno, string $errstr): never { @@ -21,6 +22,7 @@ public function setUp(): void }, E_USER_WARNING|E_USER_NOTICE|E_USER_ERROR|E_USER_DEPRECATED); } + #[\Override] public function tearDown(): void { Util::setErrorLevel(); diff --git a/tests/Unit/SDK/Common/Export/Http/PsrTransportTest.php b/tests/Unit/SDK/Common/Export/Http/PsrTransportTest.php index efc09b42c..60f5e6498 100644 --- a/tests/Unit/SDK/Common/Export/Http/PsrTransportTest.php +++ b/tests/Unit/SDK/Common/Export/Http/PsrTransportTest.php @@ -30,6 +30,7 @@ final class PsrTransportTest extends TestCase private MockObject $client; private PsrTransportFactory $factory; + #[\Override] public function setUp(): void { $this->client = $this->createMock(ClientInterface::class); @@ -157,6 +158,7 @@ public function test_send_number_of_retries(): void public function test_send_retry_network_exception_returns_error(): void { $e = new class('network error') extends \Exception implements NetworkExceptionInterface { + #[\Override] public function getRequest(): RequestInterface { return new Request('GET', 'http://localhost'); diff --git a/tests/Unit/SDK/Common/Http/Psr/Client/Discovery/BuzzTest.php b/tests/Unit/SDK/Common/Http/Psr/Client/Discovery/BuzzTest.php index 9c192c617..93b7a5793 100644 --- a/tests/Unit/SDK/Common/Http/Psr/Client/Discovery/BuzzTest.php +++ b/tests/Unit/SDK/Common/Http/Psr/Client/Discovery/BuzzTest.php @@ -11,6 +11,7 @@ #[CoversClass(Buzz::class)] class BuzzTest extends AbstractDiscoveryTestCase { + #[\Override] public function getInstance(): DiscoveryInterface { return new Buzz(); diff --git a/tests/Unit/SDK/Common/Http/Psr/Client/Discovery/CurlClientTest.php b/tests/Unit/SDK/Common/Http/Psr/Client/Discovery/CurlClientTest.php index 0c9bb72c1..db43b39e4 100644 --- a/tests/Unit/SDK/Common/Http/Psr/Client/Discovery/CurlClientTest.php +++ b/tests/Unit/SDK/Common/Http/Psr/Client/Discovery/CurlClientTest.php @@ -11,6 +11,7 @@ #[CoversClass(CurlClient::class)] class CurlClientTest extends AbstractDiscoveryTestCase { + #[\Override] public function getInstance(): DiscoveryInterface { return new CurlClient(); diff --git a/tests/Unit/SDK/Common/Http/Psr/Client/Discovery/GuzzleTest.php b/tests/Unit/SDK/Common/Http/Psr/Client/Discovery/GuzzleTest.php index d2d17742a..28ab17a99 100644 --- a/tests/Unit/SDK/Common/Http/Psr/Client/Discovery/GuzzleTest.php +++ b/tests/Unit/SDK/Common/Http/Psr/Client/Discovery/GuzzleTest.php @@ -11,6 +11,7 @@ #[CoversClass(Guzzle::class)] class GuzzleTest extends AbstractDiscoveryTestCase { + #[\Override] public function getInstance(): DiscoveryInterface { return new Guzzle(); diff --git a/tests/Unit/SDK/Common/Http/Psr/Client/Discovery/SymfonyTest.php b/tests/Unit/SDK/Common/Http/Psr/Client/Discovery/SymfonyTest.php index 6cc611712..ca0620540 100644 --- a/tests/Unit/SDK/Common/Http/Psr/Client/Discovery/SymfonyTest.php +++ b/tests/Unit/SDK/Common/Http/Psr/Client/Discovery/SymfonyTest.php @@ -11,6 +11,7 @@ #[CoversClass(Symfony::class)] class SymfonyTest extends AbstractDiscoveryTestCase { + #[\Override] public function getInstance(): DiscoveryInterface { return new Symfony(); diff --git a/tests/Unit/SDK/Common/InstrumentationScope/ConfigTest.php b/tests/Unit/SDK/Common/InstrumentationScope/ConfigTest.php index cb152621b..8e83d2355 100644 --- a/tests/Unit/SDK/Common/InstrumentationScope/ConfigTest.php +++ b/tests/Unit/SDK/Common/InstrumentationScope/ConfigTest.php @@ -16,6 +16,7 @@ class ConfigTest extends TestCase { private Config $config; + #[\Override] public function setUp(): void { $this->config = new class() implements Config { diff --git a/tests/Unit/SDK/Common/InstrumentationScope/ConfiguratorTest.php b/tests/Unit/SDK/Common/InstrumentationScope/ConfiguratorTest.php index 40c80d0b6..b986451aa 100644 --- a/tests/Unit/SDK/Common/InstrumentationScope/ConfiguratorTest.php +++ b/tests/Unit/SDK/Common/InstrumentationScope/ConfiguratorTest.php @@ -17,14 +17,17 @@ class ConfiguratorTest extends TestCase private Configurator $configurator; private InstrumentationScope $scope; + #[\Override] public function setUp(): void { $config = new class() implements Config { private bool $disabled = false; + #[\Override] public function setDisabled(bool $disabled): void { $this->disabled = $disabled; } + #[\Override] public function isEnabled(): bool { return $this->disabled === false; diff --git a/tests/Unit/SDK/Logs/EventLoggerProviderTest.php b/tests/Unit/SDK/Logs/EventLoggerProviderTest.php index d0f890201..57cd9394e 100644 --- a/tests/Unit/SDK/Logs/EventLoggerProviderTest.php +++ b/tests/Unit/SDK/Logs/EventLoggerProviderTest.php @@ -19,6 +19,7 @@ class EventLoggerProviderTest extends TestCase private LoggerProviderInterface $loggerProvider; private LoggerInterface $logger; + #[\Override] public function setUp(): void { $this->loggerProvider = $this->createMock(LoggerProviderInterface::class); diff --git a/tests/Unit/SDK/Logs/EventLoggerTest.php b/tests/Unit/SDK/Logs/EventLoggerTest.php index d7f65f5cc..c902036ee 100644 --- a/tests/Unit/SDK/Logs/EventLoggerTest.php +++ b/tests/Unit/SDK/Logs/EventLoggerTest.php @@ -24,6 +24,7 @@ class EventLoggerTest extends TestCase private EventLoggerProvider $eventLoggerProvider; private TestClock $clock; + #[\Override] public function setUp(): void { $this->clock = new TestClock(); diff --git a/tests/Unit/SDK/Logs/Exporter/ConsoleExporterTest.php b/tests/Unit/SDK/Logs/Exporter/ConsoleExporterTest.php index 0ccb2566a..0ac38326f 100644 --- a/tests/Unit/SDK/Logs/Exporter/ConsoleExporterTest.php +++ b/tests/Unit/SDK/Logs/Exporter/ConsoleExporterTest.php @@ -22,6 +22,7 @@ class ConsoleExporterTest extends TestCase private TransportInterface $transport; private ConsoleExporter $exporter; + #[\Override] public function setUp(): void { $this->transport = $this->createMock(TransportInterface::class); diff --git a/tests/Unit/SDK/Logs/Exporter/NoopExporterTest.php b/tests/Unit/SDK/Logs/Exporter/NoopExporterTest.php index dee1b6f97..93469428e 100644 --- a/tests/Unit/SDK/Logs/Exporter/NoopExporterTest.php +++ b/tests/Unit/SDK/Logs/Exporter/NoopExporterTest.php @@ -13,6 +13,7 @@ class NoopExporterTest extends TestCase { private NoopExporter $exporter; + #[\Override] public function setUp(): void { $this->exporter = new NoopExporter(); diff --git a/tests/Unit/SDK/Logs/LoggerProviderTest.php b/tests/Unit/SDK/Logs/LoggerProviderTest.php index aab31318a..a5b434b17 100644 --- a/tests/Unit/SDK/Logs/LoggerProviderTest.php +++ b/tests/Unit/SDK/Logs/LoggerProviderTest.php @@ -32,6 +32,7 @@ class LoggerProviderTest extends TestCase /** @var Config&MockObject */ private Config $config; + #[\Override] public function setUp(): void { $this->processor = $this->createMock(LogRecordProcessorInterface::class); diff --git a/tests/Unit/SDK/Logs/LoggerSharedStateTest.php b/tests/Unit/SDK/Logs/LoggerSharedStateTest.php index 4e36f0cbe..08564c3bc 100644 --- a/tests/Unit/SDK/Logs/LoggerSharedStateTest.php +++ b/tests/Unit/SDK/Logs/LoggerSharedStateTest.php @@ -22,6 +22,7 @@ class LoggerSharedStateTest extends TestCase private LogRecordLimits $limits; private LoggerSharedState $loggerSharedState; + #[\Override] public function setUp(): void { $this->resource = $this->createMock(ResourceInfo::class); diff --git a/tests/Unit/SDK/Logs/LoggerTest.php b/tests/Unit/SDK/Logs/LoggerTest.php index 0b9735203..3dd185be2 100644 --- a/tests/Unit/SDK/Logs/LoggerTest.php +++ b/tests/Unit/SDK/Logs/LoggerTest.php @@ -33,6 +33,7 @@ class LoggerTest extends TestCase private LogRecordProcessorInterface $processor; private InstrumentationScope $scope; + #[\Override] public function setUp(): void { $limits = (new LogRecordLimitsBuilder())->setAttributeCountLimit(1)->build(); @@ -46,6 +47,7 @@ public function setUp(): void Logging::setLogWriter($this->logWriter); } + #[\Override] public function tearDown(): void { Logging::reset(); diff --git a/tests/Unit/SDK/Logs/Processor/BatchLogRecordProcessorTest.php b/tests/Unit/SDK/Logs/Processor/BatchLogRecordProcessorTest.php index e0416f8e4..2a4d63404 100644 --- a/tests/Unit/SDK/Logs/Processor/BatchLogRecordProcessorTest.php +++ b/tests/Unit/SDK/Logs/Processor/BatchLogRecordProcessorTest.php @@ -39,6 +39,7 @@ class BatchLogRecordProcessorTest extends MockeryTestCase /** @var LogWriterInterface&MockObject $logWriter */ private LogWriterInterface $logWriter; + #[\Override] protected function setUp(): void { $this->logWriter = $this->createMock(LogWriterInterface::class); diff --git a/tests/Unit/SDK/Logs/Processor/MultiLogRecordProcessorTest.php b/tests/Unit/SDK/Logs/Processor/MultiLogRecordProcessorTest.php index 21d1ae535..9631624df 100644 --- a/tests/Unit/SDK/Logs/Processor/MultiLogRecordProcessorTest.php +++ b/tests/Unit/SDK/Logs/Processor/MultiLogRecordProcessorTest.php @@ -19,6 +19,7 @@ class MultiLogRecordProcessorTest extends MockeryTestCase private array $processors; private MultiLogRecordProcessor $multi; + #[\Override] public function setUp(): void { $this->processors = [ diff --git a/tests/Unit/SDK/Logs/Processor/SimpleLogRecordProcessorTest.php b/tests/Unit/SDK/Logs/Processor/SimpleLogRecordProcessorTest.php index d490b4dc8..139b1772e 100644 --- a/tests/Unit/SDK/Logs/Processor/SimpleLogRecordProcessorTest.php +++ b/tests/Unit/SDK/Logs/Processor/SimpleLogRecordProcessorTest.php @@ -23,6 +23,7 @@ class SimpleLogRecordProcessorTest extends TestCase private LogRecordExporterInterface $exporter; private ReadWriteLogRecord $readWriteLogRecord; + #[\Override] public function setUp(): void { $this->exporter = $this->createMock(LogRecordExporterInterface::class); diff --git a/tests/Unit/SDK/Logs/ReadableLogRecordTest.php b/tests/Unit/SDK/Logs/ReadableLogRecordTest.php index dab9bffa8..a79d48b31 100644 --- a/tests/Unit/SDK/Logs/ReadableLogRecordTest.php +++ b/tests/Unit/SDK/Logs/ReadableLogRecordTest.php @@ -23,6 +23,7 @@ class ReadableLogRecordTest extends TestCase private ContextInterface $context; private LoggerSharedState $sharedState; private ResourceInfo $resource; + #[\Override] public function setUp(): void { $this->scope = $this->createMock(InstrumentationScopeInterface::class); diff --git a/tests/Unit/SDK/Logs/SimplePsrFileLoggerTest.php b/tests/Unit/SDK/Logs/SimplePsrFileLoggerTest.php index 57fab345a..1442950e6 100644 --- a/tests/Unit/SDK/Logs/SimplePsrFileLoggerTest.php +++ b/tests/Unit/SDK/Logs/SimplePsrFileLoggerTest.php @@ -33,6 +33,7 @@ class SimplePsrFileLoggerTest extends TestCase private SimplePsrFileLogger $logger; private vfsStreamDirectory $root; + #[\Override] public function setUp(): void { $this->root = vfsStream::setup(self::ROOT_DIR); diff --git a/tests/Unit/SDK/Metrics/MeterProviderFactoryTest.php b/tests/Unit/SDK/Metrics/MeterProviderFactoryTest.php index e02eed9bf..4b8b5a15c 100644 --- a/tests/Unit/SDK/Metrics/MeterProviderFactoryTest.php +++ b/tests/Unit/SDK/Metrics/MeterProviderFactoryTest.php @@ -19,6 +19,7 @@ class MeterProviderFactoryTest extends TestCase { use TestState; + #[\Override] public function setUp(): void { Logging::disable(); diff --git a/tests/Unit/SDK/Metrics/MetricFactory/StreamFactoryTest.php b/tests/Unit/SDK/Metrics/MetricFactory/StreamFactoryTest.php index 8c2902a8d..d6780041c 100644 --- a/tests/Unit/SDK/Metrics/MetricFactory/StreamFactoryTest.php +++ b/tests/Unit/SDK/Metrics/MetricFactory/StreamFactoryTest.php @@ -171,6 +171,7 @@ final class CollectingSourceRegistry implements MetricSourceRegistryInterface /** * @psalm-suppress InvalidPropertyAssignmentValue */ + #[\Override] public function add(MetricSourceProviderInterface $provider, MetricMetadataInterface $metadata, StalenessHandlerInterface $stalenessHandler): void { $this->sources[] = func_get_args(); diff --git a/tests/Unit/SDK/Metrics/Stream/MetricStreamTest.php b/tests/Unit/SDK/Metrics/Stream/MetricStreamTest.php index 55c80472a..99d45aad8 100644 --- a/tests/Unit/SDK/Metrics/Stream/MetricStreamTest.php +++ b/tests/Unit/SDK/Metrics/Stream/MetricStreamTest.php @@ -45,6 +45,7 @@ #[UsesClass(AttributesFactory::class)] final class MetricStreamTest extends TestCase { + #[\Override] public function setUp(): void { Logging::disable(); diff --git a/tests/Unit/SDK/Propagation/PropagatorFactoryTest.php b/tests/Unit/SDK/Propagation/PropagatorFactoryTest.php index 37accfa9f..489163e59 100644 --- a/tests/Unit/SDK/Propagation/PropagatorFactoryTest.php +++ b/tests/Unit/SDK/Propagation/PropagatorFactoryTest.php @@ -27,6 +27,7 @@ class PropagatorFactoryTest extends TestCase { use TestState; + #[\Override] public function setUp(): void { LoggerHolder::disable(); diff --git a/tests/Unit/SDK/Resource/Detectors/EnvironmentTest.php b/tests/Unit/SDK/Resource/Detectors/EnvironmentTest.php index ef2ec0cac..97645fe9f 100644 --- a/tests/Unit/SDK/Resource/Detectors/EnvironmentTest.php +++ b/tests/Unit/SDK/Resource/Detectors/EnvironmentTest.php @@ -18,6 +18,7 @@ class EnvironmentTest extends TestCase private Environment $detector; + #[\Override] public function setUp(): void { $this->detector = new Environment(); diff --git a/tests/Unit/SDK/Resource/Detectors/HostTest.php b/tests/Unit/SDK/Resource/Detectors/HostTest.php index 07308c303..15359967e 100644 --- a/tests/Unit/SDK/Resource/Detectors/HostTest.php +++ b/tests/Unit/SDK/Resource/Detectors/HostTest.php @@ -15,6 +15,7 @@ #[CoversClass(Host::class)] class HostTest extends TestCase { + #[\Override] public function setUp(): void { //reset vfs between tests diff --git a/tests/Unit/SDK/Resource/Detectors/SdkTest.php b/tests/Unit/SDK/Resource/Detectors/SdkTest.php index dc8adc26c..d40ab1d4e 100644 --- a/tests/Unit/SDK/Resource/Detectors/SdkTest.php +++ b/tests/Unit/SDK/Resource/Detectors/SdkTest.php @@ -19,6 +19,7 @@ class SdkTest extends TestCase private ResourceDetectorInterface $detector; + #[\Override] public function setUp(): void { $this->detector = new Sdk(); diff --git a/tests/Unit/SDK/Resource/Detectors/ServiceTest.php b/tests/Unit/SDK/Resource/Detectors/ServiceTest.php index 2ed89185e..d97f2ac55 100644 --- a/tests/Unit/SDK/Resource/Detectors/ServiceTest.php +++ b/tests/Unit/SDK/Resource/Detectors/ServiceTest.php @@ -19,6 +19,7 @@ class ServiceTest extends TestCase private Detectors\Service $detector; + #[\Override] public function setUp(): void { $this->detector = new Detectors\Service(); diff --git a/tests/Unit/SDK/Resource/ResourceInfoFactoryTest.php b/tests/Unit/SDK/Resource/ResourceInfoFactoryTest.php index 83e3723b4..0e375b54a 100644 --- a/tests/Unit/SDK/Resource/ResourceInfoFactoryTest.php +++ b/tests/Unit/SDK/Resource/ResourceInfoFactoryTest.php @@ -30,6 +30,7 @@ class ResourceInfoFactoryTest extends TestCase private LogWriterInterface $logWriter; private const UNDEFINED = '__undefined'; + #[\Override] public function setUp(): void { $this->logWriter = $this->createMock(LogWriterInterface::class); diff --git a/tests/Unit/SDK/Resource/ResourceInfoTest.php b/tests/Unit/SDK/Resource/ResourceInfoTest.php index a931837ba..2e5ea4056 100644 --- a/tests/Unit/SDK/Resource/ResourceInfoTest.php +++ b/tests/Unit/SDK/Resource/ResourceInfoTest.php @@ -23,6 +23,7 @@ class ResourceInfoTest extends TestCase { use TestState; + #[\Override] public function setUp(): void { Logging::disable(); diff --git a/tests/Unit/SDK/SdkAutoloaderTest.php b/tests/Unit/SDK/SdkAutoloaderTest.php index 7cdded3e5..540dee5d2 100644 --- a/tests/Unit/SDK/SdkAutoloaderTest.php +++ b/tests/Unit/SDK/SdkAutoloaderTest.php @@ -33,6 +33,7 @@ class SdkAutoloaderTest extends TestCase */ private LoggerInterface $logger; + #[\Override] public function setUp(): void { $this->logger = $this->createMock(LoggerInterface::class); diff --git a/tests/Unit/SDK/SdkBuilderTest.php b/tests/Unit/SDK/SdkBuilderTest.php index d9e3fa6f6..766356098 100644 --- a/tests/Unit/SDK/SdkBuilderTest.php +++ b/tests/Unit/SDK/SdkBuilderTest.php @@ -24,6 +24,7 @@ class SdkBuilderTest extends TestCase private EventLoggerProviderInterface $eventLoggerProvider; private SdkBuilder $builder; + #[\Override] public function setUp(): void { $this->propagator = $this->createMock(TextMapPropagatorInterface::class); diff --git a/tests/Unit/SDK/SdkTest.php b/tests/Unit/SDK/SdkTest.php index 084be21bb..a4834d7f9 100644 --- a/tests/Unit/SDK/SdkTest.php +++ b/tests/Unit/SDK/SdkTest.php @@ -28,6 +28,7 @@ class SdkTest extends TestCase private LoggerProviderInterface $loggerProvider; private EventLoggerProviderInterface $eventLoggerProvider; + #[\Override] public function setUp(): void { $this->propagator = $this->createMock(TextMapPropagatorInterface::class); @@ -37,6 +38,7 @@ public function setUp(): void $this->eventLoggerProvider = $this->createMock(EventLoggerProviderInterface::class); } + #[\Override] public function tearDown(): void { self::restoreEnvironmentVariables(); diff --git a/tests/Unit/SDK/Trace/AutoRootSpanTest.php b/tests/Unit/SDK/Trace/AutoRootSpanTest.php index 5c75acdc9..a53859f52 100644 --- a/tests/Unit/SDK/Trace/AutoRootSpanTest.php +++ b/tests/Unit/SDK/Trace/AutoRootSpanTest.php @@ -35,6 +35,7 @@ class AutoRootSpanTest extends TestCase private TracerInterface $tracer; private ScopeInterface $scope; + #[\Override] public function setUp(): void { $tracerProvider = $this->createMock(TracerProviderInterface::class); @@ -47,6 +48,7 @@ public function setUp(): void ->activate(); } + #[\Override] public function tearDown(): void { $this->scope->detach(); diff --git a/tests/Unit/SDK/Trace/ExporterFactoryTest.php b/tests/Unit/SDK/Trace/ExporterFactoryTest.php index 882992346..9e0462034 100644 --- a/tests/Unit/SDK/Trace/ExporterFactoryTest.php +++ b/tests/Unit/SDK/Trace/ExporterFactoryTest.php @@ -21,6 +21,7 @@ class ExporterFactoryTest extends TestCase { use TestState; + #[\Override] public function setUp(): void { Psr18ClientDiscovery::prependStrategy(MockClientStrategy::class); diff --git a/tests/Unit/SDK/Trace/ImmutableSpanTest.php b/tests/Unit/SDK/Trace/ImmutableSpanTest.php index 133a3b170..30c372acc 100644 --- a/tests/Unit/SDK/Trace/ImmutableSpanTest.php +++ b/tests/Unit/SDK/Trace/ImmutableSpanTest.php @@ -34,6 +34,7 @@ class ImmutableSpanTest extends TestCase private int $totalRecordedEvents = 1; private int $totalRecordedLinks = 1; + #[\Override] protected function setUp():void { $this->context = $this->createMock(API\SpanContextInterface::class); diff --git a/tests/Unit/SDK/Trace/LinkTest.php b/tests/Unit/SDK/Trace/LinkTest.php index c7f8d301a..7cbfb29f8 100644 --- a/tests/Unit/SDK/Trace/LinkTest.php +++ b/tests/Unit/SDK/Trace/LinkTest.php @@ -16,6 +16,7 @@ class LinkTest extends TestCase private API\SpanContextInterface $context; private AttributesInterface $attributes; + #[\Override] public function setUp(): void { $this->context = $this->createMock(API\SpanContextInterface::class); diff --git a/tests/Unit/SDK/Trace/Sampler/ParentBasedTest.php b/tests/Unit/SDK/Trace/Sampler/ParentBasedTest.php index bff4429c4..025ca6a21 100644 --- a/tests/Unit/SDK/Trace/Sampler/ParentBasedTest.php +++ b/tests/Unit/SDK/Trace/Sampler/ParentBasedTest.php @@ -24,6 +24,7 @@ class ParentBasedTest extends MockeryTestCase { private SamplerInterface $rootSampler; + #[\Override] public function setUp(): void { $this->rootSampler = $this->createMock(SamplerInterface::class); diff --git a/tests/Unit/SDK/Trace/SpanBuilderTest.php b/tests/Unit/SDK/Trace/SpanBuilderTest.php index 205977293..cbcdb288c 100644 --- a/tests/Unit/SDK/Trace/SpanBuilderTest.php +++ b/tests/Unit/SDK/Trace/SpanBuilderTest.php @@ -34,6 +34,7 @@ class SpanBuilderTest extends TestCase private IdGeneratorInterface $idGenerator; /** @var SpanProcessorInterface&MockObject $spanProcessor */ private SpanProcessorInterface $spanProcessor; + #[\Override] public function setUp(): void { $instrumentationScope = new InstrumentationScope( diff --git a/tests/Unit/SDK/Trace/SpanExporter/AbstractExporterTestCase.php b/tests/Unit/SDK/Trace/SpanExporter/AbstractExporterTestCase.php index 92925e616..0963619b9 100644 --- a/tests/Unit/SDK/Trace/SpanExporter/AbstractExporterTestCase.php +++ b/tests/Unit/SDK/Trace/SpanExporter/AbstractExporterTestCase.php @@ -23,6 +23,7 @@ abstract class AbstractExporterTestCase extends MockeryTestCase protected TransportInterface $transport; protected FutureInterface $future; + #[\Override] public function setUp(): void { Logging::disable(); diff --git a/tests/Unit/SDK/Trace/SpanExporter/ConsoleSpanExporterTest.php b/tests/Unit/SDK/Trace/SpanExporter/ConsoleSpanExporterTest.php index c317752c9..c77478c4f 100644 --- a/tests/Unit/SDK/Trace/SpanExporter/ConsoleSpanExporterTest.php +++ b/tests/Unit/SDK/Trace/SpanExporter/ConsoleSpanExporterTest.php @@ -17,6 +17,7 @@ #[CoversClass(ConsoleSpanExporter::class)] class ConsoleSpanExporterTest extends AbstractExporterTestCase { + #[\Override] public function createExporter(): ConsoleSpanExporter { return new ConsoleSpanExporter($this->transport); @@ -77,11 +78,13 @@ public function test_export_output(): void $this->transport->shouldHaveReceived('send')->with($expected); } + #[\Override] public function createExporterWithTransport(TransportInterface $transport): SpanExporterInterface { return new ConsoleSpanExporter($transport); } + #[\Override] public function getExporterClass(): string { return ConsoleSpanExporter::class; diff --git a/tests/Unit/SDK/Trace/SpanProcessor/BatchSpanProcessorTest.php b/tests/Unit/SDK/Trace/SpanProcessor/BatchSpanProcessorTest.php index 6fd6a804a..04b5e79bf 100644 --- a/tests/Unit/SDK/Trace/SpanProcessor/BatchSpanProcessorTest.php +++ b/tests/Unit/SDK/Trace/SpanProcessor/BatchSpanProcessorTest.php @@ -43,6 +43,7 @@ class BatchSpanProcessorTest extends MockeryTestCase /** @var LogWriterInterface&MockObject $logWriter */ private LogWriterInterface $logWriter; + #[\Override] protected function setUp(): void { $this->logWriter = $this->createMock(LogWriterInterface::class); diff --git a/tests/Unit/SDK/Trace/SpanProcessor/SimpleSpanProcessorTest.php b/tests/Unit/SDK/Trace/SpanProcessor/SimpleSpanProcessorTest.php index 2f3a28f19..26a1d7bda 100644 --- a/tests/Unit/SDK/Trace/SpanProcessor/SimpleSpanProcessorTest.php +++ b/tests/Unit/SDK/Trace/SpanProcessor/SimpleSpanProcessorTest.php @@ -44,6 +44,7 @@ class SimpleSpanProcessorTest extends MockeryTestCase private SpanContextInterface $sampledSpanContext; private SpanContextInterface $nonSampledSpanContext; + #[\Override] protected function setUp(): void { $this->logWriter = $this->createMock(LogWriterInterface::class); diff --git a/tests/Unit/SDK/Trace/SpanTest.php b/tests/Unit/SDK/Trace/SpanTest.php index 647558a5d..f44b2e62c 100644 --- a/tests/Unit/SDK/Trace/SpanTest.php +++ b/tests/Unit/SDK/Trace/SpanTest.php @@ -77,6 +77,7 @@ class SpanTest extends MockeryTestCase private string $spanId; private string $parentSpanId; + #[\Override] protected function setUp():void { $this->idGenerator = new RandomIdGenerator(); diff --git a/tests/Unit/SDK/Trace/TracerProviderFactoryTest.php b/tests/Unit/SDK/Trace/TracerProviderFactoryTest.php index 46fd67581..e14abb125 100644 --- a/tests/Unit/SDK/Trace/TracerProviderFactoryTest.php +++ b/tests/Unit/SDK/Trace/TracerProviderFactoryTest.php @@ -24,6 +24,7 @@ class TracerProviderFactoryTest extends TestCase /** @var LogWriterInterface&MockObject $logWriter */ private LogWriterInterface $logWriter; + #[\Override] public function setUp(): void { $this->logWriter = $this->createMock(LogWriterInterface::class); diff --git a/tests/Unit/SDK/Trace/TracerSharedStateTest.php b/tests/Unit/SDK/Trace/TracerSharedStateTest.php index 90eb45276..c1522b66f 100644 --- a/tests/Unit/SDK/Trace/TracerSharedStateTest.php +++ b/tests/Unit/SDK/Trace/TracerSharedStateTest.php @@ -23,6 +23,7 @@ class TracerSharedStateTest extends TestCase private SamplerInterface $sampler; private SpanLimits $spanLimits; + #[\Override] protected function setUp(): void { $this->idGenerator = $this->createMock(IdGeneratorInterface::class); diff --git a/tests/Unit/SDK/Trace/TracerTest.php b/tests/Unit/SDK/Trace/TracerTest.php index fbbc04ba4..710cfdef5 100644 --- a/tests/Unit/SDK/Trace/TracerTest.php +++ b/tests/Unit/SDK/Trace/TracerTest.php @@ -20,6 +20,7 @@ class TracerTest extends TestCase private TracerSharedState $tracerSharedState; private InstrumentationScope $instrumentationScope; + #[\Override] protected function setUp(): void { $this->tracerSharedState = $this->createMock(TracerSharedState::class); diff --git a/tests/Unit/SDK/Util/SpanData.php b/tests/Unit/SDK/Util/SpanData.php index dc814f645..884dc9b5f 100644 --- a/tests/Unit/SDK/Util/SpanData.php +++ b/tests/Unit/SDK/Util/SpanData.php @@ -54,6 +54,7 @@ public function __construct() $this->parentContext = API\SpanContext::getInvalid(); } + #[\Override] public function getName(): string { return $this->name; @@ -68,6 +69,7 @@ public function setName(string $name): self } /** @inheritDoc */ + #[\Override] public function getLinks(): array { return $this->links; @@ -89,6 +91,7 @@ public function addLink(API\SpanContextInterface $context, AttributesInterface $ } /** @inheritDoc */ + #[\Override] public function getEvents(): array { return $this->events; @@ -109,6 +112,7 @@ public function addEvent(string $name, AttributesInterface $attributes, ?int $ti return $this; } + #[\Override] public function getAttributes(): AttributesInterface { return $this->attributesBuilder->build(); @@ -121,6 +125,7 @@ public function addAttribute(string $key, $value): self return $this; } + #[\Override] public function getTotalDroppedEvents(): int { return max(0, $this->totalRecordedEvents - count($this->events)); @@ -133,6 +138,7 @@ public function setTotalRecordedEvents(int $totalRecordedEvents): self return $this; } + #[\Override] public function getTotalDroppedLinks(): int { return max(0, $this->totalRecordedLinks - count($this->links)); @@ -145,6 +151,7 @@ public function setTotalRecordedLinks(int $totalRecordedLinks): self return $this; } + #[\Override] public function getKind(): int { return $this->kind; @@ -157,6 +164,7 @@ public function setKind(int $kind): self return $this; } + #[\Override] public function getStatus(): StatusData { return $this->status; @@ -169,6 +177,7 @@ public function setStatus(StatusData $status): self return $this; } + #[\Override] public function getEndEpochNanos(): int { return $this->endEpochNanos; @@ -181,6 +190,7 @@ public function setEndEpochNanos(int $endEpochNanos): self return $this; } + #[\Override] public function getStartEpochNanos(): int { return $this->startEpochNanos; @@ -193,6 +203,7 @@ public function setStartEpochNanos(int $startEpochNanos): self return $this; } + #[\Override] public function hasEnded(): bool { return $this->hasEnded; @@ -205,6 +216,7 @@ public function setHasEnded(bool $hasEnded): self return $this; } + #[\Override] public function getResource(): ResourceInfo { return $this->resource; @@ -217,6 +229,7 @@ public function setResource(ResourceInfo $resource): self return $this; } + #[\Override] public function getInstrumentationScope(): InstrumentationScope { return $this->instrumentationScope; @@ -229,6 +242,7 @@ public function setInstrumentationScope(InstrumentationScope $instrumentationSco return $this; } + #[\Override] public function getContext(): API\SpanContextInterface { return $this->context; @@ -241,6 +255,7 @@ public function setContext(API\SpanContextInterface $context): self return $this; } + #[\Override] public function getParentContext(): API\SpanContextInterface { return $this->parentContext; @@ -253,16 +268,19 @@ public function setParentContext(API\SpanContextInterface $parentContext): self return $this; } + #[\Override] public function getTraceId(): string { return $this->getContext()->getTraceId(); } + #[\Override] public function getSpanId(): string { return $this->getContext()->getSpanId(); } + #[\Override] public function getParentSpanId(): string { return $this->getParentContext()->getSpanId(); From 26b1143b4d175a42f0460f01b53dbba2ca6a676e Mon Sep 17 00:00:00 2001 From: Brett McBride Date: Wed, 16 Jul 2025 17:02:47 +1000 Subject: [PATCH 02/15] fixing more psalm complaints --- docker/Dockerfile | 4 +- .../features/monolog-otel-integration.php | 2 +- examples/traces/exporters/otlp_file.php | 3 + psalm.xml.dist | 65 +++++++++++-------- src/API/Common/Time/SystemClock.php | 2 +- .../Instrumentation/CachedInstrumentation.php | 1 + src/API/Trace/TraceState.php | 3 + .../Configuration/ConfigurationFactory.php | 7 +- src/Context/FiberBoundContextStorage.php | 6 ++ ...nitizeCombinedHeadersPropagationGetter.php | 3 + src/Context/ZendObserverFiber.php | 3 + src/Contrib/Grpc/GrpcTransportFactory.php | 2 +- src/Contrib/Otlp/MetricConverter.php | 3 + src/Contrib/Otlp/ProtobufSerializer.php | 11 +++- src/SDK/Common/Export/Http/PsrTransport.php | 2 +- .../Common/Export/Stream/StreamTransport.php | 2 +- .../Export/Stream/StreamTransportFactory.php | 2 +- .../InstrumentationScope/Configurator.php | 1 + src/SDK/Common/Util/ShutdownHandler.php | 1 + src/SDK/Common/Util/functions.php | 2 +- src/SDK/Logs/Exporter/ConsoleExporter.php | 10 ++- src/SDK/Logs/ReadableLogRecord.php | 2 +- .../ExplicitBucketHistogramAggregation.php | 8 ++- .../Metrics/Aggregation/SumAggregation.php | 16 ++--- src/SDK/Metrics/AggregationInterface.php | 2 +- src/SDK/Metrics/AsynchronousInstruments.php | 1 + .../Sampler/TraceIdRatioBasedSampler.php | 1 + src/SDK/Trace/Span.php | 2 +- tests/Unit/SDK/Trace/SpanTest.php | 2 +- vendor-bin/psalm/composer.json | 4 +- 30 files changed, 119 insertions(+), 54 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 47a137728..1d42c8a0b 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,4 +1,4 @@ -FROM composer:2 AS composer +FROM composer:2.8 AS composer FROM debian:bullseye WORKDIR /usr/src/myapp @@ -38,7 +38,7 @@ RUN apt-get install -y \ COPY --from=composer /usr/bin/composer /usr/local/bin/composer -RUN echo ";grpc.enable_fork_support = 1" > $(php-config --ini-dir)/40-otel-dev.ini \ +RUN echo "grpc.enable_fork_support = 1" > $(php-config --ini-dir)/40-otel-dev.ini \ && echo "grpc.poll_strategy = epoll1" >> $(php-config --ini-dir)/40-otel-dev.ini \ && echo "zend.assertions = 1" >> $(php-config --ini-dir)/40-otel-dev.ini diff --git a/examples/logs/features/monolog-otel-integration.php b/examples/logs/features/monolog-otel-integration.php index a62007bbd..cf0c9e80b 100644 --- a/examples/logs/features/monolog-otel-integration.php +++ b/examples/logs/features/monolog-otel-integration.php @@ -60,7 +60,7 @@ private function convert(MonologLogRecord $record): LogRecord { return (new LogRecord($record['message'])) ->setSeverityText($record->level->toPsrLogLevel()) - ->setTimestamp((int) (microtime(true) * LogRecord::NANOS_PER_SECOND)) + ->setTimestamp((int) (microtime(true) * (float) LogRecord::NANOS_PER_SECOND)) ->setObservedTimestamp((int) $record->datetime->format('U') * LogRecord::NANOS_PER_SECOND) ->setSeverityNumber(Severity::fromPsr3($record->level->toPsrLogLevel())) ->setAttributes($record->context + $record->extra); diff --git a/examples/traces/exporters/otlp_file.php b/examples/traces/exporters/otlp_file.php index 770a3e3a5..ff48df571 100644 --- a/examples/traces/exporters/otlp_file.php +++ b/examples/traces/exporters/otlp_file.php @@ -15,6 +15,9 @@ $filename = sys_get_temp_dir() . '/traces.jsonl'; $file = fopen($filename, 'a'); +if ($file === false) { + throw new \RuntimeException('Failed to open file for writing: ' . $filename); +} $transport = (new StreamTransportFactory())->create($file, ContentTypes::NDJSON); $exporter = new SpanExporter($transport); diff --git a/psalm.xml.dist b/psalm.xml.dist index c14e435bc..f015d5638 100644 --- a/psalm.xml.dist +++ b/psalm.xml.dist @@ -15,6 +15,7 @@ + @@ -27,11 +28,6 @@ - - - - - @@ -43,11 +39,6 @@ - - - - - @@ -57,34 +48,56 @@ + - - - - - - - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - + - - + + - + - + diff --git a/src/API/Common/Time/SystemClock.php b/src/API/Common/Time/SystemClock.php index 0ad3e6b6c..a0d33a4a3 100644 --- a/src/API/Common/Time/SystemClock.php +++ b/src/API/Common/Time/SystemClock.php @@ -48,6 +48,6 @@ private static function init(): void */ private static function calculateReferenceTime(float $wallClockMicroTime, int $upTime): int { - return ((int) ($wallClockMicroTime * ClockInterface::NANOS_PER_SECOND)) - $upTime; + return ((int) ($wallClockMicroTime * (float) ClockInterface::NANOS_PER_SECOND)) - $upTime; } } diff --git a/src/API/Instrumentation/CachedInstrumentation.php b/src/API/Instrumentation/CachedInstrumentation.php index 27b755b2f..eb2b9d723 100644 --- a/src/API/Instrumentation/CachedInstrumentation.php +++ b/src/API/Instrumentation/CachedInstrumentation.php @@ -62,6 +62,7 @@ public function meter(): MeterInterface return $this->meters[$meterProvider] ??= $meterProvider->getMeter($this->name, $this->version, $this->schemaUrl, $this->attributes); } + public function logger(): LoggerInterface { $loggerProvider = Globals::loggerProvider(); diff --git a/src/API/Trace/TraceState.php b/src/API/Trace/TraceState.php index bfeb7d509..eb4d505dc 100644 --- a/src/API/Trace/TraceState.php +++ b/src/API/Trace/TraceState.php @@ -94,6 +94,9 @@ public function toString(?int $limit = null): string foreach ([128, 0] as $threshold) { // Then entries SHOULD be removed starting from the end of tracestate. for ($value = end($traceState); $key = key($traceState);) { + if ($value === false) { + continue; + } $entry = strlen($key) + 1 + strlen($value); $value = prev($traceState); if ($entry <= $threshold) { diff --git a/src/Config/SDK/Configuration/ConfigurationFactory.php b/src/Config/SDK/Configuration/ConfigurationFactory.php index b86af8b00..7fa911834 100644 --- a/src/Config/SDK/Configuration/ConfigurationFactory.php +++ b/src/Config/SDK/Configuration/ConfigurationFactory.php @@ -27,6 +27,7 @@ use OpenTelemetry\Config\SDK\Configuration\Internal\TrackingEnvReader; use OpenTelemetry\Config\SDK\Configuration\Loader\YamlExtensionFileLoader; use OpenTelemetry\Config\SDK\Configuration\Loader\YamlSymfonyFileLoader; +use RuntimeException; use function serialize; use function sprintf; use Symfony\Component\Config\Definition\Builder\NodeBuilder; @@ -107,7 +108,11 @@ public function parseFile( } $loader = new ConfigurationLoader($resources); - $locator = new FileLocator(getcwd()); + $cwd = getcwd(); + if ($cwd === false) { + throw new RuntimeException('Current working directory could not be determined.'); + } + $locator = new FileLocator($cwd); $fileLoader = new DelegatingLoader(new LoaderResolver([ new YamlSymfonyFileLoader($loader, $locator), new YamlExtensionFileLoader($loader, $locator), diff --git a/src/Context/FiberBoundContextStorage.php b/src/Context/FiberBoundContextStorage.php index 78bc583e7..2769e3881 100644 --- a/src/Context/FiberBoundContextStorage.php +++ b/src/Context/FiberBoundContextStorage.php @@ -32,6 +32,9 @@ public function head(): ?ContextStorageHead return $this->heads[Fiber::getCurrent() ?? $this] ?? null; } + /** + * @psalm-suppress PossiblyNullPropertyFetch + */ #[\Override] public function scope(): ?ContextStorageScopeInterface { @@ -62,6 +65,9 @@ public function current(): ContextInterface return $head->node->context ?? Context::getRoot(); } + /** + * @psalm-suppress PossiblyNullArgument,PossiblyNullPropertyFetch + */ #[\Override] public function attach(ContextInterface $context): ContextStorageScopeInterface { diff --git a/src/Context/Propagation/SanitizeCombinedHeadersPropagationGetter.php b/src/Context/Propagation/SanitizeCombinedHeadersPropagationGetter.php index 12cc93340..001758550 100644 --- a/src/Context/Propagation/SanitizeCombinedHeadersPropagationGetter.php +++ b/src/Context/Propagation/SanitizeCombinedHeadersPropagationGetter.php @@ -43,6 +43,9 @@ public function get($carrier, string $key): ?string ); } + /** + * @psalm-suppress PossiblyNullArgument + */ #[\Override] public function getAll($carrier, string $key): array { diff --git a/src/Context/ZendObserverFiber.php b/src/Context/ZendObserverFiber.php index b700307e3..032a2cdbb 100644 --- a/src/Context/ZendObserverFiber.php +++ b/src/Context/ZendObserverFiber.php @@ -33,6 +33,9 @@ public static function isEnabled(): bool : (bool) $enabled; } + /** + * @psalm-suppress PossiblyNullReference,UndefinedMethod + */ public static function init(): bool { static $fibers; diff --git a/src/Contrib/Grpc/GrpcTransportFactory.php b/src/Contrib/Grpc/GrpcTransportFactory.php index e580bcbe8..ce313d45e 100644 --- a/src/Contrib/Grpc/GrpcTransportFactory.php +++ b/src/Contrib/Grpc/GrpcTransportFactory.php @@ -84,7 +84,7 @@ public function create( $opts, $method, $headers, - (int) ($timeout * self::MILLIS_PER_SECOND), + (int) ($timeout * (float) self::MILLIS_PER_SECOND), ); } diff --git a/src/Contrib/Otlp/MetricConverter.php b/src/Contrib/Otlp/MetricConverter.php index 44fa429f2..3a8ef3d8c 100644 --- a/src/Contrib/Otlp/MetricConverter.php +++ b/src/Contrib/Otlp/MetricConverter.php @@ -214,6 +214,9 @@ private function convertHistogramDataPoint(SDK\Metrics\Data\HistogramDataPoint $ return $pHistogramDataPoint; } + /** + * @psalm-suppress PossiblyFalseArgument + */ private function convertExemplar(SDK\Metrics\Data\Exemplar $exemplar): Exemplar { $pExemplar = new Exemplar(); diff --git a/src/Contrib/Otlp/ProtobufSerializer.php b/src/Contrib/Otlp/ProtobufSerializer.php index 0ca44014d..8840cf3e5 100644 --- a/src/Contrib/Otlp/ProtobufSerializer.php +++ b/src/Contrib/Otlp/ProtobufSerializer.php @@ -19,6 +19,7 @@ use const JSON_UNESCAPED_SLASHES; use const JSON_UNESCAPED_UNICODE; use function lcfirst; +use OpenTelemetry\API\Behavior\LogsMessagesTrait; use OpenTelemetry\SDK\Common\Export\TransportInterface; use function property_exists; use function sprintf; @@ -30,6 +31,7 @@ */ final class ProtobufSerializer { + use LogsMessagesTrait; private function __construct(private readonly string $contentType) { } @@ -121,7 +123,14 @@ private static function serializeToJsonString(Message $message): string unset($payload); self::traverseDescriptor($data, $desc); - return json_encode($data, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); + $encoded = json_encode($data, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); + if ($encoded === false) { + self::logWarning('Failed to encode protobuf to JSON: ' . json_last_error_msg()); + + return ''; + } + + return $encoded; } private static function traverseDescriptor(object $data, Descriptor $desc): void diff --git a/src/SDK/Common/Export/Http/PsrTransport.php b/src/SDK/Common/Export/Http/PsrTransport.php index 0ca720b4a..ee3cd2933 100644 --- a/src/SDK/Common/Export/Http/PsrTransport.php +++ b/src/SDK/Common/Export/Http/PsrTransport.php @@ -101,7 +101,7 @@ public function send(string $payload, ?CancellationInterface $cancellation = nul $delay = PsrUtils::retryDelay($retries, $this->retryDelay, $response); $sec = (int) $delay; - $nsec = (int) (($delay - $sec) * 1e9); + $nsec = (int) (($delay - (float) $sec) * 1e9); /** @psalm-suppress ArgumentTypeCoercion */ if (time_nanosleep($sec, $nsec) !== true) { diff --git a/src/SDK/Common/Export/Stream/StreamTransport.php b/src/SDK/Common/Export/Stream/StreamTransport.php index f7c3f21df..7b4f4cf9a 100644 --- a/src/SDK/Common/Export/Stream/StreamTransport.php +++ b/src/SDK/Common/Export/Stream/StreamTransport.php @@ -64,7 +64,7 @@ public function send(string $payload, ?CancellationInterface $cancellation = nul } if ($bytesWritten !== strlen($payload)) { - return new ErrorFuture(new RuntimeException(sprintf('Write failure, wrote %d of %d bytes', $bytesWritten, strlen($payload)))); + return new ErrorFuture(new RuntimeException(sprintf('Write failure, wrote %d of %d bytes', $bytesWritten ?: 0, strlen($payload)))); } return new CompletedFuture(null); diff --git a/src/SDK/Common/Export/Stream/StreamTransportFactory.php b/src/SDK/Common/Export/Stream/StreamTransportFactory.php index 3acd11a68..e3b252567 100644 --- a/src/SDK/Common/Export/Stream/StreamTransportFactory.php +++ b/src/SDK/Common/Export/Stream/StreamTransportFactory.php @@ -28,8 +28,8 @@ final class StreamTransportFactory implements TransportFactoryInterface * * @psalm-template CONTENT_TYPE of string * @psalm-param CONTENT_TYPE $contentType - * @psalm-return TransportInterface * @throws ErrorException + * @psalm-return TransportInterface */ #[\Override] public function create( diff --git a/src/SDK/Common/InstrumentationScope/Configurator.php b/src/SDK/Common/InstrumentationScope/Configurator.php index 3ed5816a4..7fef51abe 100644 --- a/src/SDK/Common/InstrumentationScope/Configurator.php +++ b/src/SDK/Common/InstrumentationScope/Configurator.php @@ -51,6 +51,7 @@ public function with(Closure $closure, ?string $name, ?string $version = null, ? /** * @return T + * @psalm-suppress PossiblyNullArgument */ public function resolve(InstrumentationScopeInterface $instrumentationScope): Config { diff --git a/src/SDK/Common/Util/ShutdownHandler.php b/src/SDK/Common/Util/ShutdownHandler.php index 481c23662..ff1b5f7ee 100644 --- a/src/SDK/Common/Util/ShutdownHandler.php +++ b/src/SDK/Common/Util/ShutdownHandler.php @@ -46,6 +46,7 @@ public function __destruct() * @param callable $shutdownFunction function to register * * @see register_shutdown_function + * @psalm-suppress PossiblyNullArgument,PossiblyNullPropertyFetch */ public static function register(callable $shutdownFunction): void { diff --git a/src/SDK/Common/Util/functions.php b/src/SDK/Common/Util/functions.php index a8d39f4dc..5f08e3acb 100644 --- a/src/SDK/Common/Util/functions.php +++ b/src/SDK/Common/Util/functions.php @@ -47,7 +47,7 @@ function weaken(Closure $closure, ?object &$target = null): Closure $ref = WeakReference::create($target); /** - * @psalm-suppress all + * @psalm-suppress PossiblyNullReference,PossiblyNullFunctionCall */ return $scope && $target::class === $scope->name && !$scope->isInternal() ? static fn (...$args) => ($obj = $ref->get()) ? $closure->call($obj, ...$args) : null diff --git a/src/SDK/Logs/Exporter/ConsoleExporter.php b/src/SDK/Logs/Exporter/ConsoleExporter.php index 63170da19..71d017c9b 100644 --- a/src/SDK/Logs/Exporter/ConsoleExporter.php +++ b/src/SDK/Logs/Exporter/ConsoleExporter.php @@ -4,9 +4,11 @@ namespace OpenTelemetry\SDK\Logs\Exporter; +use OpenTelemetry\API\Behavior\LogsMessagesTrait; use OpenTelemetry\SDK\Common\Export\TransportInterface; use OpenTelemetry\SDK\Common\Future\CancellationInterface; use OpenTelemetry\SDK\Common\Future\CompletedFuture; +use OpenTelemetry\SDK\Common\Future\ErrorFuture; use OpenTelemetry\SDK\Common\Future\FutureInterface; use OpenTelemetry\SDK\Common\Instrumentation\InstrumentationScopeInterface; use OpenTelemetry\SDK\Logs\LogRecordExporterInterface; @@ -45,7 +47,13 @@ public function export(iterable $batch, ?CancellationInterface $cancellation = n 'resource' => $resource, 'scopes' => array_values($scopes), ]; - $this->transport->send(json_encode($output, JSON_PRETTY_PRINT)); + $payload = json_encode($output, JSON_PRETTY_PRINT); + if ($payload === false) { + return new ErrorFuture( + new \RuntimeException('Failed to encode log records to JSON: ' . json_last_error_msg()) + );); + } + $this->transport->send($payload); return new CompletedFuture(true); } diff --git a/src/SDK/Logs/ReadableLogRecord.php b/src/SDK/Logs/ReadableLogRecord.php index d5c49a3b8..43fd4815d 100644 --- a/src/SDK/Logs/ReadableLogRecord.php +++ b/src/SDK/Logs/ReadableLogRecord.php @@ -31,7 +31,7 @@ public function __construct( parent::__construct($logRecord->body); $this->timestamp = $logRecord->timestamp; $this->observedTimestamp = $logRecord->observedTimestamp - ?? (int) (microtime(true) * LogRecord::NANOS_PER_SECOND); + ?? (int) (microtime(true) * (float) LogRecord::NANOS_PER_SECOND); $this->context = $logRecord->context; $context = $this->context ?? Context::getCurrent(); $this->spanContext = Span::fromContext($context)->getContext(); diff --git a/src/SDK/Metrics/Aggregation/ExplicitBucketHistogramAggregation.php b/src/SDK/Metrics/Aggregation/ExplicitBucketHistogramAggregation.php index 5ac1f3f49..b7c9eee19 100644 --- a/src/SDK/Metrics/Aggregation/ExplicitBucketHistogramAggregation.php +++ b/src/SDK/Metrics/Aggregation/ExplicitBucketHistogramAggregation.php @@ -62,7 +62,9 @@ public function record($summary, $value, AttributesInterface $attributes, Contex public function merge($left, $right): ExplicitBucketHistogramSummary { $count = $left->count + $right->count; - $sum = $left->sum + $right->sum; + $sum = (is_int($left->sum) && is_int($right->sum)) + ? ($left->sum + $right->sum) + : ((float) $left->sum + (float) $right->sum); $min = self::min($left->min, $right->min); $max = self::max($left->max, $right->max); $buckets = $right->buckets; @@ -87,7 +89,9 @@ public function merge($left, $right): ExplicitBucketHistogramSummary public function diff($left, $right): ExplicitBucketHistogramSummary { $count = -$left->count + $right->count; - $sum = -$left->sum + $right->sum; + $sum = (is_int($left->sum) && is_int($right->sum)) + ? (-$left->sum + $right->sum) + : (-(float) $left->sum + (float) $right->sum); $min = $left->min > $right->min ? $right->min : NAN; $max = $left->max < $right->max ? $right->max : NAN; $buckets = $right->buckets; diff --git a/src/SDK/Metrics/Aggregation/SumAggregation.php b/src/SDK/Metrics/Aggregation/SumAggregation.php index 06d5155a6..d1089715c 100644 --- a/src/SDK/Metrics/Aggregation/SumAggregation.php +++ b/src/SDK/Metrics/Aggregation/SumAggregation.php @@ -40,11 +40,11 @@ public function record($summary, $value, AttributesInterface $attributes, Contex #[\Override] public function merge($left, $right): SumSummary { - $sum = $left->value + $right->value; + $sum = (is_int($left->value) && is_int($right->value)) + ? ($left->value + $right->value) + : ((float) $left->value + (float) $right->value); - return new SumSummary( - $sum, - ); + return new SumSummary($sum); } /** @@ -54,11 +54,11 @@ public function merge($left, $right): SumSummary #[\Override] public function diff($left, $right): SumSummary { - $sum = -$left->value + $right->value; + $diff = (is_int($left->value) && is_int($right->value)) + ? (-$left->value + $right->value) + : (-(float) $left->value + (float) $right->value); - return new SumSummary( - $sum, - ); + return new SumSummary($diff); } /** diff --git a/src/SDK/Metrics/AggregationInterface.php b/src/SDK/Metrics/AggregationInterface.php index 7f2cb1e50..d0ce96d6f 100644 --- a/src/SDK/Metrics/AggregationInterface.php +++ b/src/SDK/Metrics/AggregationInterface.php @@ -42,9 +42,9 @@ public function diff($left, $right); /** * @param array $attributes - * @psalm-param array $summaries * @param array> $exemplars * @param string|Temporality $temporality + * @psalm-param array $summaries */ public function toData( array $attributes, diff --git a/src/SDK/Metrics/AsynchronousInstruments.php b/src/SDK/Metrics/AsynchronousInstruments.php index 48dbbdd85..a9fd05cbb 100644 --- a/src/SDK/Metrics/AsynchronousInstruments.php +++ b/src/SDK/Metrics/AsynchronousInstruments.php @@ -18,6 +18,7 @@ final class AsynchronousInstruments /** * @param ArrayAccess $destructors * @param non-empty-list $instruments + * @psalm-suppress PossiblyNullArgument,PossiblyNullPropertyAssignment,PossiblyNullPropertyFetch */ public static function observe( MetricWriterInterface $writer, diff --git a/src/SDK/Trace/Sampler/TraceIdRatioBasedSampler.php b/src/SDK/Trace/Sampler/TraceIdRatioBasedSampler.php index 8fdec75bc..cfa305d6b 100644 --- a/src/SDK/Trace/Sampler/TraceIdRatioBasedSampler.php +++ b/src/SDK/Trace/Sampler/TraceIdRatioBasedSampler.php @@ -99,6 +99,7 @@ public static function computeTValue(float $probability, int $precision, int $wo assert($precision >= 1); assert($wordSize >= 1 && ($wordSize & $wordSize - 1) === 0); + /** @psalm-suppress PossiblyInvalidArrayAccess */ $b = unpack('J', pack('E', $probability))[1]; $e = $b >> 52 & (1 << 11) - 1; $f = $b & (1 << 52) - 1 | ($e ? 1 << 52 : 0); diff --git a/src/SDK/Trace/Span.php b/src/SDK/Trace/Span.php index 47caa7de3..49242750d 100644 --- a/src/SDK/Trace/Span.php +++ b/src/SDK/Trace/Span.php @@ -53,8 +53,8 @@ private function __construct( * End users should use a {@see API\TracerInterface} in order to create spans. * * @param non-empty-string $name - * @psalm-param API\SpanKind::KIND_* $kind * @param list $links + * @psalm-param API\SpanKind::KIND_* $kind * * @internal * @psalm-internal OpenTelemetry diff --git a/tests/Unit/SDK/Trace/SpanTest.php b/tests/Unit/SDK/Trace/SpanTest.php index f44b2e62c..89d646558 100644 --- a/tests/Unit/SDK/Trace/SpanTest.php +++ b/tests/Unit/SDK/Trace/SpanTest.php @@ -831,8 +831,8 @@ private function createTestRootSpan(): Span } /** - * @psalm-param API\SpanKind::KIND_* $kind * @param list $links + * @psalm-param API\SpanKind::KIND_* $kind */ private function createTestSpan( int $kind = API\SpanKind::KIND_INTERNAL, diff --git a/vendor-bin/psalm/composer.json b/vendor-bin/psalm/composer.json index c00335368..1603814af 100644 --- a/vendor-bin/psalm/composer.json +++ b/vendor-bin/psalm/composer.json @@ -1,7 +1,7 @@ { "require-dev": { - "vimeo/psalm": "^5.24", + "vimeo/psalm": "^6", "psalm/plugin-mockery": "^1", - "psalm/plugin-phpunit": "^0.18.4" + "psalm/plugin-phpunit": "^0.19" } } From 853f9782168a69786816b29fec7e40f3c361f008 Mon Sep 17 00:00:00 2001 From: Brett McBride Date: Thu, 17 Jul 2025 09:45:08 +1000 Subject: [PATCH 03/15] more fixes --- .phan/config.php | 1 + psalm.xml.dist | 11 +++++++++++ src/SDK/Logs/Exporter/ConsoleExporter.php | 3 +-- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.phan/config.php b/.phan/config.php index cc5df7a98..139407d12 100644 --- a/.phan/config.php +++ b/.phan/config.php @@ -286,6 +286,7 @@ 'PhanAccessPropertyInternal', 'PhanTypeMismatchPropertyReal', 'PhanTemplateTypeNotUsedInFunctionReturn', + 'PhanUndeclaredClassAttribute', ], // A regular expression to match files to be excluded diff --git a/psalm.xml.dist b/psalm.xml.dist index f015d5638..777979925 100644 --- a/psalm.xml.dist +++ b/psalm.xml.dist @@ -39,6 +39,11 @@ + + + + + @@ -51,6 +56,12 @@ + + + + + + diff --git a/src/SDK/Logs/Exporter/ConsoleExporter.php b/src/SDK/Logs/Exporter/ConsoleExporter.php index 71d017c9b..a4e0840b0 100644 --- a/src/SDK/Logs/Exporter/ConsoleExporter.php +++ b/src/SDK/Logs/Exporter/ConsoleExporter.php @@ -4,7 +4,6 @@ namespace OpenTelemetry\SDK\Logs\Exporter; -use OpenTelemetry\API\Behavior\LogsMessagesTrait; use OpenTelemetry\SDK\Common\Export\TransportInterface; use OpenTelemetry\SDK\Common\Future\CancellationInterface; use OpenTelemetry\SDK\Common\Future\CompletedFuture; @@ -51,7 +50,7 @@ public function export(iterable $batch, ?CancellationInterface $cancellation = n if ($payload === false) { return new ErrorFuture( new \RuntimeException('Failed to encode log records to JSON: ' . json_last_error_msg()) - );); + ); } $this->transport->send($payload); From a1f2ba09a8ae904a5a91f031ec621bc56da1b2fb Mon Sep 17 00:00:00 2001 From: Brett McBride Date: Thu, 17 Jul 2025 11:55:35 +1000 Subject: [PATCH 04/15] adding stubs for deptrac there are some things in our code that deptrac doesn't understand or are missing for some php versions. stub them to quieten all those violation warnings --- Makefile | 1 + deptrac.yaml | 8 ++++++++ deptrac/stubs/ComponentPlugin.php | 5 +++++ deptrac/stubs/ComponentProvider.php | 5 +++++ deptrac/stubs/ComponentProviderRegistry.php | 5 +++++ deptrac/stubs/Context.php | 5 +++++ deptrac/stubs/Override.php | 10 ++++++++++ deptrac/stubs/README.md | 2 ++ 8 files changed, 41 insertions(+) create mode 100644 deptrac/stubs/ComponentPlugin.php create mode 100644 deptrac/stubs/ComponentProvider.php create mode 100644 deptrac/stubs/ComponentProviderRegistry.php create mode 100644 deptrac/stubs/Context.php create mode 100644 deptrac/stubs/Override.php create mode 100644 deptrac/stubs/README.md diff --git a/Makefile b/Makefile index ed7685c5c..9c9001034 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,7 @@ DOCKER_COMPOSE ?= docker compose DC_RUN_PHP = $(DOCKER_COMPOSE) run --rm php .DEFAULT_GOAL : help +.PHONY: deptrac help: ## Show this help @printf "\033[33m%s:\033[0m\n" 'Available commands' diff --git a/deptrac.yaml b/deptrac.yaml index 3cca3903c..d1d9dc30a 100644 --- a/deptrac.yaml +++ b/deptrac.yaml @@ -14,6 +14,7 @@ deptrac: - ./src - ./proto - ./tests + - ./deptrac/stubs exclude_files: - '#.*test.*#' layers: @@ -109,10 +110,15 @@ deptrac: collectors: - type: className regex: ^Nyholm\\Psr7Server\\* + - name: Stubs + collectors: + - type: directory + value: deptrac/stubs/.* ruleset: Context: - FFI + - Stubs SemConv: ~ ConfigSDK: - SymfonyConfig @@ -124,10 +130,12 @@ deptrac: - Context - Contrib - Extension + - Stubs API: - Context - PsrLog - SPI + - Stubs SDK: - +API - ConfigSDK diff --git a/deptrac/stubs/ComponentPlugin.php b/deptrac/stubs/ComponentPlugin.php new file mode 100644 index 000000000..457920fee --- /dev/null +++ b/deptrac/stubs/ComponentPlugin.php @@ -0,0 +1,5 @@ + Date: Thu, 17 Jul 2025 12:07:49 +1000 Subject: [PATCH 05/15] why not cache invalid :( --- .github/workflows/php.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index c34cb5a2a..c01facf29 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -87,7 +87,7 @@ jobs: uses: actions/cache@v4 with: path: vendor - key: ${{ runner.os }}-${{ matrix.php-version }}-php-${{ hashFiles('**/composer.json') }} + key: ${{ runner.os }}-${{ matrix.php-version }}-php-${{ hashFiles('composer.json') }} restore-keys: | ${{ runner.os }}-${{ matrix.php-version }}-php- - name: Cache test tools @@ -95,7 +95,7 @@ jobs: uses: actions/cache@v4 with: path: vendor-bin - key: ${{ runner.os }}-${{ matrix.php-version }}-php-${{ hashFiles('**/composer.json') }} + key: ${{ runner.os }}-${{ matrix.php-version }}-php-${{ hashFiles('composer.json') }} restore-keys: | ${{ runner.os }}-${{ matrix.php-version }}-php- From 4b37da58a53a3d0a87f53b1b7bd5bd58386e1777 Mon Sep 17 00:00:00 2001 From: Brett McBride Date: Thu, 17 Jul 2025 12:16:45 +1000 Subject: [PATCH 06/15] display tools versions --- .github/workflows/php.yml | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index c01facf29..8d6b3e63a 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -102,19 +102,25 @@ jobs: - name: Install dependencies id: composer if: steps.composer-cache.outputs.cache-hit != 'true' - run: composer install --prefer-dist --no-progress ${{ matrix.composer_args }} + run: | + composer --version + composer install --prefer-dist --no-progress ${{ matrix.composer_args }} - name: Check Style id: style continue-on-error: ${{ matrix.experimental }} env: PHP_CS_FIXER_IGNORE_ENV: 1 - run: vendor-bin/php-cs-fixer/vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php --dry-run --stop-on-violation --using-cache=no -vvv + run: | + vendor-bin/php-cs-fixer/vendor/bin/php-cs-fixer --version + vendor-bin/php-cs-fixer/vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php --dry-run --stop-on-violation --using-cache=no -vvv - name: Check Dependencies id: deps continue-on-error: ${{ matrix.experimental }} - run: vendor-bin/deptrac/vendor/bin/deptrac --formatter=github-actions --report-uncovered + run: | + vendor-bin/deptrac/vendor/bin/deptrac --version + vendor-bin/deptrac/vendor/bin/deptrac --formatter=github-actions --report-uncovered - name: Run Phan id: phan @@ -122,22 +128,30 @@ jobs: env: XDEBUG_MODE: off PHAN_DISABLE_XDEBUG_WARN: 1 - run: vendor-bin/phan/vendor/bin/phan + run: | + vendor-bin/phan/vendor/bin/phan --version + vendor-bin/phan/vendor/bin/phan - name: Run Psalm id: psalm continue-on-error: ${{ matrix.experimental }} - run: vendor-bin/psalm/vendor/bin/psalm --output-format=github + run: | + vendor-bin/psalm/vendor/bin/psalm --version + vendor-bin/psalm/vendor/bin/psalm --output-format=github - name: Run Phpstan id: phpstan continue-on-error: ${{ matrix.experimental }} - run: vendor/bin/phpstan analyse --error-format=github + run: | + vendor/bin/phpstan --version + vendor/bin/phpstan analyse --error-format=github - name: Run PHPUnit (unit tests) id: unit continue-on-error: ${{ matrix.experimental }} - run: php -dzend.assertions=1 vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover --testsuite unit + run: | + vendor/bin/phpunit --version + php -dzend.assertions=1 vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover --testsuite unit - name: Run PHPUnit (integration tests) id: integration From f7d8627524b3b45576fa5f39b205042e5678cd44 Mon Sep 17 00:00:00 2001 From: Brett McBride Date: Thu, 17 Jul 2025 12:24:10 +1000 Subject: [PATCH 07/15] fix tools cache key --- .github/workflows/php.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 8d6b3e63a..a99fcfc7f 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -95,7 +95,7 @@ jobs: uses: actions/cache@v4 with: path: vendor-bin - key: ${{ runner.os }}-${{ matrix.php-version }}-php-${{ hashFiles('composer.json') }} + key: ${{ runner.os }}-${{ matrix.php-version }}-php-${{ hashFiles('vendor-bin/*/composer.json') }} restore-keys: | ${{ runner.os }}-${{ matrix.php-version }}-php- From 07b75d4ebf5c613884b37ff2b7f6040895738550 Mon Sep 17 00:00:00 2001 From: Brett McBride Date: Thu, 17 Jul 2025 12:30:12 +1000 Subject: [PATCH 08/15] changing cache key --- .github/workflows/php.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index a99fcfc7f..29142c915 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -87,17 +87,17 @@ jobs: uses: actions/cache@v4 with: path: vendor - key: ${{ runner.os }}-${{ matrix.php-version }}-php-${{ hashFiles('composer.json') }} + key: ${{ runner.os }}-${{ matrix.php-version }}-vendor-${{ hashFiles('composer.json') }} restore-keys: | - ${{ runner.os }}-${{ matrix.php-version }}-php- + ${{ runner.os }}-${{ matrix.php-version }}-vendor- - name: Cache test tools id: test-tools-cache uses: actions/cache@v4 with: path: vendor-bin - key: ${{ runner.os }}-${{ matrix.php-version }}-php-${{ hashFiles('vendor-bin/*/composer.json') }} + key: ${{ runner.os }}-${{ matrix.php-version }}-vendor-bin-${{ hashFiles('vendor-bin/*/composer.json') }} restore-keys: | - ${{ runner.os }}-${{ matrix.php-version }}-php- + ${{ runner.os }}-${{ matrix.php-version }}-vendor-bin- - name: Install dependencies id: composer From 671f74c3975161a5714bc920739c1efd7ee9dbf3 Mon Sep 17 00:00:00 2001 From: Brett McBride Date: Thu, 17 Jul 2025 12:38:43 +1000 Subject: [PATCH 09/15] dont complain about unused psalm suppressions --- psalm.xml.dist | 1 + 1 file changed, 1 insertion(+) diff --git a/psalm.xml.dist b/psalm.xml.dist index 777979925..af96f5303 100644 --- a/psalm.xml.dist +++ b/psalm.xml.dist @@ -4,6 +4,7 @@ cacheDirectory="var/cache/psalm" findUnusedBaselineEntry="false" findUnusedCode="false" + findUnusedIssueHandlerSuppression="false" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://getpsalm.org/schema/config" xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"> From bdc1e2798afec1f1b9452ab3304fb1683ddeb8d6 Mon Sep 17 00:00:00 2001 From: Brett McBride Date: Thu, 17 Jul 2025 14:21:23 +1000 Subject: [PATCH 10/15] suppress invalid attribute --- psalm.xml.dist | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/psalm.xml.dist b/psalm.xml.dist index af96f5303..89998cd2c 100644 --- a/psalm.xml.dist +++ b/psalm.xml.dist @@ -111,5 +111,11 @@ + + + + + + From d91c6c7e73b23c1133f6fee8e825dea86b783896 Mon Sep 17 00:00:00 2001 From: Brett McBride Date: Thu, 17 Jul 2025 14:36:24 +1000 Subject: [PATCH 11/15] quieten phpstan php8.5 complaints --- phpstan.neon.dist | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 1b67b3216..074ab8db3 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -54,4 +54,9 @@ parameters: - message: "#.*expects Google\\\\Protobuf\\\\RepeatedField.*#" paths: - - src/Contrib/Otlp \ No newline at end of file + - src/Contrib/Otlp + - + message: "#Attribute class .* is not repeatable but is already present above the class.#" + paths: + - tests + - src/Config/SDK/ComponentProvider \ No newline at end of file From 9d02d9eb0c862d851b0f034ee1b09dd05a3e9ece Mon Sep 17 00:00:00 2001 From: Brett McBride Date: Thu, 17 Jul 2025 14:42:12 +1000 Subject: [PATCH 12/15] revert previous commit...now other php versions complain about an unused ignore :( --- phpstan.neon.dist | 5 ----- 1 file changed, 5 deletions(-) diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 074ab8db3..64b8d19b7 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -55,8 +55,3 @@ parameters: message: "#.*expects Google\\\\Protobuf\\\\RepeatedField.*#" paths: - src/Contrib/Otlp - - - message: "#Attribute class .* is not repeatable but is already present above the class.#" - paths: - - tests - - src/Config/SDK/ComponentProvider \ No newline at end of file From 75bee40a70439844973a9b09471c13db1bd623ec Mon Sep 17 00:00:00 2001 From: Brett McBride Date: Tue, 22 Jul 2025 10:20:51 +1000 Subject: [PATCH 13/15] revert typecasting in metrics aggregators --- psalm.xml.dist | 5 +++++ src/API/Trace/TraceState.php | 4 +--- src/Config/SDK/Configuration/ConfigurationFactory.php | 6 +----- src/Contrib/Otlp/ProtobufSerializer.php | 6 +----- .../Aggregation/ExplicitBucketHistogramAggregation.php | 8 ++------ src/SDK/Metrics/Aggregation/SumAggregation.php | 8 ++------ tests/Unit/Contrib/Zipkin/ZipkinSpanConverterTest.php | 2 +- tests/Unit/SDK/Logs/LoggerTest.php | 2 +- 8 files changed, 14 insertions(+), 27 deletions(-) diff --git a/psalm.xml.dist b/psalm.xml.dist index 89998cd2c..34fc1b900 100644 --- a/psalm.xml.dist +++ b/psalm.xml.dist @@ -117,5 +117,10 @@ + + + + + diff --git a/src/API/Trace/TraceState.php b/src/API/Trace/TraceState.php index eb4d505dc..3f402a555 100644 --- a/src/API/Trace/TraceState.php +++ b/src/API/Trace/TraceState.php @@ -94,9 +94,7 @@ public function toString(?int $limit = null): string foreach ([128, 0] as $threshold) { // Then entries SHOULD be removed starting from the end of tracestate. for ($value = end($traceState); $key = key($traceState);) { - if ($value === false) { - continue; - } + assert($value !== false); $entry = strlen($key) + 1 + strlen($value); $value = prev($traceState); if ($entry <= $threshold) { diff --git a/src/Config/SDK/Configuration/ConfigurationFactory.php b/src/Config/SDK/Configuration/ConfigurationFactory.php index 7fa911834..7902c9442 100644 --- a/src/Config/SDK/Configuration/ConfigurationFactory.php +++ b/src/Config/SDK/Configuration/ConfigurationFactory.php @@ -27,7 +27,6 @@ use OpenTelemetry\Config\SDK\Configuration\Internal\TrackingEnvReader; use OpenTelemetry\Config\SDK\Configuration\Loader\YamlExtensionFileLoader; use OpenTelemetry\Config\SDK\Configuration\Loader\YamlSymfonyFileLoader; -use RuntimeException; use function serialize; use function sprintf; use Symfony\Component\Config\Definition\Builder\NodeBuilder; @@ -108,10 +107,7 @@ public function parseFile( } $loader = new ConfigurationLoader($resources); - $cwd = getcwd(); - if ($cwd === false) { - throw new RuntimeException('Current working directory could not be determined.'); - } + $cwd = getcwd() ?: []; $locator = new FileLocator($cwd); $fileLoader = new DelegatingLoader(new LoaderResolver([ new YamlSymfonyFileLoader($loader, $locator), diff --git a/src/Contrib/Otlp/ProtobufSerializer.php b/src/Contrib/Otlp/ProtobufSerializer.php index 8840cf3e5..77b735613 100644 --- a/src/Contrib/Otlp/ProtobufSerializer.php +++ b/src/Contrib/Otlp/ProtobufSerializer.php @@ -124,11 +124,7 @@ private static function serializeToJsonString(Message $message): string self::traverseDescriptor($data, $desc); $encoded = json_encode($data, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); - if ($encoded === false) { - self::logWarning('Failed to encode protobuf to JSON: ' . json_last_error_msg()); - - return ''; - } + assert($encoded !== false); return $encoded; } diff --git a/src/SDK/Metrics/Aggregation/ExplicitBucketHistogramAggregation.php b/src/SDK/Metrics/Aggregation/ExplicitBucketHistogramAggregation.php index b7c9eee19..5ac1f3f49 100644 --- a/src/SDK/Metrics/Aggregation/ExplicitBucketHistogramAggregation.php +++ b/src/SDK/Metrics/Aggregation/ExplicitBucketHistogramAggregation.php @@ -62,9 +62,7 @@ public function record($summary, $value, AttributesInterface $attributes, Contex public function merge($left, $right): ExplicitBucketHistogramSummary { $count = $left->count + $right->count; - $sum = (is_int($left->sum) && is_int($right->sum)) - ? ($left->sum + $right->sum) - : ((float) $left->sum + (float) $right->sum); + $sum = $left->sum + $right->sum; $min = self::min($left->min, $right->min); $max = self::max($left->max, $right->max); $buckets = $right->buckets; @@ -89,9 +87,7 @@ public function merge($left, $right): ExplicitBucketHistogramSummary public function diff($left, $right): ExplicitBucketHistogramSummary { $count = -$left->count + $right->count; - $sum = (is_int($left->sum) && is_int($right->sum)) - ? (-$left->sum + $right->sum) - : (-(float) $left->sum + (float) $right->sum); + $sum = -$left->sum + $right->sum; $min = $left->min > $right->min ? $right->min : NAN; $max = $left->max < $right->max ? $right->max : NAN; $buckets = $right->buckets; diff --git a/src/SDK/Metrics/Aggregation/SumAggregation.php b/src/SDK/Metrics/Aggregation/SumAggregation.php index d1089715c..09d17bac8 100644 --- a/src/SDK/Metrics/Aggregation/SumAggregation.php +++ b/src/SDK/Metrics/Aggregation/SumAggregation.php @@ -40,9 +40,7 @@ public function record($summary, $value, AttributesInterface $attributes, Contex #[\Override] public function merge($left, $right): SumSummary { - $sum = (is_int($left->value) && is_int($right->value)) - ? ($left->value + $right->value) - : ((float) $left->value + (float) $right->value); + $sum = $left->value + $right->value; return new SumSummary($sum); } @@ -54,9 +52,7 @@ public function merge($left, $right): SumSummary #[\Override] public function diff($left, $right): SumSummary { - $diff = (is_int($left->value) && is_int($right->value)) - ? (-$left->value + $right->value) - : (-(float) $left->value + (float) $right->value); + $diff = -$left->value + $right->value; return new SumSummary($diff); } diff --git a/tests/Unit/Contrib/Zipkin/ZipkinSpanConverterTest.php b/tests/Unit/Contrib/Zipkin/ZipkinSpanConverterTest.php index a0ab591d2..7294ef729 100644 --- a/tests/Unit/Contrib/Zipkin/ZipkinSpanConverterTest.php +++ b/tests/Unit/Contrib/Zipkin/ZipkinSpanConverterTest.php @@ -182,7 +182,7 @@ public function test_should_use_otel_ipv_4_and_port_correctly_for_zipkin_remote_ $row = $converter->convert([$span])[0]; $this->assertSame('unknown', $row['remoteEndpoint']['serviceName']); - $this->assertSame(pow(2, 32)-1, $row['remoteEndpoint']['ipv4']); + $this->assertSame((int) pow(2, 32)-1, (int) $row['remoteEndpoint']['ipv4']); $this->assertSame(80, $row['remoteEndpoint']['port']); } diff --git a/tests/Unit/SDK/Logs/LoggerTest.php b/tests/Unit/SDK/Logs/LoggerTest.php index 3dd185be2..2b19a2ba8 100644 --- a/tests/Unit/SDK/Logs/LoggerTest.php +++ b/tests/Unit/SDK/Logs/LoggerTest.php @@ -71,7 +71,7 @@ public function test_sets_observed_timestamp_on_emit(): void { $logger = new Logger($this->sharedState, $this->scope); $record = new LogRecord(); - $time = microtime(true) * LogRecord::NANOS_PER_SECOND; + $time = microtime(true) * (float) LogRecord::NANOS_PER_SECOND; $this->processor->expects($this->once())->method('onEmit') ->with( From 6a81ccd4d38161aa04346a2b714eeffbb043a249 Mon Sep 17 00:00:00 2001 From: Brett McBride Date: Fri, 18 Jul 2025 09:39:49 +1000 Subject: [PATCH 14/15] Update src/Contrib/Otlp/ProtobufSerializer.php Co-authored-by: Chris Lightfoot-Wild --- src/Contrib/Otlp/ProtobufSerializer.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Contrib/Otlp/ProtobufSerializer.php b/src/Contrib/Otlp/ProtobufSerializer.php index 77b735613..7195c4e50 100644 --- a/src/Contrib/Otlp/ProtobufSerializer.php +++ b/src/Contrib/Otlp/ProtobufSerializer.php @@ -32,6 +32,7 @@ final class ProtobufSerializer { use LogsMessagesTrait; + private function __construct(private readonly string $contentType) { } From 580d7ddc096cb80123dcce1dadb9ffac504ef2f9 Mon Sep 17 00:00:00 2001 From: Brett McBride Date: Tue, 22 Jul 2025 10:42:16 +1000 Subject: [PATCH 15/15] remove override stub and use the polyfill from deptrac --- deptrac.yaml | 15 +++++++++------ deptrac/{stubs => polyfills}/ComponentPlugin.php | 0 .../{stubs => polyfills}/ComponentProvider.php | 0 .../ComponentProviderRegistry.php | 0 deptrac/{stubs => polyfills}/Context.php | 0 deptrac/polyfills/README.md | 3 +++ deptrac/stubs/Override.php | 10 ---------- deptrac/stubs/README.md | 2 -- 8 files changed, 12 insertions(+), 18 deletions(-) rename deptrac/{stubs => polyfills}/ComponentPlugin.php (100%) rename deptrac/{stubs => polyfills}/ComponentProvider.php (100%) rename deptrac/{stubs => polyfills}/ComponentProviderRegistry.php (100%) rename deptrac/{stubs => polyfills}/Context.php (100%) create mode 100644 deptrac/polyfills/README.md delete mode 100644 deptrac/stubs/Override.php delete mode 100644 deptrac/stubs/README.md diff --git a/deptrac.yaml b/deptrac.yaml index d1d9dc30a..8afb8a3fa 100644 --- a/deptrac.yaml +++ b/deptrac.yaml @@ -14,7 +14,8 @@ deptrac: - ./src - ./proto - ./tests - - ./deptrac/stubs + - ./deptrac/polyfills + - ./vendor/symfony/polyfill-php83/Resources/stubs exclude_files: - '#.*test.*#' layers: @@ -110,15 +111,17 @@ deptrac: collectors: - type: className regex: ^Nyholm\\Psr7Server\\* - - name: Stubs + - name: Polyfills collectors: - type: directory - value: deptrac/stubs/.* + value: deptrac/polyfills/.* + - type: directory + value: vendor/symfony/polyfill-php83 ruleset: Context: - FFI - - Stubs + - Polyfills SemConv: ~ ConfigSDK: - SymfonyConfig @@ -130,12 +133,12 @@ deptrac: - Context - Contrib - Extension - - Stubs + - Polyfills API: - Context - PsrLog - SPI - - Stubs + - Polyfills SDK: - +API - ConfigSDK diff --git a/deptrac/stubs/ComponentPlugin.php b/deptrac/polyfills/ComponentPlugin.php similarity index 100% rename from deptrac/stubs/ComponentPlugin.php rename to deptrac/polyfills/ComponentPlugin.php diff --git a/deptrac/stubs/ComponentProvider.php b/deptrac/polyfills/ComponentProvider.php similarity index 100% rename from deptrac/stubs/ComponentProvider.php rename to deptrac/polyfills/ComponentProvider.php diff --git a/deptrac/stubs/ComponentProviderRegistry.php b/deptrac/polyfills/ComponentProviderRegistry.php similarity index 100% rename from deptrac/stubs/ComponentProviderRegistry.php rename to deptrac/polyfills/ComponentProviderRegistry.php diff --git a/deptrac/stubs/Context.php b/deptrac/polyfills/Context.php similarity index 100% rename from deptrac/stubs/Context.php rename to deptrac/polyfills/Context.php diff --git a/deptrac/polyfills/README.md b/deptrac/polyfills/README.md new file mode 100644 index 000000000..0e34a66ad --- /dev/null +++ b/deptrac/polyfills/README.md @@ -0,0 +1,3 @@ +Polyfills for deptrac, which represent classes missing from some PHP versions, or classes +that deptrac does not understand. +We also use some symfony polyfills for deptrac, under `vendor/symfony/polyfill-*`. \ No newline at end of file diff --git a/deptrac/stubs/Override.php b/deptrac/stubs/Override.php deleted file mode 100644 index 3c5a77277..000000000 --- a/deptrac/stubs/Override.php +++ /dev/null @@ -1,10 +0,0 @@ -