Skip to content

Commit

Permalink
8.4: fixing some implicit nullable params
Browse files Browse the repository at this point in the history
  • Loading branch information
brettmc committed Oct 2, 2024
1 parent bee9c64 commit d51fce8
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
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
6 changes: 3 additions & 3 deletions src/Config/SDK/Configuration/Loader/YamlSymfonyFileLoader.php
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 @@ -391,7 +391,7 @@ public function test_update_configurator(): 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

0 comments on commit d51fce8

Please sign in to comment.