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

ENH Stop using Controller::has_curr() #626

Merged
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
7 changes: 4 additions & 3 deletions src/Schema/Storage/AbstractTypeRegistry.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,10 @@ public static function get(string $typename)

private static function canRebuildOnMissing(): bool
{
if (!Controller::has_curr() ||
!(Controller::curr() instanceof GraphQLController) ||
!Controller::curr()->autobuildEnabled()
$controller = Controller::curr();
if (!$controller ||
!($controller instanceof GraphQLController) ||
!$controller->autobuildEnabled()
) {
return false;
}
Expand Down
5 changes: 3 additions & 2 deletions tests/Schema/AbstractTypeRegistryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ protected function tearDown(): void
$fs->remove($dir);
}
// ensure that any GraphqlController added to controller_stack is removed
if (Controller::has_curr() && (Controller::curr() instanceof GraphQLController)) {
Controller::curr()->popCurrent();
$controller = Controller::curr();
if ($controller instanceof GraphQLController) {
$controller->popCurrent();
}
}

Expand Down
Loading