Skip to content

Commit 3624bbb

Browse files
committed
Fix PDO::pgsqlGetNotify() call
1 parent 53119f1 commit 3624bbb

File tree

4 files changed

+27
-1
lines changed

4 files changed

+27
-1
lines changed

patches/PDO.patch

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
@package jetbrains/phpstorm-stubs
2+
@version dev-master
3+
4+
--- PDO/PDO.php 2021-12-26 15:44:39.000000000 +0100
5+
+++ PDO/PDO.php 2022-01-03 22:54:21.000000000 +0100
6+
@@ -1415,7 +1415,7 @@
7+
* @return array|false if one or more notifications is pending, returns a single row,
8+
* with fields message and pid, otherwise <b>FALSE</b>.
9+
*/
10+
- public function pgsqlGetNotify(int $fetchMode = PDO::FETCH_DEFAULT, int $timeoutMilliseconds = 0): array|false {}
11+
+ public function pgsqlGetNotify(int $fetchMode = 1, int $timeoutMilliseconds = 0): array|false {}
12+
13+
/**
14+
* (PHP 5 &gt;= 5.6.0, PHP 7, PHP 8)<br/>

resources/functionMap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8442,7 +8442,7 @@
84428442
'PDO::pgsqlCopyFromFile' => ['bool', 'table_name'=>'string', 'filename'=>'string', 'delimiter'=>'string', 'null_as'=>'string', 'fields'=>'string'],
84438443
'PDO::pgsqlCopyToArray' => ['array', 'table_name'=>'string', 'delimiter'=>'string', 'null_as'=>'string', 'fields'=>'string'],
84448444
'PDO::pgsqlCopyToFile' => ['bool', 'table_name'=>'string', 'filename'=>'string', 'delimiter'=>'string', 'null_as'=>'string', 'fields'=>'string'],
8445-
'PDO::pgsqlGetNotify' => ['array', 'result_type'=>'int', 'ms_timeout'=>'int'],
8445+
'PDO::pgsqlGetNotify' => ['array', 'result_type='=>'int', 'ms_timeout='=>'int'],
84468446
'PDO::pgsqlGetPid' => ['int'],
84478447
'PDO::pgsqlLOBCreate' => ['string'],
84488448
'PDO::pgsqlLOBOpen' => ['resource', 'oid'=>'string', 'mode='=>'string'],

tests/PHPStan/Analyser/AnalyserIntegrationTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,12 @@ public function testEnums(): void
483483
$this->assertSame(79, $errors[2]->getLine());
484484
}
485485

486+
public function testBug6255(): void
487+
{
488+
$errors = $this->runAnalyse(__DIR__ . '/data/bug-6255.php');
489+
$this->assertNoErrors($errors);
490+
}
491+
486492
/**
487493
* @return Error[]
488494
*/
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?php
2+
3+
namespace Bug6255;
4+
5+
$pdo = new \PDO('');
6+
$pdo->pgsqlGetNotify(\PDO::FETCH_ASSOC);

0 commit comments

Comments
 (0)