vscode-intelephense
vscode-intelephense copied to clipboard
Incorrect highlighting of errors in the source code.
Describe the bug It highlights errors where there are none; in the previous version 1.9.5, everything worked correctly. In the screenshot, a snippet of code for a project created using CodeIgniter 4 is visible.
To Reproduce Update to version v1.10.0.
Expected behavior Not highlighting errors in the source code where there are none.
Screenshots
Platform and version Manjaro Linux VS Code: 1.84.1 PHP Intelefense: v1.10.0
<?php
class MyObject {
public $arr = [];
}
function getMyObject(): MyObject {
return new MyObject();
}
in_array('foo', getMyObject()->arr);
I tried above code, which should be equivalent to what your code is meant to do and no errors. Are you sure your code is actually working as intended? What is the actual highlighted error?
Here an example, based on the CodeIgniter4 documentation:
PHP Intelefense: v1.10.0
The above source code will execute correctly and display the default value (20), but PHP Intelephense indicates an error.
The same code in PHP Intelefense: 1.9.5:
PHP Intelefense: v1.9.5
I saw that this bug had been reported and hoped to have it fixed in an upcoming update. Unfortunately, it has not been fixed in the version: 1.10.1. Please fix it.
I have the same problem
same issue, nodebody using codeigniter anymore
Please see https://github.com/bmewburn/vscode-intelephense/issues/1063#issuecomment-2199189736 for an example on how you could add a stub function to make the extension return the correct type from the config
call based on the argument passed.