mirror of
https://github.com/danog/psalm.git
synced 2025-01-21 21:31:13 +01:00
Use better return type for SimpleXMLElement::offsetGet
This commit is contained in:
parent
38cccb8aaf
commit
6e8088776d
@ -962,7 +962,7 @@ class Config
|
||||
$plugin_config = $plugin->children();
|
||||
}
|
||||
|
||||
$config->addPluginClass($plugin_class_name, $plugin_config);
|
||||
$config->addPluginClass((string) $plugin_class_name, $plugin_config);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1111,7 +1111,7 @@ class ArrayFetchAnalyzer
|
||||
|
||||
if ($type instanceof TNamedObject) {
|
||||
if (strtolower($type->value) === 'simplexmlelement') {
|
||||
$array_access_type = Type::getMixed();
|
||||
$array_access_type = new Type\Union([new TNamedObject('SimpleXMLElement')]);
|
||||
} elseif (strtolower($type->value) === 'domnodelist' && $stmt->dim) {
|
||||
$old_data_provider = $statements_analyzer->node_data;
|
||||
|
||||
|
@ -895,6 +895,12 @@ class ArrayAccessTest extends TestCase
|
||||
}
|
||||
}'
|
||||
],
|
||||
'simpleXmlArrayFetch' => [
|
||||
'<?php
|
||||
function foo(SimpleXMLElement $s) : SimpleXMLElement {
|
||||
return $s["a"];
|
||||
}',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user