Skip to content

Commit b395a84

Browse files
authored
Merge pull request #6910 from kenjis/fix-controller-request-type
fix: $request type in BaseController and BaseResource
2 parents 9be490d + 738ec56 commit b395a84

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

app/Controllers/BaseController.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
namespace App\Controllers;
44

55
use CodeIgniter\Controller;
6+
use CodeIgniter\HTTP\CLIRequest;
7+
use CodeIgniter\HTTP\IncomingRequest;
68
use CodeIgniter\HTTP\RequestInterface;
79
use CodeIgniter\HTTP\ResponseInterface;
810
use Psr\Log\LoggerInterface;
@@ -22,7 +24,7 @@ abstract class BaseController extends Controller
2224
/**
2325
* Instance of the main Request object.
2426
*
25-
* @var RequestInterface
27+
* @var CLIRequest|IncomingRequest
2628
*/
2729
protected $request;
2830

system/RESTful/BaseResource.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,21 @@
1212
namespace CodeIgniter\RESTful;
1313

1414
use CodeIgniter\Controller;
15+
use CodeIgniter\HTTP\CLIRequest;
16+
use CodeIgniter\HTTP\IncomingRequest;
1517
use CodeIgniter\HTTP\RequestInterface;
1618
use CodeIgniter\HTTP\ResponseInterface;
1719
use Psr\Log\LoggerInterface;
1820

1921
abstract class BaseResource extends Controller
2022
{
23+
/**
24+
* Instance of the main Request object.
25+
*
26+
* @var CLIRequest|IncomingRequest
27+
*/
28+
protected $request;
29+
2130
/**
2231
* @var string|null The model that holding this resource's data
2332
*/
@@ -34,6 +43,7 @@ abstract class BaseResource extends Controller
3443
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
3544
{
3645
parent::initController($request, $response, $logger);
46+
3747
$this->setModel($this->modelName);
3848
}
3949

0 commit comments

Comments
 (0)