Skip to content

PHP 8.1 pg_query() stubs issue #7138

@zbenc

Description

@zbenc

Bug report

PHPStan (1.6.2) incorrectly reports errors for pg_query() for PHP 8.1:

It does not seam to be aware that pg_query() expects a PgSql\Connection object as the first parameter and returns a PgSql\Result object as of PHP 8.1. I have checked the PHP 8 stubs at https://github.com/phpstan/php-8-stubs/blob/main/stubs/ext/pgsql/pg_query.php but cannot spot an issue there as those signatures include the correct PHP 8.1 derivative.

Code snippet that reproduces the problem

function test(): \PgSql\Result|false {
  return \pg_query(\pg_connect(''), '');
}

https://phpstan.org/r/e6aba2b0-e06c-4e46-835a-a1b1fbe294d3

Expected output

No error messages

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions