Skip to content

Commit

Permalink
Fix PDO::pgsqlGetNotify() call
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Jan 3, 2022
1 parent 53119f1 commit 3624bbb
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 1 deletion.
14 changes: 14 additions & 0 deletions patches/PDO.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
@package jetbrains/phpstorm-stubs
@version dev-master

--- PDO/PDO.php 2021-12-26 15:44:39.000000000 +0100
+++ PDO/PDO.php 2022-01-03 22:54:21.000000000 +0100
@@ -1415,7 +1415,7 @@
* @return array|false if one or more notifications is pending, returns a single row,
* with fields message and pid, otherwise <b>FALSE</b>.
*/
- public function pgsqlGetNotify(int $fetchMode = PDO::FETCH_DEFAULT, int $timeoutMilliseconds = 0): array|false {}
+ public function pgsqlGetNotify(int $fetchMode = 1, int $timeoutMilliseconds = 0): array|false {}

/**
* (PHP 5 &gt;= 5.6.0, PHP 7, PHP 8)<br/>
2 changes: 1 addition & 1 deletion resources/functionMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -8442,7 +8442,7 @@
'PDO::pgsqlCopyFromFile' => ['bool', 'table_name'=>'string', 'filename'=>'string', 'delimiter'=>'string', 'null_as'=>'string', 'fields'=>'string'],
'PDO::pgsqlCopyToArray' => ['array', 'table_name'=>'string', 'delimiter'=>'string', 'null_as'=>'string', 'fields'=>'string'],
'PDO::pgsqlCopyToFile' => ['bool', 'table_name'=>'string', 'filename'=>'string', 'delimiter'=>'string', 'null_as'=>'string', 'fields'=>'string'],
'PDO::pgsqlGetNotify' => ['array', 'result_type'=>'int', 'ms_timeout'=>'int'],
'PDO::pgsqlGetNotify' => ['array', 'result_type='=>'int', 'ms_timeout='=>'int'],
'PDO::pgsqlGetPid' => ['int'],
'PDO::pgsqlLOBCreate' => ['string'],
'PDO::pgsqlLOBOpen' => ['resource', 'oid'=>'string', 'mode='=>'string'],
Expand Down
6 changes: 6 additions & 0 deletions tests/PHPStan/Analyser/AnalyserIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,12 @@ public function testEnums(): void
$this->assertSame(79, $errors[2]->getLine());
}

public function testBug6255(): void
{
$errors = $this->runAnalyse(__DIR__ . '/data/bug-6255.php');
$this->assertNoErrors($errors);
}

/**
* @return Error[]
*/
Expand Down
6 changes: 6 additions & 0 deletions tests/PHPStan/Analyser/data/bug-6255.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php

namespace Bug6255;

$pdo = new \PDO('');
$pdo->pgsqlGetNotify(\PDO::FETCH_ASSOC);

0 comments on commit 3624bbb

Please sign in to comment.