mirror of
https://github.com/danog/psalm.git
synced 2024-11-27 04:45:20 +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:
parent
b6a3282589
commit
d393b4a69d
@ -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
10
stubs/pdo.php
Normal file
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
class PdoStatement {
|
||||
/**
|
||||
* @template T
|
||||
* @param class-string<T> $class
|
||||
* @return false|T
|
||||
*/
|
||||
public function fetchObject($class = "stdclass") {}
|
||||
}
|
Loading…
Reference in New Issue
Block a user