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

change provider value from constant to property [BUG] #104

Open
apodgorbunschih opened this issue Jul 31, 2024 · 1 comment
Open

change provider value from constant to property [BUG] #104

apodgorbunschih opened this issue Jul 31, 2024 · 1 comment
Labels
bug Something isn't working Needs Triage This issue needs to be investigated by a maintainer

Comments

@apodgorbunschih
Copy link
Contributor

apodgorbunschih commented Jul 31, 2024

Observed behavior

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

Expected Behavior

getMetadata method to return the proper provider

Steps to reproduce

<?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 apodgorbunschih added bug Something isn't working Needs Triage This issue needs to be investigated by a maintainer labels Jul 31, 2024
@apodgorbunschih
Copy link
Contributor Author

apodgorbunschih commented Jul 31, 2024

#105 Could somebody please check this MR 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Needs Triage This issue needs to be investigated by a maintainer
Projects
None yet
Development

No branches or pull requests

1 participant