mirror of
https://github.com/danog/psalm.git
synced 2024-11-26 20:34:47 +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
005373bbc2
commit
4206a4f59e
@ -1822,6 +1822,16 @@ class Config
|
|||||||
$core_generic_files[] = $stringable_path;
|
$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')) {
|
if (\extension_loaded('ds')) {
|
||||||
$ext_ds_path = dirname(__DIR__, 2) . '/stubs/ext-ds.php';
|
$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';
|
$xdebug_stub_path = dirname(__DIR__, 2) . '/stubs/Xdebug.php';
|
||||||
|
|
||||||
if (!file_exists($xdebug_stub_path)) {
|
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;
|
$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