Describe the bug
VSCode shows "Undefined method 'disableForeignKeyChecks'. intelephense(1013)" on defined method inside a CodeIgniter4 Project even though the method is defined.
To Reproduce
Use VSCode with intelephense installed.
Create CodeIgniter4 Project:
composer create-project codeigniter4/appstarter example-project-folder
cd example-project-folder
php spark make:migration CreateTest
Go to example-project-folder/app/Database/Migrations/2023-02-26-234615_CreateTest.php and paste following code:
<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class CreateTest extends Migration
{
public function up()
{
$this->db->disableForeignKeyChecks(); // <- throws the error
// START_IRRELEVANT - irrelevant but context
$this->forge->addField([
'id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
'auto_increment' => true,
],
'name' => [
'type' => 'BOOLEAN',
'null' => false,
'default' => true
],
]);
$this->forge->addPrimaryKey('id');
$this->forge->createTable('test');
// END_IRRELEVANT
$this->db->enableForeignKeyChecks(); // <- throws the error
}
public function down()
{
$this->forge->dropTable('test');
}
}
Not needed, but to "test" the file:
php spark migrate:rollback
php spark migrate
The methods enableForeignKeyChecks and disableForeignKeyChecks exists here:
vendor/codeigniter4/framework/system/Database/BaseConnection.php
Expected behavior
I expect Intelephense to find the method (vscode does) and not throw that 1013 error - the code runs perfectly fine. VSCode highlights the files red: "error in the file", which is annoying.
Screenshots
The error:
VSCode finds everything and Intelephense doesn't seem to see a problem:
Describe the bug VSCode shows "Undefined method 'disableForeignKeyChecks'. intelephense(1013)" on defined method inside a CodeIgniter4 Project even though the method is defined.
To Reproduce Use VSCode with intelephense installed. Create CodeIgniter4 Project:
Go to
example-project-folder/app/Database/Migrations/2023-02-26-234615_CreateTest.php
and paste following code:Not needed, but to "test" the file:
The methods
enableForeignKeyChecks
anddisableForeignKeyChecks
exists here:vendor/codeigniter4/framework/system/Database/BaseConnection.php
Expected behavior I expect Intelephense to find the method (vscode does) and not throw that 1013 error - the code runs perfectly fine. VSCode highlights the files red: "error in the file", which is annoying.
Screenshots The error:
VSCode finds everything and Intelephense doesn't seem to see a problem:
The most annoying part:
Platform and version