This is bothering me because in the latest update to PHP Intelephense that I received today, intelephense keeps showing errors for unknown properties, functions.
Telephons (1014)
This is my code:
<?php defined('BASEPATH') or exit('No direct script access allowed'); class Firm extends CI_Controller { /** * Index Page for this controller. * * Maps to the following URL * http://example.com/index.php/welcome * - or - * http://example.com/index.php/welcome/index * - or - * Since this controller is set as the default controller in * config/routes.php, it's displayed at http://example.com/ * * So any other public methods not prefixed with an underscore will * map to /index.php/welcome/<method_name> * @see https://codeigniter.com/user_guide/general/urls.html */ function __construct() { parent::__construct(); $this->load->helper('url'); $this->load->database(); $this->load->model('Users'); $this->load->model('Projects_Details'); $this->load->model('Categories'); date_default_timezone_set('asia/manila'); } public function index() { $this->load->view('services/default/header'); $this->load->view('services/firm/firm'); $this->load->view('services/default/footer'); } public function services() { $this->load->library('session'); if (!$this->session->userdata('user')) { redirect('login', 'refresh'); } else { $this->load->view('firm/projects/header-nav'); $this->load->view('default/sidebar/firm/services/sidebar-menu'); $this->load->view('firm/services/services-1'); } } public function firm_services() { $this->load->library('session'); if (!$this->session->userdata('user')) { redirect('login', 'refresh'); } else { $this->load->view('firm/projects/header-nav'); $this->load->view('default/sidebar/firm/firm-services/sidebar-menu'); $this->load->view('firm/firm_services/firm_services'); } } public function add_firm_services() { $permitted_chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; $user_id = $this->input->post('user_id'); $service_code = substr(str_shuffle($permitted_chars), 0, 10) . rand(10000000, 99999999); $category_id = $this->input->post('category_id'); $sub_category_id = $this->input->post('sub_category_id'); $service_name = $this->input->post('service_name'); $description = $this->input->post('description'); $display_service_name = $service_name; $display_amount = $this->input->post('display_amount'); $ope = rand(0, 1); $status = 1; $vat = 12; $data = array( 'user_id' => $user_id, 'service_code' => $service_code, 'category_id' => $category_id, 'sub_category_id' => $sub_category_id, 'service_name' => $service_name, 'description' => $description, 'display_service_name' => $display_service_name, 'display_amount' => $display_amount, 'ope' => $ope, 'status' => $status, 'vat' => $vat ); $this->db->insert('services', $data); $this->session->set_flashdata('success', 'Service successfully added.'); redirect('Firm/firm_services', 'refresh'); } public function projects() { $this->load->library('session'); if (!$this->session->userdata('user')) { redirect('login', 'refresh'); } else { $this->load->view('firm/projects/header-nav'); $this->load->view('default/sidebar/firm/projects/sidebar-menu'); $this->load->view('firm/projects/project_view1'); } } public function edit_projects($id) { $this->load->library('session'); if (!$this->session->userdata('user')) { redirect('login', 'refresh'); } else { $data['project'] = $this->Projects_Details->get_id($id); $this->load->view('firm/projects/header-nav'); $this->load->view('default/sidebar/firm/projects/sidebar-menu'); $this->load->view('firm/projects/project_view_edit', $data); } } public function update_projects($id) { $data = array( 'project_id' => $this->input->post('project_id'), 'service_id' => $this->input->post('service_id'), 'firm_id' => $this->input->post('firm_id'), 'assigned_id' => $this->input->post('assigned_id'), 'package_id' => $this->input->post('package_id'), 'amount' => $this->input->post('amount'), 'ope' => $this->input->post('ope'), 'start_date' => $this->input->post('start_date'), 'due_date' => $this->input->post('due_date'), 'status' => $this->input->post('status'), 'comment' => $this->input->post('comment'), 'updated_at' => $this->input->post('updated_at'), ); $this->db->where('id', $id); $this->db->update('projects', $data); redirect('Firm/projects', 'refresh'); } public function show_projects($id) { $this->load->library('session'); if (!$this->session->userdata('user')) { redirect('login', 'refresh'); } else { $data['project'] = $this->Projects_Details->get_id($id); $this->load->view('firm/projects/header-nav'); $this->load->view('default/sidebar/firm/firm-specialist/sidebar-menu'); $this->load->view('firm/projects/project_view_show', $data); } } public function delete_projects($id) { $this->db->delete('projects', ['id' => $id]); redirect('Firm/projects', 'refresh'); } public function specialist_view() { $this->load->library('session'); if (!$this->session->userdata('user')) { redirect('login', 'refresh'); } else { $this->load->view('services/default/header'); $this->load->view('services/services'); $this->load->view('services/default/footer'); } } public function project_details() { $this->load->library('session'); if (!$this->session->userdata('user')) { redirect('login', 'refresh'); } else { $this->load->view('services/default/header'); $this->load->view('services/services'); $this->load->view('services/default/footer'); } } public function add_specialist($id) { $this->load->library('session'); if (!$this->session->userdata('user')) { redirect('login', 'refresh'); } else { $data['project'] = $this->Projects_Details->get_id($id); $this->load->view('firm/projects/header-nav'); $this->load->view('default/sidebar/firm/projects/sidebar-menu'); $this->load->view('firm/add_specialist', $data); } } public function firm_projects() { $this->load->library('session'); if (!$this->session->userdata('user')) { redirect('login', 'refresh'); } else { $this->load->view('firm/projects/header-nav'); $this->load->view('default/sidebar/firm/view-project-details/sidebar-menu'); $this->load->view('firm/projects/project_details_view'); } } public function firm_editprojects($id) { $this->load->library('session'); if (!$this->session->userdata('user')) { redirect('login', 'refresh'); } else { $data['project'] = $this->Projects_Details->get_id_pd($id); $this->load->view('firm/projects/header-nav'); $this->load->view('default/sidebar/firm/view-project-details/sidebar-menu'); $this->load->view('firm/projects/project_details_edit', $data); } } public function firm_showprojects($id) { $this->load->library('session'); if (!$this->session->userdata('user')) { redirect('login', 'refresh'); } else { $data['project'] = $this->Projects_Details->get_id_pd($id); $this->load->view('firm/projects/header-nav'); $this->load->view('default/sidebar/firm/firm-specialist/sidebar-menu'); $this->load->view('firm/projects/project_details_show', $data); } } public function delete_projects_details($id) { $this->db->delete('projects_details', ['id' => $id]); redirect('Firm/firm_projects', 'refresh'); } public function specialist() { $this->load->library('session'); if (!$this->session->userdata('user')) { redirect('login', 'refresh'); } else { $this->load->view('firm/projects/header-nav'); $this->load->view('default/sidebar/firm/firm-specialist/sidebar-menu'); $this->load->view('firm/firm_specialist/firm_specialist_view'); } } public function edit_specialist($id) { $this->load->library('session'); if (!$this->session->userdata('user')) { redirect('login', 'refresh'); } else { $data['user'] = $this->Users->get_id($id); $this->load->view('firm/projects/header-nav'); $this->load->view('default/sidebar/firm/firm-specialist/sidebar-menu'); $this->load->view('firm/firm_specialist/firm_edit-specialist_view', $data); } } public function show_specialist($id) { $this->load->library('session'); if (!$this->session->userdata('user')) { redirect('login', 'refresh'); } else { $data['user'] = $this->Users->get_id($id); $this->load->view('firm/projects/header-nav'); $this->load->view('default/sidebar/firm/firm-specialist/sidebar-menu'); $this->load->view('firm/firm_specialist/firm_show-specialist_view', $data); } } public function update_specialist($id) { $data = array( 'first_name' => $this->input->post('first_name'), 'last_name' => $this->input->post('last_name'), 'registered_address' => $this->input->post('registered_address'), 'city' => $this->input->post('city'), 'contact_number' => $this->input->post('contact_number'), 'email' => $this->input->post('email'), ); $this->db->where('id', $id); $this->db->update('users', $data); $this->session->set_flashdata('success', 'User Details Updated Successfully.'); redirect('Firm/specialist', 'refresh'); } public function delete_specialist($id) { $this->Users->delete_id($id); $this->session->set_flashdata('success', 'User Deleted Successfully.'); redirect('Firm/specialist', 'refresh'); } }
Is there a way to make IntelliSense stop reporting errors even if there are no errors in the code?
You can disable it in the Intelephense extension configuration using the Settings Editor Intelephense > Diagnostics: Undefined property ;
Or put this line into settings.json
This happens because CodeIgniter dynamically injects these properties into the controller at runtime via CI_Loader and because Inteliphense cannot find these properties declared in the code, it reports an unknown property error.