This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
I was writing a function in a class. NetBeans IDE code completion was not recognizing a query result variable. In procedural style mysqli NetBeans had no problem with this. The class is a singleton that extends mysqli. The function is public function get_wisher_id_by_name($name) { $name = $this->real_escape_string($name); $result = $this->query("SELECT id FROM wishers WHERE name = '" . $name . "'"); if ($result->num_rows > 0) return $result->data_seek(0); else return null; $result->free; } The problem is with the $result variable. I started to type $res but nothing showed in cc, not even when I hit ctrl-shift. (See attached screenshot, variable-cc-failure) When I typed in $result-> manually, again no code completion for the mysqli_result::x functions. (See attached screenshot, function-cc-failure) The manually-entered code runs without problem.
Created attachment 104729 [details] Screenshot showing cc failure for result variable
Created attachment 104730 [details] Screenshot showing cc failure to show functions for result variable
mysqli::query() returns mixed type, it returns MySQLi_Result only in a specific case (only for SELECT, SHOW, DESCRIBE or EXPLAIN query), so it's expected behaviour and not a defect...imho it's P4/Enhancement.
It's for version 8.0.2, but should be valid for 7.0 as well. Changing "query" method return type from "mixed" to "mysqli_result" (or "bool|mysqli_result") in /phpstubs/phpruntime/mysqli.php helps intelisense to generate autocomplete.
Above workaround worked for me for version 8.2. Line 588 was the one that needed to be edited.