aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/sabre/xml/lib
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/sabre/xml/lib')
-rw-r--r--vendor/sabre/xml/lib/Deserializer/functions.php11
-rw-r--r--vendor/sabre/xml/lib/Element/Base.php4
-rw-r--r--vendor/sabre/xml/lib/Element/Elements.php2
-rw-r--r--vendor/sabre/xml/lib/Element/KeyValue.php2
-rw-r--r--vendor/sabre/xml/lib/Element/Uri.php2
-rw-r--r--vendor/sabre/xml/lib/Element/XmlFragment.php2
-rw-r--r--vendor/sabre/xml/lib/LibXMLException.php6
-rw-r--r--vendor/sabre/xml/lib/ParseException.php2
-rw-r--r--vendor/sabre/xml/lib/Reader.php8
-rw-r--r--vendor/sabre/xml/lib/Serializer/functions.php7
-rw-r--r--vendor/sabre/xml/lib/Service.php38
-rw-r--r--vendor/sabre/xml/lib/Version.php2
-rw-r--r--vendor/sabre/xml/lib/Writer.php6
-rw-r--r--vendor/sabre/xml/lib/XmlDeserializable.php2
14 files changed, 45 insertions, 49 deletions
diff --git a/vendor/sabre/xml/lib/Deserializer/functions.php b/vendor/sabre/xml/lib/Deserializer/functions.php
index c4f240970..50818098b 100644
--- a/vendor/sabre/xml/lib/Deserializer/functions.php
+++ b/vendor/sabre/xml/lib/Deserializer/functions.php
@@ -55,7 +55,7 @@ use Sabre\Xml\Reader;
* Attributes will be removed from the top-level elements. If elements with
* the same name appear twice in the list, only the last one will be kept.
*/
-function keyValue(Reader $reader, string $namespace = null): array
+function keyValue(Reader $reader, ?string $namespace = null): array
{
// If there's no children, we don't do anything.
if ($reader->isEmptyElement) {
@@ -144,7 +144,7 @@ function keyValue(Reader $reader, string $namespace = null): array
*
* @return string[]
*/
-function enum(Reader $reader, string $namespace = null): array
+function enum(Reader $reader, ?string $namespace = null): array
{
// If there's no children, we don't do anything.
if ($reader->isEmptyElement) {
@@ -215,8 +215,11 @@ function valueObject(Reader $reader, string $className, string $namespace)
// Ignore property
$reader->next();
}
+ } elseif (Reader::ELEMENT === $reader->nodeType) {
+ // Skipping element from different namespace
+ $reader->next();
} else {
- if (!$reader->read()) {
+ if (Reader::END_ELEMENT !== $reader->nodeType && !$reader->read()) {
break;
}
}
@@ -322,8 +325,6 @@ function mixedContent(Reader $reader): array
*
* You can use, e.g., a named constructor (factory method) to create an object using
* this function.
- *
- * @return mixed
*/
function functionCaller(Reader $reader, callable $func, string $namespace)
{
diff --git a/vendor/sabre/xml/lib/Element/Base.php b/vendor/sabre/xml/lib/Element/Base.php
index 8a93191b1..02fd76966 100644
--- a/vendor/sabre/xml/lib/Element/Base.php
+++ b/vendor/sabre/xml/lib/Element/Base.php
@@ -21,8 +21,6 @@ class Base implements Xml\Element
{
/**
* PHP value to serialize.
- *
- * @var mixed
*/
protected $value;
@@ -72,8 +70,6 @@ class Base implements Xml\Element
*
* $reader->parseInnerTree() will parse the entire sub-tree, and advance to
* the next element.
- *
- * @return mixed
*/
public static function xmlDeserialize(Xml\Reader $reader)
{
diff --git a/vendor/sabre/xml/lib/Element/Elements.php b/vendor/sabre/xml/lib/Element/Elements.php
index fecce4c75..6915fd462 100644
--- a/vendor/sabre/xml/lib/Element/Elements.php
+++ b/vendor/sabre/xml/lib/Element/Elements.php
@@ -90,8 +90,6 @@ class Elements implements Xml\Element
*
* $reader->parseSubTree() will parse the entire sub-tree, and advance to
* the next element.
- *
- * @return mixed
*/
public static function xmlDeserialize(Xml\Reader $reader)
{
diff --git a/vendor/sabre/xml/lib/Element/KeyValue.php b/vendor/sabre/xml/lib/Element/KeyValue.php
index 17448880d..7d75a3ac8 100644
--- a/vendor/sabre/xml/lib/Element/KeyValue.php
+++ b/vendor/sabre/xml/lib/Element/KeyValue.php
@@ -90,8 +90,6 @@ class KeyValue implements Xml\Element
*
* $reader->parseInnerTree() will parse the entire sub-tree, and advance to
* the next element.
- *
- * @return mixed
*/
public static function xmlDeserialize(Xml\Reader $reader)
{
diff --git a/vendor/sabre/xml/lib/Element/Uri.php b/vendor/sabre/xml/lib/Element/Uri.php
index 336212a53..65276380e 100644
--- a/vendor/sabre/xml/lib/Element/Uri.php
+++ b/vendor/sabre/xml/lib/Element/Uri.php
@@ -84,8 +84,6 @@ class Uri implements Xml\Element
*
* $reader->parseSubTree() will parse the entire sub-tree, and advance to
* the next element.
- *
- * @return mixed
*/
public static function xmlDeserialize(Xml\Reader $reader)
{
diff --git a/vendor/sabre/xml/lib/Element/XmlFragment.php b/vendor/sabre/xml/lib/Element/XmlFragment.php
index bf110eaee..99d1f87f9 100644
--- a/vendor/sabre/xml/lib/Element/XmlFragment.php
+++ b/vendor/sabre/xml/lib/Element/XmlFragment.php
@@ -135,8 +135,6 @@ XML;
*
* $reader->parseInnerTree() will parse the entire sub-tree, and advance to
* the next element.
- *
- * @return mixed
*/
public static function xmlDeserialize(Reader $reader)
{
diff --git a/vendor/sabre/xml/lib/LibXMLException.php b/vendor/sabre/xml/lib/LibXMLException.php
index fb074f97d..993f95fd9 100644
--- a/vendor/sabre/xml/lib/LibXMLException.php
+++ b/vendor/sabre/xml/lib/LibXMLException.php
@@ -5,7 +5,6 @@ declare(strict_types=1);
namespace Sabre\Xml;
use LibXMLError;
-use Throwable;
/**
* This exception is thrown when the Reader runs into a parsing error.
@@ -30,10 +29,9 @@ class LibXMLException extends ParseException
*
* You should pass a list of LibXMLError objects in its constructor.
*
- * @param LibXMLError[] $errors
- * @param Throwable $previousException
+ * @param \LibXMLError[] $errors
*/
- public function __construct(array $errors, int $code = 0, Throwable $previousException = null)
+ public function __construct(array $errors, int $code = 0, ?\Throwable $previousException = null)
{
$this->errors = $errors;
parent::__construct($errors[0]->message.' on line '.$errors[0]->line.', column '.$errors[0]->column, $code, $previousException);
diff --git a/vendor/sabre/xml/lib/ParseException.php b/vendor/sabre/xml/lib/ParseException.php
index e237b8732..158cf0119 100644
--- a/vendor/sabre/xml/lib/ParseException.php
+++ b/vendor/sabre/xml/lib/ParseException.php
@@ -13,6 +13,6 @@ use Exception;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class ParseException extends Exception
+class ParseException extends \Exception
{
}
diff --git a/vendor/sabre/xml/lib/Reader.php b/vendor/sabre/xml/lib/Reader.php
index 7871a74f5..f680bf4cd 100644
--- a/vendor/sabre/xml/lib/Reader.php
+++ b/vendor/sabre/xml/lib/Reader.php
@@ -19,7 +19,7 @@ use XMLReader;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class Reader extends XMLReader
+class Reader extends \XMLReader
{
use ContextStackTrait;
@@ -103,7 +103,7 @@ class Reader extends XMLReader
* If the $elementMap argument is specified, the existing elementMap will
* be overridden while parsing the tree, and restored after this process.
*/
- public function parseGetElements(array $elementMap = null): array
+ public function parseGetElements(?array $elementMap = null): array
{
$result = $this->parseInnerTree($elementMap);
if (!is_array($result)) {
@@ -126,7 +126,7 @@ class Reader extends XMLReader
*
* @return array|string|null
*/
- public function parseInnerTree(array $elementMap = null)
+ public function parseInnerTree(?array $elementMap = null)
{
$text = null;
$elements = [];
@@ -205,7 +205,7 @@ class Reader extends XMLReader
$previousDepth = $this->depth;
while ($this->read() && $this->depth != $previousDepth) {
- if (in_array($this->nodeType, [XMLReader::TEXT, XMLReader::CDATA, XMLReader::WHITESPACE])) {
+ if (in_array($this->nodeType, [\XMLReader::TEXT, \XMLReader::CDATA, \XMLReader::WHITESPACE])) {
$result .= $this->value;
}
}
diff --git a/vendor/sabre/xml/lib/Serializer/functions.php b/vendor/sabre/xml/lib/Serializer/functions.php
index 8d0330558..23f22d4c8 100644
--- a/vendor/sabre/xml/lib/Serializer/functions.php
+++ b/vendor/sabre/xml/lib/Serializer/functions.php
@@ -4,7 +4,6 @@ declare(strict_types=1);
namespace Sabre\Xml\Serializer;
-use InvalidArgumentException;
use Sabre\Xml\Writer;
use Sabre\Xml\XmlSerializable;
@@ -197,12 +196,12 @@ function standardSerializer(Writer $writer, $value)
$writer->write($item);
$writer->endElement();
} else {
- throw new InvalidArgumentException('The writer does not know how to serialize arrays with keys of type: '.gettype($name));
+ throw new \InvalidArgumentException('The writer does not know how to serialize arrays with keys of type: '.gettype($name));
}
}
} elseif (is_object($value)) {
- throw new InvalidArgumentException('The writer cannot serialize objects of class: '.get_class($value));
+ throw new \InvalidArgumentException('The writer cannot serialize objects of class: '.get_class($value));
} elseif (!is_null($value)) {
- throw new InvalidArgumentException('The writer cannot serialize values of type: '.gettype($value));
+ throw new \InvalidArgumentException('The writer cannot serialize values of type: '.gettype($value));
}
}
diff --git a/vendor/sabre/xml/lib/Service.php b/vendor/sabre/xml/lib/Service.php
index a8e34d254..6e522630e 100644
--- a/vendor/sabre/xml/lib/Service.php
+++ b/vendor/sabre/xml/lib/Service.php
@@ -105,16 +105,23 @@ class Service
*
* @param string|resource $input
*
- * @throws ParseException
- *
* @return array|object|string
+ *
+ * @throws ParseException
*/
- public function parse($input, string $contextUri = null, string &$rootElementName = null)
+ public function parse($input, ?string $contextUri = null, ?string &$rootElementName = null)
{
- if (is_resource($input)) {
+ if (!is_string($input)) {
// Unfortunately the XMLReader doesn't support streams. When it
// does, we can optimize this.
- $input = (string) stream_get_contents($input);
+ if (is_resource($input)) {
+ $input = (string) stream_get_contents($input);
+ } else {
+ // Input is not a string and not a resource.
+ // Therefore, it has to be a closed resource.
+ // Effectively empty input has been passed in.
+ $input = '';
+ }
}
// If input is empty, then it's safe to throw an exception
@@ -149,16 +156,23 @@ class Service
* @param string|string[] $rootElementName
* @param string|resource $input
*
- * @throws ParseException
- *
* @return array|object|string
+ *
+ * @throws ParseException
*/
- public function expect($rootElementName, $input, string $contextUri = null)
+ public function expect($rootElementName, $input, ?string $contextUri = null)
{
- if (is_resource($input)) {
+ if (!is_string($input)) {
// Unfortunately the XMLReader doesn't support streams. When it
// does, we can optimize this.
- $input = (string) stream_get_contents($input);
+ if (is_resource($input)) {
+ $input = (string) stream_get_contents($input);
+ } else {
+ // Input is not a string and not a resource.
+ // Therefore, it has to be a closed resource.
+ // Effectively empty input has been passed in.
+ $input = '';
+ }
}
// If input is empty, then it's safe to throw an exception
@@ -204,7 +218,7 @@ class Service
*
* @return string
*/
- public function write(string $rootElementName, $value, string $contextUri = null)
+ public function write(string $rootElementName, $value, ?string $contextUri = null)
{
$w = $this->getWriter();
$w->openMemory();
@@ -266,7 +280,7 @@ class Service
*
* @throws \InvalidArgumentException
*/
- public function writeValueObject($object, string $contextUri = null)
+ public function writeValueObject($object, ?string $contextUri = null)
{
if (!isset($this->valueObjectMap[get_class($object)])) {
throw new \InvalidArgumentException('"'.get_class($object).'" is not a registered value object class. Register your class with mapValueObject.');
diff --git a/vendor/sabre/xml/lib/Version.php b/vendor/sabre/xml/lib/Version.php
index 1144bf085..c2da842ec 100644
--- a/vendor/sabre/xml/lib/Version.php
+++ b/vendor/sabre/xml/lib/Version.php
@@ -16,5 +16,5 @@ class Version
/**
* Full version number.
*/
- const VERSION = '2.2.5';
+ public const VERSION = '2.2.11';
}
diff --git a/vendor/sabre/xml/lib/Writer.php b/vendor/sabre/xml/lib/Writer.php
index e3238a7ed..76989612e 100644
--- a/vendor/sabre/xml/lib/Writer.php
+++ b/vendor/sabre/xml/lib/Writer.php
@@ -30,7 +30,7 @@ use XMLWriter;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class Writer extends XMLWriter
+class Writer extends \XMLWriter
{
use ContextStackTrait;
@@ -93,8 +93,6 @@ class Writer extends XMLWriter
* ]
* ]
* ]
- *
- * @param mixed $value
*/
public function write($value)
{
@@ -151,7 +149,7 @@ class Writer extends XMLWriter
if (!$this->namespacesWritten) {
foreach ($this->namespaceMap as $namespace => $prefix) {
- $this->writeAttribute(($prefix ? 'xmlns:'.$prefix : 'xmlns'), $namespace);
+ $this->writeAttribute($prefix ? 'xmlns:'.$prefix : 'xmlns', $namespace);
}
$this->namespacesWritten = true;
}
diff --git a/vendor/sabre/xml/lib/XmlDeserializable.php b/vendor/sabre/xml/lib/XmlDeserializable.php
index 83f33db1e..0a5720334 100644
--- a/vendor/sabre/xml/lib/XmlDeserializable.php
+++ b/vendor/sabre/xml/lib/XmlDeserializable.php
@@ -31,8 +31,6 @@ interface XmlDeserializable
*
* $reader->parseInnerTree() will parse the entire sub-tree, and advance to
* the next element.
- *
- * @return mixed
*/
public static function xmlDeserialize(Reader $reader);
}