MCPcopy Create free account
hub / github.com/PHPantom-dev/phpantom_lsp / demo

Method demo

examples/demo.php:2916–2937  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2914class ParamClosureThisDemo
2915{
2916 public function demo(): void
2917 {
2918 $router = new ScaffoldingClosureThisRouter();
2919
2920 // @param-closure-this overrides $this inside the closure to
2921 // ScaffoldingClosureThisRoute instead of ParamClosureThisDemo.
2922 $router->group(function () {
2923 $this->middleware('auth'); // resolves Route::middleware()
2924 $this->prefix('/api'); // resolves Route::prefix()
2925 });
2926
2927 // Chaining through the overridden $this
2928 $router->group(function () {
2929 $this->middleware('auth')->prefix('/v2');
2930 });
2931
2932 // @param-closure-this with $this as the type (declares the
2933 // closure's $this is the method's declaring class).
2934 $router->extend('redis', function () {
2935 $this->getDefaultDriver(); // resolves Router::getDefaultDriver()
2936 });
2937 }
2938}
2939
2940

Callers

nothing calls this directly

Calls 5

groupMethod · 0.80
middlewareMethod · 0.80
prefixMethod · 0.80
extendMethod · 0.80
getDefaultDriverMethod · 0.80

Tested by

no test coverage detected