updated-packages
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
@@ -16,10 +17,12 @@ use Symfony\Component\VarDumper\Cloner\Stub;
|
||||
* Casts XmlReader class to array representation.
|
||||
*
|
||||
* @author Baptiste Clavié <clavie.b@gmail.com>
|
||||
*
|
||||
* @final since Symfony 4.4
|
||||
*/
|
||||
class XmlReaderCaster
|
||||
{
|
||||
private static $nodeTypes = array(
|
||||
private const NODE_TYPES = [
|
||||
\XMLReader::NONE => 'NONE',
|
||||
\XMLReader::ELEMENT => 'ELEMENT',
|
||||
\XMLReader::ATTRIBUTE => 'ATTRIBUTE',
|
||||
@@ -38,15 +41,31 @@ class XmlReaderCaster
|
||||
\XMLReader::END_ELEMENT => 'END_ELEMENT',
|
||||
\XMLReader::END_ENTITY => 'END_ENTITY',
|
||||
\XMLReader::XML_DECLARATION => 'XML_DECLARATION',
|
||||
);
|
||||
];
|
||||
|
||||
public static function castXmlReader(\XMLReader $reader, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
try {
|
||||
$properties = [
|
||||
'LOADDTD' => @$reader->getParserProperty(\XMLReader::LOADDTD),
|
||||
'DEFAULTATTRS' => @$reader->getParserProperty(\XMLReader::DEFAULTATTRS),
|
||||
'VALIDATE' => @$reader->getParserProperty(\XMLReader::VALIDATE),
|
||||
'SUBST_ENTITIES' => @$reader->getParserProperty(\XMLReader::SUBST_ENTITIES),
|
||||
];
|
||||
} catch (\Error $e) {
|
||||
$properties = [
|
||||
'LOADDTD' => false,
|
||||
'DEFAULTATTRS' => false,
|
||||
'VALIDATE' => false,
|
||||
'SUBST_ENTITIES' => false,
|
||||
];
|
||||
}
|
||||
|
||||
$props = Caster::PREFIX_VIRTUAL.'parserProperties';
|
||||
$info = array(
|
||||
$info = [
|
||||
'localName' => $reader->localName,
|
||||
'prefix' => $reader->prefix,
|
||||
'nodeType' => new ConstStub(self::$nodeTypes[$reader->nodeType], $reader->nodeType),
|
||||
'nodeType' => new ConstStub(self::NODE_TYPES[$reader->nodeType], $reader->nodeType),
|
||||
'depth' => $reader->depth,
|
||||
'isDefault' => $reader->isDefault,
|
||||
'isEmptyElement' => \XMLReader::NONE === $reader->nodeType ? null : $reader->isEmptyElement,
|
||||
@@ -55,20 +74,15 @@ class XmlReaderCaster
|
||||
'value' => $reader->value,
|
||||
'namespaceURI' => $reader->namespaceURI,
|
||||
'baseURI' => $reader->baseURI ? new LinkStub($reader->baseURI) : $reader->baseURI,
|
||||
$props => array(
|
||||
'LOADDTD' => $reader->getParserProperty(\XMLReader::LOADDTD),
|
||||
'DEFAULTATTRS' => $reader->getParserProperty(\XMLReader::DEFAULTATTRS),
|
||||
'VALIDATE' => $reader->getParserProperty(\XMLReader::VALIDATE),
|
||||
'SUBST_ENTITIES' => $reader->getParserProperty(\XMLReader::SUBST_ENTITIES),
|
||||
),
|
||||
);
|
||||
$props => $properties,
|
||||
];
|
||||
|
||||
if ($info[$props] = Caster::filter($info[$props], Caster::EXCLUDE_EMPTY, array(), $count)) {
|
||||
if ($info[$props] = Caster::filter($info[$props], Caster::EXCLUDE_EMPTY, [], $count)) {
|
||||
$info[$props] = new EnumStub($info[$props]);
|
||||
$info[$props]->cut = $count;
|
||||
}
|
||||
|
||||
$info = Caster::filter($info, Caster::EXCLUDE_EMPTY, array(), $count);
|
||||
$info = Caster::filter($info, Caster::EXCLUDE_EMPTY, [], $count);
|
||||
// +2 because hasValue and hasAttributes are always filtered
|
||||
$stub->cut += $count + 2;
|
||||
|
||||
|
Reference in New Issue
Block a user