()
| 2914 | class 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 |
nothing calls this directly
no test coverage detected