Skip to content

Commit

Permalink
ENH Stop using Controller::has_curr()
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Feb 13, 2025
1 parent b7ab7b4 commit dcff8c1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
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

0 comments on commit dcff8c1

Please sign in to comment.