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

fix: Use late static binding in AbstractProvider #123

Merged
merged 1 commit into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/implementation/provider/AbstractProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ abstract class AbstractProvider implements Provider

public function getMetadata(): MetadataInterface
{
return new Metadata(self::$NAME);
return new Metadata(static::$NAME);
}

abstract public function resolveBooleanValue(string $flagKey, bool $defaultValue, ?EvaluationContext $context = null): ResolutionDetailsInterface;
Expand Down
13 changes: 3 additions & 10 deletions tests/TestProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,19 @@

namespace OpenFeature\Test;

use OpenFeature\implementation\common\Metadata;
use OpenFeature\implementation\provider\AbstractProvider;
use OpenFeature\implementation\provider\ResolutionDetailsFactory;
use OpenFeature\interfaces\common\Metadata as MetadataInterface;
use OpenFeature\interfaces\flags\EvaluationContext;
use OpenFeature\interfaces\hooks\HooksAwareTrait;
use OpenFeature\interfaces\provider\Provider;
use OpenFeature\interfaces\provider\ResolutionDetails;
use Psr\Log\LoggerAwareTrait;

class TestProvider implements Provider
class TestProvider extends AbstractProvider
{
use HooksAwareTrait;
use LoggerAwareTrait;

public const NAME = 'TestProvider';

public function getMetadata(): MetadataInterface
{
return new Metadata(self::NAME);
}
protected static string $NAME = 'TestProvider';

/**
* Resolves the flag value for the provided flag key as a boolean
Expand Down
3 changes: 0 additions & 3 deletions tests/unit/HooksTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ public function testEvaluationContextIsImmutableInAfterHooks(): void
[$mutationHook],
new HookHints(),
);
// @phpstan-ignore-next-line
$this->assertNull($additionalEvaluationContext);
}

Expand Down Expand Up @@ -175,7 +174,6 @@ public function testEvaluationContextIsImmutableInErrorHooks(): void
new HookHints(),
);

//@phpstan-ignore-next-line
$this->assertNull($additionalEvaluationContext);
}

Expand Down Expand Up @@ -206,7 +204,6 @@ public function testEvaluationContextIsImmutableInFinallyHooks(): void
new HookHints(),
);

// @phpstan-ignore-next-line
$this->assertNull($additionalEvaluationContext);
}

Expand Down
Loading