Closed gmeister2 closed 4 years ago
$routes->group('/', [ 'namespace' => 'App\Controllers\API\v1'' ], function($routes) {
$routes->resource('users');
});
put that in controller folder.. and use name space in ur controller
I took the example from the CI User Guide. My application works fine, I just wanted to report the warning given by PhpStorm.
@gmeister2 I made the PR for the docblock changes of RouterCollection and did not know that PhpStorm resolves docblocks that way. I am using VSCode as my IDE and no warnings were generated using your example. Can you try using mixed
as typehint if it will be removed?
Yes, this solves it for me.
line 729: @param mixed ...$params
OK, I'll PR that.
Thanks!
I have the same problem, please help. Thanks.
Describe the bug When using the group function in Routes.php, example: $routes->group('api', ['namespace' => 'App\API\v1'], function($routes) { $routes->resource('users'); });
PhpStorm gives the following warning: Expected parameter of type 'array|array[]', 'Closure' provided
CodeIgniter 4 version CI 4.04
Affected module(s) app\Config\Routes.php
Expected behavior, and steps to reproduce if appropriate CI 4.03 did not show this warning, because of difference in DocBlock of 'group' function in: vendor\codeigniter4\framework\system\Router\RouteCollection.php