Skip to content

Commit 6a73084

Browse files
mnapolitillkruss
andauthored
Make sure the OctaneHandler is not created by the Laravel kernel (#45)
* Make sure the OctaneHandler is not created by the Laravel kernel Indeed, Octane boots Laravel (not the other way around) * sort --------- Co-authored-by: Till Krüss <tillkruss@users.noreply.github.com>
1 parent f34ac50 commit 6a73084

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/HandlerResolver.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
namespace CacheWerk\BrefLaravelBridge;
44

55
use RuntimeException;
6+
67
use Bref\Runtime\FileHandlerLocator;
78
use Psr\Container\ContainerInterface;
89
use Illuminate\Foundation\Application;
10+
use CacheWerk\BrefLaravelBridge\Http\OctaneHandler;
911

1012
/**
1113
* This class resolves Lambda handlers.
@@ -32,6 +34,11 @@ public function get(string $id)
3234
return $this->fileLocator->get($id);
3335
}
3436

37+
// The Octane handler is special: it is not created by Laravel's container
38+
if ($id === OctaneHandler::class) {
39+
return new OctaneHandler;
40+
}
41+
3542
// If not, we try to get the handler from the Laravel container
3643
return $this->laravelApp()->get($id);
3744
}
@@ -43,6 +50,11 @@ public function has(string $id): bool
4350
return true;
4451
}
4552

53+
// The Octane handler is special: it is not created by Laravel's container
54+
if ($id === OctaneHandler::class) {
55+
return true;
56+
}
57+
4658
// If not, we try to get the handler from the Laravel container
4759
return $this->laravelApp()->has($id);
4860
}

0 commit comments

Comments
 (0)