-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Description
PHP Version
8.2
CodeIgniter4 Version
4.6.2
CodeIgniter4 Installation Method
Composer (using codeigniter4/appstarter
)
Which operating systems have you tested for this bug?
Linux
Which server did you use?
apache
Database
No response
What happened?
When use first Example Usage
from https://codeigniter.com/user_guide/outgoing/api_responses.html
VS Code complains about Call to unknown method: CodeIgniter\HTTP\RequestInterface::getPost()
at line:
$user = $model->save($this->request->getPost());
When remove use ResponseTrait;
then property $this->request
changes
from: \CodeIgniter\HTTP\RequestInterface $request
to: \CodeIgniter\HTTP\CLIRequest|\CodeIgniter\HTTP\IncomingRequest
At runtime it works correctly only annoying VS Code highlights.
Steps to Reproduce
In test controller:
<?php
namespace App\Controllers;
use CodeIgniter\API\ResponseTrait;
use CodeIgniter\Controller;
class Users extends Controller
{
use ResponseTrait;
public function createUser()
{
$model = new UserModel();
/**
VS code popup on `$this->request`
CodeIgniter\API\ResponseTrait::$request
<?php
public $request;
@var \CodeIgniter\HTTP\RequestInterface $request
*/
$user = $model->save($this->request->getPost());
// Respond with 201 status code
return $this->respondCreated();
}
}
Expected Output
Do no complain about unknow method getPost
and is
Anything else?
No response
Metadata
Metadata
Assignees
Labels
No labels