vscode-intelephense icon indicating copy to clipboard operation
vscode-intelephense copied to clipboard

Undefined pgsql types

Open michakt opened this issue 3 years ago • 1 comments

Describe the bug Intelephense does not know the types of pgsql. It throws an undefined type (1009) error message when I am using pgsql types.

Note: I added pgsql to the Intelephense: Stubs list in the extension settings of intelephense.

To Reproduce I came across this when I wanted to create a simple class interface for my PG database. For reproducibility it is enough to declare a variable that has a type of pgsql. For example this line is causing the error:

public \PgSql\Connection|false $connection;

According to the documentation, pg_connect returns the type PgSql\Connection|false. https://www.php.net/manual/en/function.pg-connect.php

Expected behavior Intelephense should know pgsql types so that I can benefit from the autocomplete in my IDE, for example.

Screenshots pg1 pg2

Platform and version Win10, PHP 8.1.2, Intelephense 1.8.2, Visual Studio Code

michakt avatar Mar 08 '22 16:03 michakt

I ran into this also. Can you please add the PgSql types for postgres? Thank you.

rob4226 avatar Sep 20 '22 04:09 rob4226

Unable to repro in 1.10 . Adding pgsql to stubs and setting intelephense.environment.phpVersion to 8.1.0 or greater makes \PgSql\Connection in my tests.

bmewburn avatar Apr 11 '24 22:04 bmewburn