Skip to content

Conversation

@apodgorbunschih
Copy link

@apodgorbunschih apodgorbunschih commented Jul 8, 2024

The implementation is not fulfilling the abstraction definition:
https://github.com/open-feature/php-sdk/blob/4e25be68937dc4ec405366cb6ba726f66fc0e5c8/src/implementation/provider/AbstractProvider.php#L19

protected static string $NAME = 'AbstractProvider';

The implementation is pointing not to a property but to a constant.

protected const NAME = 'SplitProvider';

This is leading to getMetadata method in the implementation to return all the time "AbstractProvider" value

Reproducing the issues:

<?php
abstract class AbstractProvider {
  protected static string $NAME = 'AbstractProvider';
  
  public function getMetadata()
  {
      return static::$NAME;
  }
}

class SplitProvider extends AbstractProvider
{
    protected const NAME = 'SplitProvider';
}

class FlagdProvider extends AbstractProvider
{
    protected const NAME = 'FlagdProvider';
}

$splitProvider = new SplitProvider();
var_dump($splitProvider->getMetadata());


$flagDProvider = new FlagdProvider();
var_dump($flagDProvider->getMetadata());
?>

@apodgorbunschih
Copy link
Author

@tcarrio Could you please check this change. There was a mistake in the overriding of the static property from the Abstract Provider. That lead to $NAME being all the time AbstractProvider instead of FlagdProvider

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant