phpintellisensevscode-extensionsphp-extensionclassname

Undefined type 'gnupg' class name error using VS Code with PHP and Intelephense extension


Screen shot of the error in VS Code:

VS Code Undefined Type Class Name

Even with checking phpinfo() you will see gnupg installed and an active extension. The code will execute properly. But in VS Code you are given a fatal error and red underline when calling the class. A class that is supposed to be globally available.

I would like to correctly fix the problem and not just hide or ignore the red underline. Could not find a direct solution by searching the settings for anything related to "undefined type". Only the option to ignore "undefined type" error all together (not an option for me)

enter image description here


Solution

  • I've found the proper solution scattered under various titles that tend to be too specific in request. Here I answer the question in a way that allows all languages being coded under VS Code to have easy access to a common error.

    Location of the settings: