Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

84 implicit null #1394

Merged
merged 13 commits into from
Oct 2, 2024
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
final class YamlExtensionFileLoader extends FileLoader
{

public function __construct(private readonly ConfigurationLoader $configuration, FileLocatorInterface $locator, string $env = null)
public function __construct(private readonly ConfigurationLoader $configuration, FileLocatorInterface $locator, ?string $env = null)
{
parent::__construct($locator, $env);
}

public function load(mixed $resource, string $type = null): mixed
public function load(mixed $resource, ?string $type = null): mixed
{
assert(extension_loaded('yaml'));

Expand All @@ -39,7 +39,7 @@ public function load(mixed $resource, string $type = null): mixed
return null;
}

public function supports(mixed $resource, string $type = null): bool
public function supports(mixed $resource, ?string $type = null): bool
{
return extension_loaded('yaml')
&& is_string($resource)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
final class YamlSymfonyFileLoader extends FileLoader
{

public function __construct(private readonly ConfigurationLoader $configuration, FileLocatorInterface $locator, string $env = null)
public function __construct(private readonly ConfigurationLoader $configuration, FileLocatorInterface $locator, ?string $env = null)
{
parent::__construct($locator, $env);
}

public function load(mixed $resource, string $type = null): mixed
public function load(mixed $resource, ?string $type = null): mixed
{
assert(class_exists(Yaml::class));

Expand All @@ -43,7 +43,7 @@ public function load(mixed $resource, string $type = null): mixed
return null;
}

public function supports(mixed $resource, string $type = null): bool
public function supports(mixed $resource, ?string $type = null): bool
{
return class_exists(Yaml::class)
&& is_string($resource)
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/SDK/Metrics/MeterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ public function test_uses_default_view_if_null_views_returned(): void
/**
* @param iterable<MetricReaderInterface&MetricSourceRegistryInterface&DefaultAggregationProviderInterface> $metricReaders
*/
private function createMeterProviderForMetricFactory(MetricFactoryInterface $metricFactory, ViewRegistryInterface $viewRegistry = null, iterable $metricReaders = []): MeterProvider
private function createMeterProviderForMetricFactory(MetricFactoryInterface $metricFactory, ?ViewRegistryInterface $viewRegistry = null, iterable $metricReaders = []): MeterProvider
{
return new MeterProvider(
null,
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/SDK/Trace/SamplerFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class SamplerFactoryTest extends TestCase
use TestState;

#[DataProvider('samplerProvider')]
public function test_create_sampler_from_environment(string $samplerName, string $expected, string $arg = null): void
public function test_create_sampler_from_environment(string $samplerName, string $expected, ?string $arg = null): void
{
$this->setEnvironmentVariable('OTEL_TRACES_SAMPLER', $samplerName);
$this->setEnvironmentVariable('OTEL_TRACES_SAMPLER_ARG', $arg);
Expand All @@ -39,7 +39,7 @@ public static function samplerProvider(): array
];
}
#[DataProvider('invalidSamplerProvider')]
public function test_throws_exception_for_invalid_or_unsupported(?string $sampler, string $arg = null): void
public function test_throws_exception_for_invalid_or_unsupported(?string $sampler, ?string $arg = null): void
{
$this->setEnvironmentVariable('OTEL_TRACES_SAMPLER', $sampler);
$this->setEnvironmentVariable('OTEL_TRACES_SAMPLER_ARG', $arg);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ private function createInstrumentationScopeMock(): InstrumentationScopeInterface

return $mock;
}
private function createSpanContextMock(string $spanId, string $traceId = '0', string $traceState = null): SpanContextInterface
private function createSpanContextMock(string $spanId, string $traceId = '0', ?string $traceState = null): SpanContextInterface
{
$mock = $this->createMock(SpanContextInterface::class);

Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/SDK/Trace/SpanTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -835,8 +835,8 @@ private function createTestRootSpan(): Span
*/
private function createTestSpan(
int $kind = API\SpanKind::KIND_INTERNAL,
SpanLimits $spanLimits = null,
string $parentSpanId = null,
?SpanLimits $spanLimits = null,
?string $parentSpanId = null,
iterable $attributes = [],
array $links = [],
): Span {
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/SDK/Util/SpanData.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public function setEvents(array $events): self
return $this;
}

public function addEvent(string $name, AttributesInterface $attributes, int $timestamp = null): self
public function addEvent(string $name, AttributesInterface $attributes, ?int $timestamp = null): self
{
$this->events[] = new SDK\Event($name, $timestamp ?? Clock::getDefault()->now(), $attributes);

Expand Down
Loading