Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VSCode PHP Intelephense show error when using Memcached

I'm using Memcached in code, it shows this:

error: "Undefined type 'Memcached'."

How to disable this error? Version using: VScode 1.41 PHP Intelephense 1.3.5

enter image description here

enter image description here

like image 740
hieupct98 Avatar asked Dec 17 '19 03:12

hieupct98


3 Answers

You can disable the undefined type in intelephense vscode setting. To open the setting you can type ctrl + ,

enter image description here

like image 167
Adrian Edy Pratama Avatar answered Sep 30 '22 19:09

Adrian Edy Pratama


You can add the Memcached to intelephense.stubs setting.

Reference: Undefined type Memcached

VS Code: 1.52.1

PHP Intelephense: 1.5.4

like image 24
MocXi Avatar answered Sep 30 '22 18:09

MocXi


If your code is working, simply try and restart your ide, it should work. seems to be a bug , especially caused if you move files around directly in the file system. Otherwise correct your code then.

NB: The other solutions above may work but are hacks. They may be temporal fixes and lead to unwanted effects. Don't alter any IDE settings you do not understand or remember to reconfigure later, it can be such a pain to maintain your environment.

like image 42
whizboy Avatar answered Sep 30 '22 18:09

whizboy