I am using php and sql in Intellij, and I have about 30 warnings mostly pertaining to my functions that correspond to PDO object calls not being found. I do not understand why I am getting the warning: "Referenced method is not found in subject class".
It says that the method is not found in the subject class, which is understandable since the constructor needs to be called for the variable to be declared. It just seems that the intellij interpreter does not realize that the constructor declares this.
I do have an sql dialect set up and working, and a data source. These eliminated several warnings.
For example:
public $conn;
function __construct(){
try {
global $conn;
$conn = new PDO($dsn, $username, $password);
//echo "Test";
}
}
function project_load(){
global $conn;
try {
$sth = $conn->prepare("SELECT `id`, `FROM projects");
}
}
For example the prepare statement is highlighted with the warning. This code works perfectly, but the warnings are annoying and may cause issues in the future. Should I go and manually suppress them or are they solvable? Is this an issue with how intellij settings are set or is there an actual way to code this to avoid these warnings? Is it possible that this is a language issue? I believe Java handles this far better since it is natively object oriented.