diff options
Diffstat (limited to 'vendor/sabre/xml')
-rw-r--r-- | vendor/sabre/xml/.gitignore | 16 | ||||
-rw-r--r-- | vendor/sabre/xml/.php_cs.dist | 2 | ||||
-rw-r--r-- | vendor/sabre/xml/.travis.yml | 27 | ||||
-rw-r--r-- | vendor/sabre/xml/CHANGELOG.md | 12 | ||||
-rw-r--r-- | vendor/sabre/xml/composer.json | 5 | ||||
-rw-r--r-- | vendor/sabre/xml/lib/ContextStackTrait.php | 2 | ||||
-rw-r--r-- | vendor/sabre/xml/lib/Deserializer/functions.php | 43 | ||||
-rw-r--r-- | vendor/sabre/xml/lib/Element/Uri.php | 2 | ||||
-rw-r--r-- | vendor/sabre/xml/lib/Element/XmlFragment.php | 4 | ||||
-rw-r--r-- | vendor/sabre/xml/lib/LibXMLException.php | 5 | ||||
-rw-r--r-- | vendor/sabre/xml/lib/ParseException.php | 3 | ||||
-rw-r--r-- | vendor/sabre/xml/lib/Reader.php | 11 | ||||
-rw-r--r-- | vendor/sabre/xml/lib/Serializer/functions.php | 6 | ||||
-rw-r--r-- | vendor/sabre/xml/lib/Service.php | 20 | ||||
-rw-r--r-- | vendor/sabre/xml/lib/Version.php | 2 | ||||
-rw-r--r-- | vendor/sabre/xml/lib/Writer.php | 2 |
16 files changed, 43 insertions, 119 deletions
diff --git a/vendor/sabre/xml/.gitignore b/vendor/sabre/xml/.gitignore index a85591183..51fc188bf 100644 --- a/vendor/sabre/xml/.gitignore +++ b/vendor/sabre/xml/.gitignore @@ -1,22 +1,10 @@ -# Composer vendor composer.lock - -# Tests tests/cov -tests/.phpunit.result.cache .*.swp +.php_cs.cache # Composer binaries bin/phpunit bin/php-cs-fixer -bin/phpstan -bin/phpstan.phar - -# Vim -.*.swp - -# IDEs -/.idea - -.php_cs.cache +bin/sabre-cs-fixer diff --git a/vendor/sabre/xml/.php_cs.dist b/vendor/sabre/xml/.php_cs.dist index c5c78a971..8d61ee259 100644 --- a/vendor/sabre/xml/.php_cs.dist +++ b/vendor/sabre/xml/.php_cs.dist @@ -6,7 +6,7 @@ $config->getFinder() ->in(__DIR__); $config->setRules([ '@PSR1' => true, - '@Symfony' => true + '@Symfony' =>true ]); return $config;
\ No newline at end of file diff --git a/vendor/sabre/xml/.travis.yml b/vendor/sabre/xml/.travis.yml index 953c2a60b..49a0c9a22 100644 --- a/vendor/sabre/xml/.travis.yml +++ b/vendor/sabre/xml/.travis.yml @@ -1,20 +1,19 @@ language: php sudo: required +dist: xenial php: + - 7.0 - 7.1 - 7.2 - - 7.3 - - 7.4 + - 7.3snapshot -env: - global: - - RUN_PHPSTAN="FALSE" +addons: + apt: + packages: + # required for php7.3 + - libzip4 matrix: - include: - - name: 'PHPStan' - php: 7.2 - env: RUN_PHPSTAN="TRUE" fast_finish: true cache: @@ -22,15 +21,11 @@ cache: - $HOME/.composer/cache install: - - if [ $RUN_PHPSTAN == "TRUE" ]; then composer require --dev phpstan/phpstan:^0.12; fi - -before_script: - composer install script: - - if [ $RUN_PHPSTAN == "FALSE" ]; then ./bin/php-cs-fixer fix --dry-run --diff; fi - - if [ $RUN_PHPSTAN == "FALSE" ]; then ./bin/phpunit --configuration tests/phpunit.xml --coverage-clover=coverage.xml; fi - - if [ $RUN_PHPSTAN == "TRUE" ]; then php ./bin/phpstan analyse -c phpstan.neon lib; fi + - ./bin/phpunit --configuration tests/phpunit.xml.dist --coverage-clover=coverage.xml after_success: - - bash <(curl -s https://codecov.io/bash) +- bash <(curl -s https://codecov.io/bash) + diff --git a/vendor/sabre/xml/CHANGELOG.md b/vendor/sabre/xml/CHANGELOG.md index bbfc8ddec..1ad830124 100644 --- a/vendor/sabre/xml/CHANGELOG.md +++ b/vendor/sabre/xml/CHANGELOG.md @@ -1,28 +1,16 @@ ChangeLog ========= -2.2.0 (2020-01-31) ------------------- - -* #171: Added Support for PHP 7.4, dropped Support for PHP 7.0 (@staabm, @phil-davis) -* #174: Update testsuite to phpunit8 (@phil-davis) -* Added phpstan coverage (@phil-davis) -* #144: Added a new `functionCaller` deserializer function for executing a callable when reading a XML -element (@vsouz4) - - 2.1.3 (2019-08-14) ------------------ * #166: Throw exception when empty inputs found - 2.1.2 (2019-01-09) ------------------ * #161: Prevent infinite loop on empty xml elements - 2.1.1 (2018-10-09) ------------------ diff --git a/vendor/sabre/xml/composer.json b/vendor/sabre/xml/composer.json index 2af0dd458..c782dbc5e 100644 --- a/vendor/sabre/xml/composer.json +++ b/vendor/sabre/xml/composer.json @@ -5,7 +5,7 @@ "homepage" : "https://sabre.io/xml/", "license" : "BSD-3-Clause", "require" : { - "php" : "^7.1", + "php" : ">=7.0", "ext-xmlwriter" : "*", "ext-xmlreader" : "*", "ext-dom" : "*", @@ -44,8 +44,7 @@ } }, "require-dev": { - "friendsofphp/php-cs-fixer": "~2.16.1", - "phpunit/phpunit" : "^7 || ^8" + "phpunit/phpunit" : "^6" }, "config" : { "bin-dir" : "bin/" diff --git a/vendor/sabre/xml/lib/ContextStackTrait.php b/vendor/sabre/xml/lib/ContextStackTrait.php index 757088847..bc770ffad 100644 --- a/vendor/sabre/xml/lib/ContextStackTrait.php +++ b/vendor/sabre/xml/lib/ContextStackTrait.php @@ -45,7 +45,7 @@ trait ContextStackTrait * common use-case for parsing XML documents, it's added here as a * convenience. * - * @var string|null + * @var string */ public $contextUri; diff --git a/vendor/sabre/xml/lib/Deserializer/functions.php b/vendor/sabre/xml/lib/Deserializer/functions.php index c4f240970..0eff4b7e0 100644 --- a/vendor/sabre/xml/lib/Deserializer/functions.php +++ b/vendor/sabre/xml/lib/Deserializer/functions.php @@ -173,7 +173,7 @@ function enum(Reader $reader, string $namespace = null): array if (!is_null($namespace) && $namespace === $reader->namespaceURI) { $values[] = $reader->localName; } else { - $values[] = (string) $reader->getClark(); + $values[] = $reader->getClark(); } } while ($reader->depth >= $currentDepth && $reader->next()); @@ -316,44 +316,3 @@ function mixedContent(Reader $reader): array return $content; } - -/** - * The functionCaller deserializer turns an xml element into whatever your callable return. - * - * 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) -{ - if ($reader->isEmptyElement) { - $reader->next(); - - return null; - } - - $funcArgs = []; - $func = is_string($func) && false !== strpos($func, '::') ? explode('::', $func) : $func; - $ref = is_array($func) ? new \ReflectionMethod($func[0], $func[1]) : new \ReflectionFunction($func); - foreach ($ref->getParameters() as $parameter) { - $funcArgs[$parameter->getName()] = null; - } - - $reader->read(); - do { - if (Reader::ELEMENT === $reader->nodeType && $reader->namespaceURI == $namespace) { - if (array_key_exists($reader->localName, $funcArgs)) { - $funcArgs[$reader->localName] = $reader->parseCurrentElement()['value']; - } else { - // Ignore property - $reader->next(); - } - } else { - $reader->read(); - } - } while (Reader::END_ELEMENT !== $reader->nodeType); - $reader->read(); - - return $func(...array_values($funcArgs)); -} diff --git a/vendor/sabre/xml/lib/Element/Uri.php b/vendor/sabre/xml/lib/Element/Uri.php index 2644fbcd7..898a26457 100644 --- a/vendor/sabre/xml/lib/Element/Uri.php +++ b/vendor/sabre/xml/lib/Element/Uri.php @@ -91,7 +91,7 @@ class Uri implements Xml\Element { return new self( \Sabre\Uri\resolve( - (string) $reader->contextUri, + $reader->contextUri, $reader->readText() ) ); diff --git a/vendor/sabre/xml/lib/Element/XmlFragment.php b/vendor/sabre/xml/lib/Element/XmlFragment.php index 12109e5c9..413e0f106 100644 --- a/vendor/sabre/xml/lib/Element/XmlFragment.php +++ b/vendor/sabre/xml/lib/Element/XmlFragment.php @@ -85,7 +85,7 @@ XML; switch ($reader->nodeType) { case Reader::ELEMENT: $writer->startElement( - (string) $reader->getClark() + $reader->getClark() ); $empty = $reader->isEmptyElement; while ($reader->moveToNextAttribute()) { @@ -97,7 +97,7 @@ XML; // Skip namespace declarations break; default: - $writer->writeAttribute((string) $reader->getClark(), $reader->value); + $writer->writeAttribute($reader->getClark(), $reader->value); break; } } diff --git a/vendor/sabre/xml/lib/LibXMLException.php b/vendor/sabre/xml/lib/LibXMLException.php index ae136f57b..4701c304a 100644 --- a/vendor/sabre/xml/lib/LibXMLException.php +++ b/vendor/sabre/xml/lib/LibXMLException.php @@ -21,7 +21,7 @@ class LibXMLException extends ParseException /** * The error list. * - * @var \LibXMLError[] + * @var []LibXMLError */ protected $errors; @@ -30,7 +30,8 @@ class LibXMLException extends ParseException * * You should pass a list of LibXMLError objects in its constructor. * - * @param LibXMLError[] $errors + * @param []LibXMLError $errors + * @param int $code * @param Throwable $previousException */ public function __construct(array $errors, int $code = 0, Throwable $previousException = null) diff --git a/vendor/sabre/xml/lib/ParseException.php b/vendor/sabre/xml/lib/ParseException.php index 5980b5fc4..e237b8732 100644 --- a/vendor/sabre/xml/lib/ParseException.php +++ b/vendor/sabre/xml/lib/ParseException.php @@ -4,8 +4,7 @@ declare(strict_types=1); namespace Sabre\Xml; -use - Exception; +use Exception; /** * This is a base exception for any exception related to parsing xml files. diff --git a/vendor/sabre/xml/lib/Reader.php b/vendor/sabre/xml/lib/Reader.php index a28cf8c3b..37e0c86dd 100644 --- a/vendor/sabre/xml/lib/Reader.php +++ b/vendor/sabre/xml/lib/Reader.php @@ -118,7 +118,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. * - * @return array|string|null + * @return array|string */ public function parseInnerTree(array $elementMap = null) { @@ -147,9 +147,7 @@ class Reader extends XMLReader throw new ParseException('This should never happen (famous last words)'); } - $keepOnParsing = true; - - while ($keepOnParsing) { + while (true) { if (!$this->isValid()) { $errors = libxml_get_errors(); @@ -171,8 +169,7 @@ class Reader extends XMLReader case self::END_ELEMENT: // Ensuring we are moving the cursor after the end element. $this->read(); - $keepOnParsing = false; - break; + break 2; case self::NONE: throw new ParseException('We hit the end of the document prematurely. This likely means that some parser "eats" too many elements. Do not attempt to continue parsing.'); default: @@ -226,7 +223,7 @@ class Reader extends XMLReader } $value = call_user_func( - $this->getDeserializerForElementName((string) $name), + $this->getDeserializerForElementName($name), $this ); diff --git a/vendor/sabre/xml/lib/Serializer/functions.php b/vendor/sabre/xml/lib/Serializer/functions.php index 8d0330558..3694d9791 100644 --- a/vendor/sabre/xml/lib/Serializer/functions.php +++ b/vendor/sabre/xml/lib/Serializer/functions.php @@ -148,7 +148,7 @@ function repeatingElements(Writer $writer, array $items, string $childElementNam * * You can even mix the two array syntaxes. * - * @param string|int|float|bool|array|object $value + * @param string|int|float|bool|array|object */ function standardSerializer(Writer $writer, $value) { @@ -164,6 +164,8 @@ function standardSerializer(Writer $writer, $value) } elseif (is_callable($value)) { // A callback $value($writer); + } elseif (is_null($value)) { + // nothing! } elseif (is_array($value) && array_key_exists('name', $value)) { // if the array had a 'name' element, we assume that this array // describes a 'name' and optionally 'attributes' and 'value'. @@ -202,7 +204,7 @@ function standardSerializer(Writer $writer, $value) } } elseif (is_object($value)) { throw new InvalidArgumentException('The writer cannot serialize objects of class: '.get_class($value)); - } elseif (!is_null($value)) { + } else { 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 9a2c47794..882b2dc2c 100644 --- a/vendor/sabre/xml/lib/Service.php +++ b/vendor/sabre/xml/lib/Service.php @@ -61,13 +61,6 @@ class Service public $classMap = []; /** - * A bitmask of the LIBXML_* constants. - * - * @var int - */ - public $options = 0; - - /** * Returns a fresh XML Reader. */ public function getReader(): Reader @@ -114,7 +107,7 @@ class Service if (is_resource($input)) { // Unfortunately the XMLReader doesn't support streams. When it // does, we can optimize this. - $input = (string) stream_get_contents($input); + $input = stream_get_contents($input); // If input is an empty string, then its safe to throw exception if ('' === $input) { @@ -123,7 +116,7 @@ class Service } $r = $this->getReader(); $r->contextUri = $contextUri; - $r->XML($input, null, $this->options); + $r->xml($input); $result = $r->parse(); $rootElementName = $result['name']; @@ -147,6 +140,7 @@ class Service * * @param string|string[] $rootElementName * @param string|resource $input + * @param string|null $contextUri * * @throws ParseException * @@ -157,7 +151,7 @@ class Service if (is_resource($input)) { // Unfortunately the XMLReader doesn't support streams. When it // does, we can optimize this. - $input = (string) stream_get_contents($input); + $input = stream_get_contents($input); // If input is empty string, then its safe to throw exception if ('' === $input) { @@ -166,7 +160,7 @@ class Service } $r = $this->getReader(); $r->contextUri = $contextUri; - $r->XML($input, null, $this->options); + $r->xml($input); $rootElementName = (array) $rootElementName; @@ -178,7 +172,7 @@ class Service $result = $r->parse(); if (!in_array($result['name'], $rootElementName, true)) { - throw new ParseException('Expected '.implode(' or ', $rootElementName).' but received '.$result['name'].' as the root element'); + throw new ParseException('Expected '.implode(' or ', (array) $rootElementName).' but received '.$result['name'].' as the root element'); } return $result['value']; @@ -198,7 +192,7 @@ class Service * This allows an implementor to easily create URI's relative to the root * of the domain. * - * @param string|array|object|XmlSerializable $value + * @param string|array|XmlSerializable $value * * @return string */ diff --git a/vendor/sabre/xml/lib/Version.php b/vendor/sabre/xml/lib/Version.php index cf2810c2a..65706ec42 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.0'; + const VERSION = '2.1.1'; } diff --git a/vendor/sabre/xml/lib/Writer.php b/vendor/sabre/xml/lib/Writer.php index e3238a7ed..f5957bbce 100644 --- a/vendor/sabre/xml/lib/Writer.php +++ b/vendor/sabre/xml/lib/Writer.php @@ -182,6 +182,8 @@ class Writer extends XMLWriter * XMLWriter::startElement doesn't either. * * @param array|string|object|null $content + * + * @return bool */ public function writeElement($name, $content = null): bool { |