Skip to content

Commit

Permalink
Fix: Transpilation error
Browse files Browse the repository at this point in the history
  • Loading branch information
RikudouSage committed Aug 19, 2021
1 parent 3603a39 commit 0105d7e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 0 additions & 4 deletions src/Configuration/Context.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

namespace Unleash\Client\Configuration;

/**
* @method string|null getHostname()
* @method Context setHostname(string|null $hostname)
*/
interface Context
{
public function getCurrentUserId(): ?string;
Expand Down
10 changes: 9 additions & 1 deletion src/Strategy/ApplicationHostnameStrategyHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,15 @@ public function isEnabled(Strategy $strategy, Context $context): bool
}

$hostnames = array_map('trim', explode(',', $hostnames));
$enabled = in_array($context->getHostname(), $hostnames, true);
// todo refactor once rector fixes a bug that prevents phpdoc methods from working
if (method_exists($context, 'getHostname')) {
$hostname = $context->getHostname();
} else {
// @codeCoverageIgnoreStart
$hostname = $context->findContextValue('hostname');
// @codeCoverageIgnoreEnd
}
$enabled = in_array($hostname, $hostnames, true);

if (!$enabled) {
return false;
Expand Down

0 comments on commit 0105d7e

Please sign in to comment.