1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00

Added PDOStatement->fetchObject() stub (#4693)

* Added PDOStatement->fetchObject() stub

* fix stub param

* fix Xdebug spelling

* Use extension_loaded check instead

Co-authored-by: Matthew Brown <github@muglug.com>
This commit is contained in:
Markus Staab 2020-11-25 18:08:04 +01:00 committed by Daniil Gentili
parent 005373bbc2
commit 4206a4f59e
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
2 changed files with 21 additions and 1 deletions

View File

@ -1822,6 +1822,16 @@ class Config
$core_generic_files[] = $stringable_path;
}
if (\extension_loaded('PDO')) {
$ext_pdo_path = dirname(__DIR__, 2) . '/stubs/pdo.php';
if (!file_exists($ext_pdo_path)) {
throw new \UnexpectedValueException('Cannot locate pdo classes');
}
$core_generic_files[] = $ext_pdo_path;
}
if (\extension_loaded('ds')) {
$ext_ds_path = dirname(__DIR__, 2) . '/stubs/ext-ds.php';
@ -1838,7 +1848,7 @@ class Config
$xdebug_stub_path = dirname(__DIR__, 2) . '/stubs/Xdebug.php';
if (!file_exists($xdebug_stub_path)) {
throw new \UnexpectedValueException('Cannot locate XDebug stub');
throw new \UnexpectedValueException('Cannot locate Xdebug stub');
}
$stub_files[] = $xdebug_stub_path;

10
stubs/pdo.php Normal file
View File

@ -0,0 +1,10 @@
<?php
class PdoStatement {
/**
* @template T
* @param class-string<T> $class
* @return false|T
*/
public function fetchObject($class = "stdclass") {}
}