mirror of
https://github.com/danog/psalm.git
synced 2024-11-30 04:39:00 +01:00
Don’t error on existing Psalm configs cc @ostrolucky
This commit is contained in:
parent
2295756793
commit
da69e60cf3
@ -1,9 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<xs:schema
|
<xs:schema
|
||||||
xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||||
xmlns="https://getpsalm.org/schema/config"
|
xmlns="https://getpsalm.org/schema/config"
|
||||||
targetNamespace="https://getpsalm.org/schema/config"
|
targetNamespace="https://getpsalm.org/schema/config"
|
||||||
elementFormDefault="qualified"
|
elementFormDefault="qualified"
|
||||||
>
|
>
|
||||||
<xs:element name="psalm" type="PsalmType" />
|
<xs:element name="psalm" type="PsalmType" />
|
||||||
|
|
||||||
|
@ -7,7 +7,8 @@
|
|||||||
rememberPropertyAssignmentsAfterCall="true"
|
rememberPropertyAssignmentsAfterCall="true"
|
||||||
throwExceptionOnError="0"
|
throwExceptionOnError="0"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="config.xsd"
|
xmlns="https://getpsalm.org/schema/config"
|
||||||
|
xsi:schemaLocation="https://getpsalm.org/schema/config config.xsd"
|
||||||
>
|
>
|
||||||
<projectFiles>
|
<projectFiles>
|
||||||
<directory name="src" />
|
<directory name="src" />
|
||||||
|
@ -362,6 +362,25 @@ class Config
|
|||||||
$dom_document = new \DOMDocument();
|
$dom_document = new \DOMDocument();
|
||||||
$dom_document->loadXML($file_contents);
|
$dom_document->loadXML($file_contents);
|
||||||
|
|
||||||
|
$psalm_nodes = $dom_document->getElementsByTagName('psalm');
|
||||||
|
|
||||||
|
/** @var \DomElement|null */
|
||||||
|
$psalm_node = $psalm_nodes->item(0);
|
||||||
|
|
||||||
|
if (!$psalm_node) {
|
||||||
|
throw new ConfigException(
|
||||||
|
'Missing psalm node'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$psalm_node->hasAttribute('xmlns')) {
|
||||||
|
$psalm_node->setAttribute('xmlns', 'https://getpsalm.org/schema/config');
|
||||||
|
|
||||||
|
$old_dom_document = $dom_document;
|
||||||
|
$dom_document = new \DOMDocument();
|
||||||
|
$dom_document->loadXML($old_dom_document->saveXml());
|
||||||
|
}
|
||||||
|
|
||||||
// Enable user error handling
|
// Enable user error handling
|
||||||
libxml_use_internal_errors(true);
|
libxml_use_internal_errors(true);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user