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

feat: context resolvers #8

Merged
merged 3 commits into from
Jul 13, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
rm unused method
azuradara committed Jul 13, 2024
commit 8cee7cf40657c8ea7ae6410f7a5d467bae29450f
16 changes: 0 additions & 16 deletions src/Drivers/Decorator.php
Original file line number Diff line number Diff line change
@@ -7,7 +7,6 @@
use Illuminate\Support\Collection;
use Illuminate\Support\Str;
use ReflectionFunction;
use ReflectionType;
use Symfony\Component\Finder\Finder;
use YouCanShop\Foggle\Contracts\Driver;
use YouCanShop\Foggle\FeatureInteraction;
@@ -114,21 +113,6 @@ protected function resolve(string $name, callable $resolver, $context)
return $resolver($context);
}

protected function getContextType($resolver): ?ReflectionType
{
if ($resolver instanceof Lazily) {
return null;
}

$function = new ReflectionFunction(Closure::fromCallable($resolver));

if ($function->getNumberOfParameters() !== 1 || !$function->getParameters()[0]->hasType()) {
return null;
}

return $function->getParameters()[0]->getType();
}

protected function canHandleNullContext(callable $resolver): bool
{
$function = new ReflectionFunction(Closure::fromCallable($resolver));