From 4400c56c3685012a68801a96827049398e2eea6b Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Mon, 8 May 2023 15:07:07 -0600 Subject: [PATCH 1/2] upgraded DiDOM --- CHANGELOG.md | 6 + composer.json | 2 +- composer.lock | 20 +- image-captions.php | 4 +- vendor/autoload.php | 18 + vendor/composer/ClassLoader.php | 43 +- vendor/composer/InstalledVersions.php | 33 +- vendor/composer/autoload_classmap.php | 2 +- vendor/composer/autoload_namespaces.php | 2 +- vendor/composer/autoload_psr4.php | 2 +- vendor/composer/autoload_real.php | 25 +- vendor/composer/installed.json | 18 +- vendor/composer/installed.php | 12 +- vendor/composer/platform_check.php | 4 +- vendor/imangazaliev/didom/CHANGELOG.md | 137 +- vendor/imangazaliev/didom/README-RU.md | 21 +- vendor/imangazaliev/didom/README.md | 36 +- vendor/imangazaliev/didom/composer.json | 6 +- vendor/imangazaliev/didom/composer.lock | 1267 +++++++++++++---- .../didom/src/DiDom/ClassAttribute.php | 42 +- .../imangazaliev/didom/src/DiDom/Document.php | 175 +-- .../didom/src/DiDom/DocumentFragment.php | 9 +- .../imangazaliev/didom/src/DiDom/Element.php | 72 +- .../imangazaliev/didom/src/DiDom/Encoder.php | 9 +- .../imangazaliev/didom/src/DiDom/Errors.php | 2 + .../Exceptions/InvalidSelectorException.php | 2 + vendor/imangazaliev/didom/src/DiDom/Node.php | 238 ++-- vendor/imangazaliev/didom/src/DiDom/Query.php | 64 +- .../didom/src/DiDom/StyleAttribute.php | 66 +- 29 files changed, 1545 insertions(+), 792 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 366c2ad..675d9f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# v2.1.0 +## mm/dd/2023 + +1. [](#improved) + * Upgraded to latest `v2.0.1` of DiDOM library to support PHP 8.0 + # v2.0.3 ## 12/03/2021 diff --git a/composer.json b/composer.json index 41776f6..7a7257d 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { "require": { - "imangazaliev/didom": "^1.12" + "imangazaliev/didom": "^2.0" } } diff --git a/composer.lock b/composer.lock index 1c4e28d..fc3a73d 100644 --- a/composer.lock +++ b/composer.lock @@ -4,29 +4,29 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "6bf7e2b4d776fcfc0c4dc7cca9b514fa", + "content-hash": "be2707bcb2a99562819b97a30380d0e3", "packages": [ { "name": "imangazaliev/didom", - "version": "1.18", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/Imangazaliev/DiDOM.git", - "reference": "346db1ea94a0f6ead225c2358af770bf33659cf7" + "reference": "50fa6595d14f22c0c984efed5c818485cf548136" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Imangazaliev/DiDOM/zipball/346db1ea94a0f6ead225c2358af770bf33659cf7", - "reference": "346db1ea94a0f6ead225c2358af770bf33659cf7", + "url": "https://api.github.com/repos/Imangazaliev/DiDOM/zipball/50fa6595d14f22c0c984efed5c818485cf548136", + "reference": "50fa6595d14f22c0c984efed5c818485cf548136", "shasum": "" }, "require": { "ext-dom": "*", "ext-iconv": "*", - "php": ">=5.4" + "php": ">=7.2" }, "require-dev": { - "phpunit/phpunit": "^4.8" + "phpunit/phpunit": "^8.5" }, "type": "library", "autoload": { @@ -54,9 +54,9 @@ ], "support": { "issues": "https://github.com/Imangazaliev/DiDOM/issues", - "source": "https://github.com/Imangazaliev/DiDOM/tree/1.18" + "source": "https://github.com/Imangazaliev/DiDOM/tree/2.0.1" }, - "time": "2021-07-27T18:50:53+00:00" + "time": "2023-03-05T03:23:48+00:00" } ], "packages-dev": [], @@ -67,5 +67,5 @@ "prefer-lowest": false, "platform": [], "platform-dev": [], - "plugin-api-version": "2.1.0" + "plugin-api-version": "2.3.0" } diff --git a/image-captions.php b/image-captions.php index 9b1d08b..5262c24 100644 --- a/image-captions.php +++ b/image-captions.php @@ -110,8 +110,8 @@ protected function processFigures($content) $document = new Document($content); $scope = trim($this->grav['config']->get('plugins.image-captions.scope')); - $figure_class = $this->grav['config']->get('plugins.image-captions.figure_class'); - $figcaption_class = $this->grav['config']->get('plugins.image-captions.figcaption_class'); + $figure_class = $this->grav['config']->get('plugins.image-captions.figure_class', ''); + $figcaption_class = $this->grav['config']->get('plugins.image-captions.figcaption_class', ''); $source = $this->grav['config']->get('plugins.image-captions.source'); if (count($images = $document->find($scope)) > 0) { diff --git a/vendor/autoload.php b/vendor/autoload.php index 13f1182..c1882c7 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -2,6 +2,24 @@ // autoload.php @generated by Composer +if (PHP_VERSION_ID < 50600) { + if (!headers_sent()) { + header('HTTP/1.1 500 Internal Server Error'); + } + $err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL; + if (!ini_get('display_errors')) { + if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { + fwrite(STDERR, $err); + } elseif (!headers_sent()) { + echo $err; + } + } + trigger_error( + $err, + E_USER_ERROR + ); +} + require_once __DIR__ . '/composer/autoload_real.php'; return ComposerAutoloaderInit8a23e2ae4d3f41dc1f0d10df35e696c7::getLoader(); diff --git a/vendor/composer/ClassLoader.php b/vendor/composer/ClassLoader.php index 0cd6055..a72151c 100644 --- a/vendor/composer/ClassLoader.php +++ b/vendor/composer/ClassLoader.php @@ -42,6 +42,9 @@ */ class ClassLoader { + /** @var \Closure(string):void */ + private static $includeFile; + /** @var ?string */ private $vendorDir; @@ -106,6 +109,7 @@ class ClassLoader public function __construct($vendorDir = null) { $this->vendorDir = $vendorDir; + self::initializeIncludeClosure(); } /** @@ -149,7 +153,7 @@ public function getFallbackDirsPsr4() /** * @return string[] Array of classname => path - * @psalm-var array + * @psalm-return array */ public function getClassMap() { @@ -425,7 +429,8 @@ public function unregister() public function loadClass($class) { if ($file = $this->findFile($class)) { - includeFile($file); + $includeFile = self::$includeFile; + $includeFile($file); return true; } @@ -555,18 +560,26 @@ private function findFileWithExtension($class, $ext) return false; } -} -/** - * Scope isolated include. - * - * Prevents access to $this/self from included files. - * - * @param string $file - * @return void - * @private - */ -function includeFile($file) -{ - include $file; + /** + * @return void + */ + private static function initializeIncludeClosure() + { + if (self::$includeFile !== null) { + return; + } + + /** + * Scope isolated include. + * + * Prevents access to $this/self from included files. + * + * @param string $file + * @return void + */ + self::$includeFile = \Closure::bind(static function($file) { + include $file; + }, null, null); + } } diff --git a/vendor/composer/InstalledVersions.php b/vendor/composer/InstalledVersions.php index d50e0c9..51e734a 100644 --- a/vendor/composer/InstalledVersions.php +++ b/vendor/composer/InstalledVersions.php @@ -21,12 +21,14 @@ * See also https://getcomposer.org/doc/07-runtime.md#installed-versions * * To require its presence, you can require `composer-runtime-api ^2.0` + * + * @final */ class InstalledVersions { /** * @var mixed[]|null - * @psalm-var array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array}|array{}|null + * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array}|array{}|null */ private static $installed; @@ -37,7 +39,7 @@ class InstalledVersions /** * @var array[] - * @psalm-var array}> + * @psalm-var array}> */ private static $installedByVendor = array(); @@ -96,7 +98,7 @@ public static function isInstalled($packageName, $includeDevRequirements = true) { foreach (self::getInstalled() as $installed) { if (isset($installed['versions'][$packageName])) { - return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']); + return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false; } } @@ -117,7 +119,7 @@ public static function isInstalled($packageName, $includeDevRequirements = true) */ public static function satisfies(VersionParser $parser, $packageName, $constraint) { - $constraint = $parser->parseConstraints($constraint); + $constraint = $parser->parseConstraints((string) $constraint); $provided = $parser->parseConstraints(self::getVersionRanges($packageName)); return $provided->matches($constraint); @@ -241,7 +243,7 @@ public static function getInstallPath($packageName) /** * @return array - * @psalm-return array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string} + * @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool} */ public static function getRootPackage() { @@ -255,7 +257,7 @@ public static function getRootPackage() * * @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect. * @return array[] - * @psalm-return array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array} + * @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} */ public static function getRawData() { @@ -278,7 +280,7 @@ public static function getRawData() * Returns the raw data of all installed.php which are currently loaded for custom implementations * * @return array[] - * @psalm-return list}> + * @psalm-return list}> */ public static function getAllRawData() { @@ -301,7 +303,7 @@ public static function getAllRawData() * @param array[] $data A vendor/composer/installed.php data set * @return void * - * @psalm-param array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array} $data + * @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $data */ public static function reload($data) { @@ -311,7 +313,7 @@ public static function reload($data) /** * @return array[] - * @psalm-return list}> + * @psalm-return list}> */ private static function getInstalled() { @@ -326,7 +328,9 @@ private static function getInstalled() if (isset(self::$installedByVendor[$vendorDir])) { $installed[] = self::$installedByVendor[$vendorDir]; } elseif (is_file($vendorDir.'/composer/installed.php')) { - $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php'; + /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $required */ + $required = require $vendorDir.'/composer/installed.php'; + $installed[] = self::$installedByVendor[$vendorDir] = $required; if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { self::$installed = $installed[count($installed) - 1]; } @@ -338,12 +342,17 @@ private static function getInstalled() // only require the installed.php file if this file is loaded from its dumped location, // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 if (substr(__DIR__, -8, 1) !== 'C') { - self::$installed = require __DIR__ . '/installed.php'; + /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $required */ + $required = require __DIR__ . '/installed.php'; + self::$installed = $required; } else { self::$installed = array(); } } - $installed[] = self::$installed; + + if (self::$installed !== array()) { + $installed[] = self::$installed; + } return $installed; } diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index b26f1b1..0fb0a2c 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -2,7 +2,7 @@ // autoload_classmap.php @generated by Composer -$vendorDir = dirname(dirname(__FILE__)); +$vendorDir = dirname(__DIR__); $baseDir = dirname($vendorDir); return array( diff --git a/vendor/composer/autoload_namespaces.php b/vendor/composer/autoload_namespaces.php index b7fc012..15a2ff3 100644 --- a/vendor/composer/autoload_namespaces.php +++ b/vendor/composer/autoload_namespaces.php @@ -2,7 +2,7 @@ // autoload_namespaces.php @generated by Composer -$vendorDir = dirname(dirname(__FILE__)); +$vendorDir = dirname(__DIR__); $baseDir = dirname($vendorDir); return array( diff --git a/vendor/composer/autoload_psr4.php b/vendor/composer/autoload_psr4.php index f54bcc5..b5d484f 100644 --- a/vendor/composer/autoload_psr4.php +++ b/vendor/composer/autoload_psr4.php @@ -2,7 +2,7 @@ // autoload_psr4.php @generated by Composer -$vendorDir = dirname(dirname(__FILE__)); +$vendorDir = dirname(__DIR__); $baseDir = dirname($vendorDir); return array( diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index 9988e8e..7fabe2a 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -25,30 +25,11 @@ public static function getLoader() require __DIR__ . '/platform_check.php'; spl_autoload_register(array('ComposerAutoloaderInit8a23e2ae4d3f41dc1f0d10df35e696c7', 'loadClassLoader'), true, true); - self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__))); + self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); spl_autoload_unregister(array('ComposerAutoloaderInit8a23e2ae4d3f41dc1f0d10df35e696c7', 'loadClassLoader')); - $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); - if ($useStaticLoader) { - require __DIR__ . '/autoload_static.php'; - - call_user_func(\Composer\Autoload\ComposerStaticInit8a23e2ae4d3f41dc1f0d10df35e696c7::getInitializer($loader)); - } else { - $map = require __DIR__ . '/autoload_namespaces.php'; - foreach ($map as $namespace => $path) { - $loader->set($namespace, $path); - } - - $map = require __DIR__ . '/autoload_psr4.php'; - foreach ($map as $namespace => $path) { - $loader->setPsr4($namespace, $path); - } - - $classMap = require __DIR__ . '/autoload_classmap.php'; - if ($classMap) { - $loader->addClassMap($classMap); - } - } + require __DIR__ . '/autoload_static.php'; + call_user_func(\Composer\Autoload\ComposerStaticInit8a23e2ae4d3f41dc1f0d10df35e696c7::getInitializer($loader)); $loader->register(true); diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index b560822..b6551dc 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -2,28 +2,28 @@ "packages": [ { "name": "imangazaliev/didom", - "version": "1.18", - "version_normalized": "1.18.0.0", + "version": "2.0.1", + "version_normalized": "2.0.1.0", "source": { "type": "git", "url": "https://github.com/Imangazaliev/DiDOM.git", - "reference": "346db1ea94a0f6ead225c2358af770bf33659cf7" + "reference": "50fa6595d14f22c0c984efed5c818485cf548136" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Imangazaliev/DiDOM/zipball/346db1ea94a0f6ead225c2358af770bf33659cf7", - "reference": "346db1ea94a0f6ead225c2358af770bf33659cf7", + "url": "https://api.github.com/repos/Imangazaliev/DiDOM/zipball/50fa6595d14f22c0c984efed5c818485cf548136", + "reference": "50fa6595d14f22c0c984efed5c818485cf548136", "shasum": "" }, "require": { "ext-dom": "*", "ext-iconv": "*", - "php": ">=5.4" + "php": ">=7.2" }, "require-dev": { - "phpunit/phpunit": "^4.8" + "phpunit/phpunit": "^8.5" }, - "time": "2021-07-27T18:50:53+00:00", + "time": "2023-03-05T03:23:48+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -51,7 +51,7 @@ ], "support": { "issues": "https://github.com/Imangazaliev/DiDOM/issues", - "source": "https://github.com/Imangazaliev/DiDOM/tree/1.18" + "source": "https://github.com/Imangazaliev/DiDOM/tree/2.0.1" }, "install-path": "../imangazaliev/didom" } diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index 182b5ab..1441a77 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -1,31 +1,31 @@ array( + 'name' => '__root__', 'pretty_version' => 'dev-develop', 'version' => 'dev-develop', + 'reference' => '917e8b2d0b813e0b921ef084eaf4bf349ce8ef76', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), - 'reference' => '29a808c149b5a3589c30a076e95dd5760ac6fbb9', - 'name' => '__root__', 'dev' => true, ), 'versions' => array( '__root__' => array( 'pretty_version' => 'dev-develop', 'version' => 'dev-develop', + 'reference' => '917e8b2d0b813e0b921ef084eaf4bf349ce8ef76', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), - 'reference' => '29a808c149b5a3589c30a076e95dd5760ac6fbb9', 'dev_requirement' => false, ), 'imangazaliev/didom' => array( - 'pretty_version' => '1.18', - 'version' => '1.18.0.0', + 'pretty_version' => '2.0.1', + 'version' => '2.0.1.0', + 'reference' => '50fa6595d14f22c0c984efed5c818485cf548136', 'type' => 'library', 'install_path' => __DIR__ . '/../imangazaliev/didom', 'aliases' => array(), - 'reference' => '346db1ea94a0f6ead225c2358af770bf33659cf7', 'dev_requirement' => false, ), ), diff --git a/vendor/composer/platform_check.php b/vendor/composer/platform_check.php index 590554b..589e9e7 100644 --- a/vendor/composer/platform_check.php +++ b/vendor/composer/platform_check.php @@ -4,8 +4,8 @@ $issues = array(); -if (!(PHP_VERSION_ID >= 50400)) { - $issues[] = 'Your Composer dependencies require a PHP version ">= 5.4.0". You are running ' . PHP_VERSION . '.'; +if (!(PHP_VERSION_ID >= 70200)) { + $issues[] = 'Your Composer dependencies require a PHP version ">= 7.2.0". You are running ' . PHP_VERSION . '.'; } if ($issues) { diff --git a/vendor/imangazaliev/didom/CHANGELOG.md b/vendor/imangazaliev/didom/CHANGELOG.md index 2e207e4..1451f6a 100644 --- a/vendor/imangazaliev/didom/CHANGELOG.md +++ b/vendor/imangazaliev/didom/CHANGELOG.md @@ -1,4 +1,55 @@ -### 1.13 +## 2.0 + +### Breaking changes + +- Minimum PHP version bumped to 7.2 +- Remove `__invoke` method from `Document`, `Element` and `DocumentFragment` that was deprecated early +- Remove magic property `Element::$tag`. Use `tagName()` method instead +- Rename `Element::getDocument()` to `ownerDocument()` + +### What's new + +- Add `Node::setInnerXml()` method (i. e. for `Element` and `DocumentFragment` too) + +## 1.18 + +- Fix a bug when a call of Element::previousSibling() with selector returns a previous sibling when there is not matching element + +## 1.17 + +- Add support of multiple pseudoclasses (#125) + +## 1.16.4 + +- Handle nested pseudo-classes with expression correctly + +## 1.16.3 + +- Fix parsing of a style property in "style" attribute when the value contains a colon + +## 1.16.1 + +- Fix deprecation notice in PHP 8 for `libxml_disable_entity_loader` + +## 1.16 + +- Add `Node::insertSiblingBefore()` and `Node::insertSiblingAfter()` methods for inserting sibling nodes + +## 1.15 + +- Add support of document fragments + +## 1.14.1 + +- Fix an exception when selecting comment element with XPath +- Add support of `DOMCdataSection` nodes +- Add methods `createTextNode()`, `createComment()`, `createCdataSection()` to the Document class + +## 1.14 + +- Add `Element::innerXml()` method + +## 1.13 - Add `Element::outerHtml()` method - Add `Element::prependChild()` method @@ -6,15 +57,15 @@ - Add `Element::style()` method for more convenient inline styles manipulation - Add `Element::classes()` method for more convenient class manipulation -### 1.12 +## 1.12 - Many fixes and improvements -### 1.11.1 +## 1.11.1 - Fix bug with unregistered PHP functions in XPath in `Document::has()` and `Document::count()` methods -### 1.11 +## 1.11 - Add `Element::isElementNode()` method - Add ability to retrieve only specific attributes in `Element::attributes()` method @@ -23,87 +74,87 @@ - Add `Element::previousSiblings()` and `Element::nextSiblings()` methods - Many minor fixes and improvements -### 1.10.6 +## 1.10.6 - Fix bug with XML document loading -### v1.10.5 +## 1.10.5 - Fix issue #85 -### 1.10.4 +## 1.10.4 - Use `mb_convert_encoding()` in the Encoder if it is available -### v1.10.3 +## 1.10.3 - Add `Element::removeChild()` and `Element::removeChildren()` methods - Fix bug in `Element::matches()` method - `Element::matches()` method now returns false if node is not `DOMElement` - Add `Element::hasChildren()` method -### 1.10.2 +## 1.10.2 - Fix bug in setInnerHtml: can't rewrite existing content - Throw `InvalidSelectorException` instead of `InvalidArgumentException` when selector is empty -### 1.10.1 +## 1.10.1 - Fix attributes `ends-with` XPath - Method `Element::matches()` now can check children nodes -### 1.10 +## 1.10 - Fix HTML saving mechanism - Throw `InvalidSelectorException` instead of `RuntimeException` in Query class -### 1.9.1 +## 1.9.1 - Add ability to search in owner document using current node as context - Bugs fixed -### 1.9.0 +## 1.9.0 - Methods `Document::appendChild()` and `Element::appendChild()` now return appended node(s) - Add ability to search elements in context -### 1.8.8 +## 1.8.8 - Bugs fixed -### 1.8.7 +## 1.8.7 - Add `Element::getLineNo()` method -### 1.8.6 +## 1.8.6 - Fix issue #55 -### 1.8.5 +## 1.8.5 - Add support of `DOMComment` -### 1.8.4 +## 1.8.4 - Add ability to create an element by selector - Add closest method -### 1.8.3 +## 1.8.3 - Add method `Element::isTextNode()` - Many minor fixes -### 1.8.2 +## 1.8.2 - Add ability to check that element matches selector - Add ability counting nodes by selector - Many minor fixes -### 1.8.1 +## 1.8.1 - Small fix -### 1.8 +## 1.8 - Bug fixes - Add support of ~ selector @@ -111,101 +162,101 @@ - Add setInnerHtml method - Add attributes method -### 1.7.4 +## 1.7.4 - Add support of text nodes -### 1.7.3 +## 1.7.3 - Bug fix -### 1.7.2 +## 1.7.2 - Fixed behavior of nth-child pseudo class - Add nth-of-type pseudo class -### 1.7.1 +## 1.7.1 - Add pseudo class has and more attribute options -### 1.7.0 +## 1.7.0 - Bug fixes - Add methods `previousSibling`, `nextSibling`, `child`, `firstChild`, `lastChild`, `children`, `getDocument` to the Element - Changed behavior of parent method. Now it returns parent node instead of owner document -### 1.6.8 +## 1.6.8 - Bug fix -### 1.6.5 +## 1.6.5 - Added ability to get an element attribute by CSS selector -### 1.6.4 +## 1.6.4 - Added handling of `DOMText` and `DOMAttr` in `Document::find()` -### 1.6.3 +## 1.6.3 - Added ability to get inner HTML -### 1.6.2 +## 1.6.2 - Added the ability to pass options when load HTML or XML -### 1.6.1 +## 1.6.1 - Added the ability to pass an array of nodes to appendChild - Added the ability to pass options when converting to HTML or XML - Added the ability to add child elements to the element -### 1.6 +## 1.6 - Added support for XML - Added the ability to search element by part of attribute name or value - Added support for pseudo-class "contains" - Added the ability to clone a node -### 1.5.1 +## 1.5.1 - Added ability to remove and replace nodes - Added ability to specify encoding when converting the element into the document -### 1.5 +## 1.5 - Fixed problem with incorrect encoding - Added ability to set the value of the element - Added ability to specify encoding when creating document -### 1.4 +## 1.4 - Added the ability to specify the return type element (`DiDom\Element` or `DOMElement`) -### 1.3.2 +## 1.3.2 - Bug fixed -### 1.3.1 +## 1.3.1 - Bugs fixed - Added the ability to pass element attributes in the constructor -### 1.3 +## 1.3 - Bugs fixed -### 1.2 +## 1.2 - Bugs fixed - Added the ability to compare Element\Document - Added the ability to format HTML code of the document when outputting -### 1.1 +## 1.1 - Added cache control - Converter from CSS to XPath replaced by faster -### 1.0 +## 1.0 - First release \ No newline at end of file diff --git a/vendor/imangazaliev/didom/README-RU.md b/vendor/imangazaliev/didom/README-RU.md index ababf62..88bd708 100644 --- a/vendor/imangazaliev/didom/README-RU.md +++ b/vendor/imangazaliev/didom/README-RU.md @@ -5,10 +5,11 @@ [![Latest Stable Version](https://poser.pugx.org/imangazaliev/didom/v/stable)](https://packagist.org/packages/imangazaliev/didom) [![License](https://poser.pugx.org/imangazaliev/didom/license)](https://packagist.org/packages/imangazaliev/didom) -[English version](README.md) - DiDOM - простая и быстрая библиотека для парсинга HTML. +- [English version](README.md) +- [Документация для версии 1.x](https://github.com/Imangazaliev/DiDOM/blob/98d411741d598b0b74bb38e215d99c1cdb0d532d/README-RU.md). Чтобы обновится с версии 1.x, пожалуйста просмотрите [историю изменений](CHANGELOG.md). + ## Содержание - [Установка](#Установка) @@ -307,10 +308,20 @@ $element->find('> a'); $element->setInnerHtml('Foo'); ``` -### Изменение значения +### Изменение XML + +```php +$element->setInnerXml(' Foo BarHello world! +]]>'); +``` + +### Изменение значения (как простой текст) ```php $element->setValue('Foo'); +// будет закодирован в HTML-сущность как при вызове htmlentities() +$element->setValue('Foo'); ``` ## Вывод содержимого @@ -471,7 +482,7 @@ $element = Element::createBySelector('div.block', 'Foo', [ ## Получение названия элемента ```php -$element->tag; +$element->tagName(); ``` ## Получение родительского элемента @@ -586,7 +597,7 @@ $document = new Document($html); $element = $document->first('input[name=email]'); -$document2 = $element->getDocument(); +$document2 = $element->ownerDocument(); // bool(true) var_dump($document->is($document2)); diff --git a/vendor/imangazaliev/didom/README.md b/vendor/imangazaliev/didom/README.md index 3cce570..60c53e8 100644 --- a/vendor/imangazaliev/didom/README.md +++ b/vendor/imangazaliev/didom/README.md @@ -5,10 +5,11 @@ [![Latest Stable Version](https://poser.pugx.org/imangazaliev/didom/v/stable)](https://packagist.org/packages/imangazaliev/didom) [![License](https://poser.pugx.org/imangazaliev/didom/license)](https://packagist.org/packages/imangazaliev/didom) -[README на русском](README-RU.md) - DiDOM - simple and fast HTML parser. +- [README на русском](README-RU.md) +- [DiDOM 1.x documentation](https://github.com/Imangazaliev/DiDOM/blob/98d411741d598b0b74bb38e215d99c1cdb0d532d/README.md). To upgrade from 1.x please checkout the [changelog](CHANGELOG.md). + ## Contents - [Installation](#installation) @@ -18,6 +19,7 @@ DiDOM - simple and fast HTML parser. - [Verify if element exists](#verify-if-element-exists) - [Search in element](#search-in-element) - [Supported selectors](#supported-selectors) +- [Changing content](#changing-content) - [Output](#output) - [Working with elements](#working-with-elements) - [Creating a new element](#creating-a-new-element) @@ -256,6 +258,30 @@ $document->find('a.foo::text'); $document->find('a.bar::attr(href|title)'); ``` +## Changing content + +### Change inner HTML + +```php +$element->setInnerHtml('Foo'); +``` + +### Change inner XML + +```php +$element->setInnerXml(' Foo BarHello world! +]]>'); +``` + +### Change value (as plain text) + +```php +$element->setValue('Foo'); +// will be encoded like using htmlentities() +$element->setValue('Foo'); +``` + ## Output ### Getting HTML @@ -360,7 +386,7 @@ $element = $document->createElement('span', 'Hello'); ## Getting the name of an element ```php -$element->tag; +$element->tagName(); ``` ## Getting parent element @@ -410,14 +436,14 @@ var_dump($div->lastChild()->text()); var_dump($div->children()); ``` -## Getting document +## Getting owner document ```php $document = new Document($html); $element = $document->find('input[name=email]')[0]; -$document2 = $element->getDocument(); +$document2 = $element->ownerDocument(); // bool(true) var_dump($document->is($document2)); diff --git a/vendor/imangazaliev/didom/composer.json b/vendor/imangazaliev/didom/composer.json index f45125d..848becb 100644 --- a/vendor/imangazaliev/didom/composer.json +++ b/vendor/imangazaliev/didom/composer.json @@ -12,12 +12,12 @@ } ], "require": { - "php": ">=5.4", + "php": ">=7.2", "ext-dom": "*", "ext-iconv": "*" }, "require-dev": { - "phpunit/phpunit": "^4.8" + "phpunit/phpunit": "^8.5" }, "autoload": { "psr-4": { @@ -31,7 +31,7 @@ }, "config": { "platform": { - "php": "5.4" + "php": "7.2" } } } diff --git a/vendor/imangazaliev/didom/composer.lock b/vendor/imangazaliev/didom/composer.lock index 82cbd06..b25e841 100644 --- a/vendor/imangazaliev/didom/composer.lock +++ b/vendor/imangazaliev/didom/composer.lock @@ -1,43 +1,40 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "hash": "7d413af5e53b1204b6c430dbd32ca728", - "content-hash": "fa5a5b325a0458a9fe05c67fb6b0e719", + "content-hash": "4cb2844eeea52c1240d6ccaa8381c25d", "packages": [], "packages-dev": [ { "name": "doctrine/instantiator", - "version": "1.0.5", + "version": "1.4.1", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" + "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/10dcfce151b967d20fde1b34ae6640712c3891bc", + "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc", "shasum": "" }, "require": { - "php": ">=5.3,<8.0-DEV" + "php": "^7.1 || ^8.0" }, "require-dev": { - "athletic/athletic": "~0.1.8", + "doctrine/coding-standard": "^9", "ext-pdo": "*", "ext-phar": "*", - "phpunit/phpunit": "~4.0", - "squizlabs/php_codesniffer": "~2.0" + "phpbench/phpbench": "^0.16 || ^1", + "phpstan/phpstan": "^1.4", + "phpstan/phpstan-phpunit": "^1", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "vimeo/psalm": "^4.22" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, "autoload": { "psr-4": { "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" @@ -51,52 +48,346 @@ { "name": "Marco Pivetta", "email": "ocramius@gmail.com", - "homepage": "http://ocramius.github.com/" + "homepage": "https://ocramius.github.io/" } ], "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://github.com/doctrine/instantiator", + "homepage": "https://www.doctrine-project.org/projects/instantiator.html", "keywords": [ "constructor", "instantiate" ], - "time": "2015-06-14 21:17:01" + "support": { + "issues": "https://github.com/doctrine/instantiator/issues", + "source": "https://github.com/doctrine/instantiator/tree/1.4.1" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", + "type": "tidelift" + } + ], + "time": "2022-03-03T08:28:38+00:00" + }, + { + "name": "myclabs/deep-copy", + "version": "1.11.0", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/14daed4296fae74d9e3201d2c4925d1acb7aa614", + "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "conflict": { + "doctrine/collections": "<1.6.8", + "doctrine/common": "<2.13.3 || >=3,<3.2.2" + }, + "require-dev": { + "doctrine/collections": "^1.6.8", + "doctrine/common": "^2.13.3 || ^3.2.2", + "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" + }, + "type": "library", + "autoload": { + "files": [ + "src/DeepCopy/deep_copy.php" + ], + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Create deep copies (clones) of your objects", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "support": { + "issues": "https://github.com/myclabs/DeepCopy/issues", + "source": "https://github.com/myclabs/DeepCopy/tree/1.11.0" + }, + "funding": [ + { + "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", + "type": "tidelift" + } + ], + "time": "2022-03-03T13:19:32+00:00" + }, + { + "name": "phar-io/manifest", + "version": "2.0.3", + "source": { + "type": "git", + "url": "https://github.com/phar-io/manifest.git", + "reference": "97803eca37d319dfa7826cc2437fc020857acb53" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53", + "reference": "97803eca37d319dfa7826cc2437fc020857acb53", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-phar": "*", + "ext-xmlwriter": "*", + "phar-io/version": "^3.0.1", + "php": "^7.2 || ^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "support": { + "issues": "https://github.com/phar-io/manifest/issues", + "source": "https://github.com/phar-io/manifest/tree/2.0.3" + }, + "time": "2021-07-20T11:28:43+00:00" + }, + { + "name": "phar-io/version", + "version": "3.2.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Library for handling version information and constraints", + "support": { + "issues": "https://github.com/phar-io/version/issues", + "source": "https://github.com/phar-io/version/tree/3.2.1" + }, + "time": "2022-02-21T01:04:05+00:00" + }, + { + "name": "phpdocumentor/reflection-common", + "version": "2.2.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionCommon.git", + "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b", + "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-2.x": "2.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jaap van Otterdijk", + "email": "opensource@ijaap.nl" + } + ], + "description": "Common reflection classes used by phpdocumentor to reflect the code structure", + "homepage": "http://www.phpdoc.org", + "keywords": [ + "FQSEN", + "phpDocumentor", + "phpdoc", + "reflection", + "static analysis" + ], + "support": { + "issues": "https://github.com/phpDocumentor/ReflectionCommon/issues", + "source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.x" + }, + "time": "2020-06-27T09:03:43+00:00" }, { "name": "phpdocumentor/reflection-docblock", - "version": "2.0.5", + "version": "5.3.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "e6a969a640b00d8daa3c66518b0405fb41ae0c4b" + "reference": "622548b623e81ca6d78b721c5e029f4ce664f170" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/e6a969a640b00d8daa3c66518b0405fb41ae0c4b", - "reference": "e6a969a640b00d8daa3c66518b0405fb41ae0c4b", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/622548b623e81ca6d78b721c5e029f4ce664f170", + "reference": "622548b623e81ca6d78b721c5e029f4ce664f170", "shasum": "" }, "require": { - "php": ">=5.3.3" + "ext-filter": "*", + "php": "^7.2 || ^8.0", + "phpdocumentor/reflection-common": "^2.2", + "phpdocumentor/type-resolver": "^1.3", + "webmozart/assert": "^1.9.1" }, "require-dev": { - "phpunit/phpunit": "~4.0" + "mockery/mockery": "~1.3.2", + "psalm/phar": "^4.8" }, - "suggest": { - "dflydev/markdown": "~1.0", - "erusev/parsedown": "~1.0" + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + }, + { + "name": "Jaap van Otterdijk", + "email": "account@ijaap.nl" + } + ], + "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "support": { + "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.3.0" + }, + "time": "2021-10-19T17:43:47+00:00" + }, + { + "name": "phpdocumentor/type-resolver", + "version": "1.6.1", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/TypeResolver.git", + "reference": "77a32518733312af16a44300404e945338981de3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/77a32518733312af16a44300404e945338981de3", + "reference": "77a32518733312af16a44300404e945338981de3", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0", + "phpdocumentor/reflection-common": "^2.0" + }, + "require-dev": { + "ext-tokenizer": "*", + "psalm/phar": "^4.8" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-1.x": "1.x-dev" } }, "autoload": { - "psr-0": { - "phpDocumentor": [ - "src/" - ] + "psr-4": { + "phpDocumentor\\Reflection\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -106,40 +397,45 @@ "authors": [ { "name": "Mike van Riel", - "email": "mike.vanriel@naenius.com" + "email": "me@mikevanriel.com" } ], - "time": "2016-01-25 08:17:30" + "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", + "support": { + "issues": "https://github.com/phpDocumentor/TypeResolver/issues", + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.1" + }, + "time": "2022-03-15T21:29:03+00:00" }, { "name": "phpspec/prophecy", - "version": "1.8.1", + "version": "v1.15.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "1927e75f4ed19131ec9bcc3b002e07fb1173ee76" + "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/1927e75f4ed19131ec9bcc3b002e07fb1173ee76", - "reference": "1927e75f4ed19131ec9bcc3b002e07fb1173ee76", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/bbcd7380b0ebf3961ee21409db7b38bc31d69a13", + "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.0.2", - "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0", - "sebastian/comparator": "^1.1|^2.0|^3.0", - "sebastian/recursion-context": "^1.0|^2.0|^3.0" + "doctrine/instantiator": "^1.2", + "php": "^7.2 || ~8.0, <8.2", + "phpdocumentor/reflection-docblock": "^5.2", + "sebastian/comparator": "^3.0 || ^4.0", + "sebastian/recursion-context": "^3.0 || ^4.0" }, "require-dev": { - "phpspec/phpspec": "^2.5|^3.2", - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" + "phpspec/phpspec": "^6.0 || ^7.0", + "phpunit/phpunit": "^8.0 || ^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.8.x-dev" + "dev-master": "1.x-dev" } }, "autoload": { @@ -172,43 +468,48 @@ "spy", "stub" ], - "time": "2019-06-13 12:50:23" + "support": { + "issues": "https://github.com/phpspec/prophecy/issues", + "source": "https://github.com/phpspec/prophecy/tree/v1.15.0" + }, + "time": "2021-12-08T12:19:24+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "2.2.4", + "version": "7.0.15", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979" + "reference": "819f92bba8b001d4363065928088de22f25a3a48" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/eabf68b476ac7d0f73793aada060f1c1a9bf8979", - "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/819f92bba8b001d4363065928088de22f25a3a48", + "reference": "819f92bba8b001d4363065928088de22f25a3a48", "shasum": "" }, "require": { - "php": ">=5.3.3", - "phpunit/php-file-iterator": "~1.3", - "phpunit/php-text-template": "~1.2", - "phpunit/php-token-stream": "~1.3", - "sebastian/environment": "^1.3.2", - "sebastian/version": "~1.0" + "ext-dom": "*", + "ext-xmlwriter": "*", + "php": ">=7.2", + "phpunit/php-file-iterator": "^2.0.2", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-token-stream": "^3.1.3 || ^4.0", + "sebastian/code-unit-reverse-lookup": "^1.0.1", + "sebastian/environment": "^4.2.2", + "sebastian/version": "^2.0.1", + "theseer/tokenizer": "^1.1.3" }, "require-dev": { - "ext-xdebug": ">=2.1.4", - "phpunit/phpunit": "~4" + "phpunit/phpunit": "^8.2.2" }, "suggest": { - "ext-dom": "*", - "ext-xdebug": ">=2.2.1", - "ext-xmlwriter": "*" + "ext-xdebug": "^2.7.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.2.x-dev" + "dev-master": "7.0-dev" } }, "autoload": { @@ -223,7 +524,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -234,29 +535,42 @@ "testing", "xunit" ], - "time": "2015-10-06 15:47:00" + "support": { + "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/7.0.15" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2021-07-26T12:20:09+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "1.4.5", + "version": "2.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4" + "reference": "42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4", - "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5", + "reference": "42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.1" + }, + "require-dev": { + "phpunit/phpunit": "^8.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -271,7 +585,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -281,7 +595,17 @@ "filesystem", "iterator" ], - "time": "2017-11-27 13:52:08" + "support": { + "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/2.0.5" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2021-12-02T12:42:26+00:00" }, { "name": "phpunit/php-text-template", @@ -322,32 +646,36 @@ "keywords": [ "template" ], - "time": "2015-06-21 13:50:34" + "support": { + "issues": "https://github.com/sebastianbergmann/php-text-template/issues", + "source": "https://github.com/sebastianbergmann/php-text-template/tree/1.2.1" + }, + "time": "2015-06-21T13:50:34+00:00" }, { "name": "phpunit/php-timer", - "version": "1.0.9", + "version": "2.1.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" + "reference": "2454ae1765516d20c4ffe103d85a58a9a3bd5662" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", - "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/2454ae1765516d20c4ffe103d85a58a9a3bd5662", + "reference": "2454ae1765516d20c4ffe103d85a58a9a3bd5662", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0" + "php": ">=7.1" }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" + "phpunit/phpunit": "^8.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "2.1-dev" } }, "autoload": { @@ -362,7 +690,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -371,33 +699,43 @@ "keywords": [ "timer" ], - "time": "2017-02-26 11:10:40" + "support": { + "issues": "https://github.com/sebastianbergmann/php-timer/issues", + "source": "https://github.com/sebastianbergmann/php-timer/tree/2.1.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T08:20:02+00:00" }, { "name": "phpunit/php-token-stream", - "version": "1.4.12", + "version": "3.1.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "1ce90ba27c42e4e44e6d8458241466380b51fa16" + "reference": "9c1da83261628cb24b6a6df371b6e312b3954768" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/1ce90ba27c42e4e44e6d8458241466380b51fa16", - "reference": "1ce90ba27c42e4e44e6d8458241466380b51fa16", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/9c1da83261628cb24b6a6df371b6e312b3954768", + "reference": "9c1da83261628cb24b6a6df371b6e312b3954768", "shasum": "" }, "require": { "ext-tokenizer": "*", - "php": ">=5.3.3" + "php": ">=7.1" }, "require-dev": { - "phpunit/phpunit": "~4.2" + "phpunit/phpunit": "^7.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4-dev" + "dev-master": "3.1-dev" } }, "autoload": { @@ -420,45 +758,67 @@ "keywords": [ "tokenizer" ], - "time": "2017-12-04 08:55:13" + "support": { + "issues": "https://github.com/sebastianbergmann/php-token-stream/issues", + "source": "https://github.com/sebastianbergmann/php-token-stream/tree/3.1.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "abandoned": true, + "time": "2021-07-26T12:15:06+00:00" }, { "name": "phpunit/phpunit", - "version": "4.8.36", + "version": "8.5.26", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "46023de9a91eec7dfb06cc56cb4e260017298517" + "reference": "ef117c59fc4c54a979021b26d08a3373e386606d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/46023de9a91eec7dfb06cc56cb4e260017298517", - "reference": "46023de9a91eec7dfb06cc56cb4e260017298517", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/ef117c59fc4c54a979021b26d08a3373e386606d", + "reference": "ef117c59fc4c54a979021b26d08a3373e386606d", "shasum": "" }, "require": { + "doctrine/instantiator": "^1.3.1", "ext-dom": "*", "ext-json": "*", - "ext-pcre": "*", - "ext-reflection": "*", - "ext-spl": "*", - "php": ">=5.3.3", - "phpspec/prophecy": "^1.3.1", - "phpunit/php-code-coverage": "~2.1", - "phpunit/php-file-iterator": "~1.4", - "phpunit/php-text-template": "~1.2", - "phpunit/php-timer": "^1.0.6", - "phpunit/phpunit-mock-objects": "~2.3", - "sebastian/comparator": "~1.2.2", - "sebastian/diff": "~1.2", - "sebastian/environment": "~1.3", - "sebastian/exporter": "~1.2", - "sebastian/global-state": "~1.0", - "sebastian/version": "~1.0", - "symfony/yaml": "~2.1|~3.0" + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", + "ext-xmlwriter": "*", + "myclabs/deep-copy": "^1.10.0", + "phar-io/manifest": "^2.0.3", + "phar-io/version": "^3.0.2", + "php": ">=7.2", + "phpspec/prophecy": "^1.10.3", + "phpunit/php-code-coverage": "^7.0.12", + "phpunit/php-file-iterator": "^2.0.4", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-timer": "^2.1.2", + "sebastian/comparator": "^3.0.2", + "sebastian/diff": "^3.0.2", + "sebastian/environment": "^4.2.3", + "sebastian/exporter": "^3.1.2", + "sebastian/global-state": "^3.0.0", + "sebastian/object-enumerator": "^3.0.3", + "sebastian/resource-operations": "^2.0.1", + "sebastian/type": "^1.1.3", + "sebastian/version": "^2.0.1" + }, + "require-dev": { + "ext-pdo": "*" }, "suggest": { - "phpunit/php-invoker": "~1.1" + "ext-soap": "*", + "ext-xdebug": "*", + "phpunit/php-invoker": "^2.0.0" }, "bin": [ "phpunit" @@ -466,7 +826,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.8.x-dev" + "dev-master": "8.5-dev" } }, "autoload": { @@ -492,38 +852,46 @@ "testing", "xunit" ], - "time": "2017-06-21 08:07:12" + "support": { + "issues": "https://github.com/sebastianbergmann/phpunit/issues", + "source": "https://github.com/sebastianbergmann/phpunit/tree/8.5.26" + }, + "funding": [ + { + "url": "https://phpunit.de/sponsors.html", + "type": "custom" + }, + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2022-04-01T12:34:39+00:00" }, { - "name": "phpunit/phpunit-mock-objects", - "version": "2.3.8", + "name": "sebastian/code-unit-reverse-lookup", + "version": "1.0.2", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983" + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "1de8cd5c010cb153fcd68b8d0f64606f523f7619" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983", - "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/1de8cd5c010cb153fcd68b8d0f64606f523f7619", + "reference": "1de8cd5c010cb153fcd68b8d0f64606f523f7619", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.0.2", - "php": ">=5.3.3", - "phpunit/php-text-template": "~1.2", - "sebastian/exporter": "~1.2" + "php": ">=5.6" }, "require-dev": { - "phpunit/phpunit": "~4.4" - }, - "suggest": { - "ext-soap": "*" + "phpunit/phpunit": "^8.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3.x-dev" + "dev-master": "1.0.x-dev" } }, "autoload": { @@ -538,45 +906,49 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" + "email": "sebastian@phpunit.de" } ], - "description": "Mock Object library for PHPUnit", - "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", - "keywords": [ - "mock", - "xunit" + "description": "Looks up which function or method a line of code belongs to", + "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", + "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/1.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } ], - "abandoned": true, - "time": "2015-10-02 06:51:40" + "time": "2020-11-30T08:15:22+00:00" }, { "name": "sebastian/comparator", - "version": "1.2.4", + "version": "3.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be" + "reference": "1071dfcef776a57013124ff35e1fc41ccd294758" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", - "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/1071dfcef776a57013124ff35e1fc41ccd294758", + "reference": "1071dfcef776a57013124ff35e1fc41ccd294758", "shasum": "" }, "require": { - "php": ">=5.3.3", - "sebastian/diff": "~1.2", - "sebastian/exporter": "~1.2 || ~2.0" + "php": ">=7.1", + "sebastian/diff": "^3.0", + "sebastian/exporter": "^3.1" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^8.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2.x-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -589,6 +961,10 @@ "BSD-3-Clause" ], "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, { "name": "Jeff Welch", "email": "whatthejeff@gmail.com" @@ -600,45 +976,52 @@ { "name": "Bernhard Schussek", "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" } ], "description": "Provides the functionality to compare PHP values for equality", - "homepage": "http://www.github.com/sebastianbergmann/comparator", + "homepage": "https://github.com/sebastianbergmann/comparator", "keywords": [ "comparator", "compare", "equality" ], - "time": "2017-01-29 09:50:25" + "support": { + "issues": "https://github.com/sebastianbergmann/comparator/issues", + "source": "https://github.com/sebastianbergmann/comparator/tree/3.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T08:04:30+00:00" }, { "name": "sebastian/diff", - "version": "1.4.3", + "version": "3.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4" + "reference": "14f72dd46eaf2f2293cbe79c93cc0bc43161a211" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7f066a26a962dbe58ddea9f72a4e82874a3975a4", - "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/14f72dd46eaf2f2293cbe79c93cc0bc43161a211", + "reference": "14f72dd46eaf2f2293cbe79c93cc0bc43161a211", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0" + "php": ">=7.1" }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" + "phpunit/phpunit": "^7.5 || ^8.0", + "symfony/process": "^2 || ^3.3 || ^4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -651,46 +1034,62 @@ "BSD-3-Clause" ], "authors": [ - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - }, { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" + }, + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" } ], "description": "Diff implementation", "homepage": "https://github.com/sebastianbergmann/diff", "keywords": [ - "diff" + "diff", + "udiff", + "unidiff", + "unified diff" ], - "time": "2017-05-22 07:24:03" + "support": { + "issues": "https://github.com/sebastianbergmann/diff/issues", + "source": "https://github.com/sebastianbergmann/diff/tree/3.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T07:59:04+00:00" }, { "name": "sebastian/environment", - "version": "1.3.8", + "version": "4.2.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea" + "reference": "d47bbbad83711771f167c72d4e3f25f7fcc1f8b0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/be2c607e43ce4c89ecd60e75c6a85c126e754aea", - "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/d47bbbad83711771f167c72d4e3f25f7fcc1f8b0", + "reference": "d47bbbad83711771f167c72d4e3f25f7fcc1f8b0", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0" + "php": ">=7.1" }, "require-dev": { - "phpunit/phpunit": "^4.8 || ^5.0" + "phpunit/phpunit": "^7.5" + }, + "suggest": { + "ext-posix": "*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3.x-dev" + "dev-master": "4.2-dev" } }, "autoload": { @@ -715,34 +1114,44 @@ "environment", "hhvm" ], - "time": "2016-08-18 05:49:44" + "support": { + "issues": "https://github.com/sebastianbergmann/environment/issues", + "source": "https://github.com/sebastianbergmann/environment/tree/4.2.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T07:53:42+00:00" }, { "name": "sebastian/exporter", - "version": "1.2.2", + "version": "3.1.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4" + "reference": "0c32ea2e40dbf59de29f3b49bf375176ce7dd8db" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/42c4c2eec485ee3e159ec9884f95b431287edde4", - "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/0c32ea2e40dbf59de29f3b49bf375176ce7dd8db", + "reference": "0c32ea2e40dbf59de29f3b49bf375176ce7dd8db", "shasum": "" }, "require": { - "php": ">=5.3.3", - "sebastian/recursion-context": "~1.0" + "php": ">=7.0", + "sebastian/recursion-context": "^3.0" }, "require-dev": { "ext-mbstring": "*", - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^8.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3.x-dev" + "dev-master": "3.1.x-dev" } }, "autoload": { @@ -755,6 +1164,10 @@ "BSD-3-Clause" ], "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, { "name": "Jeff Welch", "email": "whatthejeff@gmail.com" @@ -763,17 +1176,13 @@ "name": "Volker Dusch", "email": "github@wallbash.com" }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, { "name": "Adam Harvey", "email": "aharvey@php.net" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" } ], "description": "Provides the functionality to export PHP variables for visualization", @@ -782,27 +1191,40 @@ "export", "exporter" ], - "time": "2016-06-17 09:04:28" + "support": { + "issues": "https://github.com/sebastianbergmann/exporter/issues", + "source": "https://github.com/sebastianbergmann/exporter/tree/3.1.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2021-11-11T13:51:24+00:00" }, { "name": "sebastian/global-state", - "version": "1.1.1", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" + "reference": "de036ec91d55d2a9e0db2ba975b512cdb1c23921" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/de036ec91d55d2a9e0db2ba975b512cdb1c23921", + "reference": "de036ec91d55d2a9e0db2ba975b512cdb1c23921", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.2", + "sebastian/object-reflector": "^1.1.1", + "sebastian/recursion-context": "^3.0" }, "require-dev": { - "phpunit/phpunit": "~4.2" + "ext-dom": "*", + "phpunit/phpunit": "^8.0" }, "suggest": { "ext-uopz": "*" @@ -810,7 +1232,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -833,32 +1255,154 @@ "keywords": [ "global state" ], - "time": "2015-10-12 03:26:01" + "support": { + "issues": "https://github.com/sebastianbergmann/global-state/issues", + "source": "https://github.com/sebastianbergmann/global-state/tree/3.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2022-02-10T06:55:38+00:00" + }, + { + "name": "sebastian/object-enumerator", + "version": "3.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2", + "reference": "e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2", + "shasum": "" + }, + "require": { + "php": ">=7.0", + "sebastian/object-reflector": "^1.1.1", + "sebastian/recursion-context": "^3.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "support": { + "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/3.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T07:40:27+00:00" + }, + { + "name": "sebastian/object-reflector", + "version": "1.1.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "9b8772b9cbd456ab45d4a598d2dd1a1bced6363d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/9b8772b9cbd456ab45d4a598d2dd1a1bced6363d", + "reference": "9b8772b9cbd456ab45d4a598d2dd1a1bced6363d", + "shasum": "" + }, + "require": { + "php": ">=7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "support": { + "issues": "https://github.com/sebastianbergmann/object-reflector/issues", + "source": "https://github.com/sebastianbergmann/object-reflector/tree/1.1.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T07:37:18+00:00" }, { "name": "sebastian/recursion-context", - "version": "1.0.5", + "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7" + "reference": "367dcba38d6e1977be014dc4b22f47a484dac7fb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/b19cc3298482a335a95f3016d2f8a6950f0fbcd7", - "reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/367dcba38d6e1977be014dc4b22f47a484dac7fb", + "reference": "367dcba38d6e1977be014dc4b22f47a484dac7fb", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.0" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "3.0.x-dev" } }, "autoload": { @@ -871,14 +1415,14 @@ "BSD-3-Clause" ], "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, { "name": "Adam Harvey", "email": "aharvey@php.net" @@ -886,23 +1430,149 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2016-10-03 07:41:43" + "support": { + "issues": "https://github.com/sebastianbergmann/recursion-context/issues", + "source": "https://github.com/sebastianbergmann/recursion-context/tree/3.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T07:34:24+00:00" + }, + { + "name": "sebastian/resource-operations", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "31d35ca87926450c44eae7e2611d45a7a65ea8b3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/31d35ca87926450c44eae7e2611d45a7a65ea8b3", + "reference": "31d35ca87926450c44eae7e2611d45a7a65ea8b3", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides a list of PHP built-in functions that operate on resources", + "homepage": "https://www.github.com/sebastianbergmann/resource-operations", + "support": { + "issues": "https://github.com/sebastianbergmann/resource-operations/issues", + "source": "https://github.com/sebastianbergmann/resource-operations/tree/2.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T07:30:19+00:00" + }, + { + "name": "sebastian/type", + "version": "1.1.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/type.git", + "reference": "0150cfbc4495ed2df3872fb31b26781e4e077eb4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/0150cfbc4495ed2df3872fb31b26781e4e077eb4", + "reference": "0150cfbc4495ed2df3872fb31b26781e4e077eb4", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "require-dev": { + "phpunit/phpunit": "^8.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the types of the PHP type system", + "homepage": "https://github.com/sebastianbergmann/type", + "support": { + "issues": "https://github.com/sebastianbergmann/type/issues", + "source": "https://github.com/sebastianbergmann/type/tree/1.1.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T07:25:11+00:00" }, { "name": "sebastian/version", - "version": "1.0.6", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", - "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6" + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", - "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", "shasum": "" }, + "require": { + "php": ">=5.6" + }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, "autoload": { "classmap": [ "src/" @@ -921,24 +1591,31 @@ ], "description": "Library that helps with managing the version number of Git-hosted PHP projects", "homepage": "https://github.com/sebastianbergmann/version", - "time": "2015-06-21 13:59:46" + "support": { + "issues": "https://github.com/sebastianbergmann/version/issues", + "source": "https://github.com/sebastianbergmann/version/tree/master" + }, + "time": "2016-10-03T07:35:21+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.12.0", + "version": "v1.25.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "550ebaac289296ce228a706d0867afc34687e3f4" + "reference": "30885182c981ab175d4d034db0f6f469898070ab" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/550ebaac289296ce228a706d0867afc34687e3f4", - "reference": "550ebaac289296ce228a706d0867afc34687e3f4", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/30885182c981ab175d4d034db0f6f469898070ab", + "reference": "30885182c981ab175d4d034db0f6f469898070ab", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.1" + }, + "provide": { + "ext-ctype": "*" }, "suggest": { "ext-ctype": "For best performance" @@ -946,16 +1623,20 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.12-dev" + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -979,39 +1660,110 @@ "polyfill", "portable" ], - "time": "2019-08-06 08:03:45" + "support": { + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.25.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-10-20T20:35:02+00:00" }, { - "name": "symfony/yaml", - "version": "v2.8.50", + "name": "theseer/tokenizer", + "version": "1.2.1", "source": { "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "02c1859112aa779d9ab394ae4f3381911d84052b" + "url": "https://github.com/theseer/tokenizer.git", + "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/02c1859112aa779d9ab394ae4f3381911d84052b", - "reference": "02c1859112aa779d9ab394ae4f3381911d84052b", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e", + "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e", "shasum": "" }, "require": { - "php": ">=5.3.9", - "symfony/polyfill-ctype": "~1.8" + "ext-dom": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": "^7.2 || ^8.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + } + ], + "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", + "support": { + "issues": "https://github.com/theseer/tokenizer/issues", + "source": "https://github.com/theseer/tokenizer/tree/1.2.1" + }, + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } + ], + "time": "2021-07-28T10:34:58+00:00" + }, + { + "name": "webmozart/assert", + "version": "1.10.0", + "source": { + "type": "git", + "url": "https://github.com/webmozarts/assert.git", + "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/6964c76c7804814a842473e0c8fd15bab0f18e25", + "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0", + "symfony/polyfill-ctype": "^1.8" + }, + "conflict": { + "phpstan/phpstan": "<0.12.20", + "vimeo/psalm": "<4.6.1 || 4.6.2" + }, + "require-dev": { + "phpunit/phpunit": "^8.5.13" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "1.10-dev" } }, "autoload": { "psr-4": { - "Symfony\\Component\\Yaml\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] + "Webmozart\\Assert\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1019,17 +1771,21 @@ ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" } ], - "description": "Symfony Yaml Component", - "homepage": "https://symfony.com", - "time": "2018-11-11 11:18:13" + "description": "Assertions to validate method input/output with nice error messages.", + "keywords": [ + "assert", + "check", + "validate" + ], + "support": { + "issues": "https://github.com/webmozarts/assert/issues", + "source": "https://github.com/webmozarts/assert/tree/1.10.0" + }, + "time": "2021-03-09T10:59:23+00:00" } ], "aliases": [], @@ -1038,12 +1794,13 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": ">=5.4", + "php": ">=7.2", "ext-dom": "*", "ext-iconv": "*" }, "platform-dev": [], "platform-overrides": { - "php": "5.4" - } + "php": "7.2" + }, + "plugin-api-version": "2.1.0" } diff --git a/vendor/imangazaliev/didom/src/DiDom/ClassAttribute.php b/vendor/imangazaliev/didom/src/DiDom/ClassAttribute.php index 16f0ef5..b85a6a9 100644 --- a/vendor/imangazaliev/didom/src/DiDom/ClassAttribute.php +++ b/vendor/imangazaliev/didom/src/DiDom/ClassAttribute.php @@ -1,5 +1,7 @@ isElementNode()) { - throw new InvalidArgumentException(sprintf('The element must contain DOMElement node')); + throw new InvalidArgumentException(sprintf('The element must contain DOMElement node.')); } $this->element = $element; @@ -96,12 +98,8 @@ protected function updateClassAttribute() * * @throws InvalidArgumentException if class name is not a string */ - public function add($className) + public function add(string $className): self { - if ( ! is_string($className)) { - throw new InvalidArgumentException(sprintf('%s expects parameter 1 to be string, %s given', __METHOD__, (is_object($className) ? get_class($className) : gettype($className)))); - } - $this->parseClassAttribute(); if (in_array($className, $this->classes, true)) { @@ -122,13 +120,13 @@ public function add($className) * * @throws InvalidArgumentException if class name is not a string */ - public function addMultiple(array $classNames) + public function addMultiple(array $classNames): self { $this->parseClassAttribute(); foreach ($classNames as $className) { if ( ! is_string($className)) { - throw new InvalidArgumentException(sprintf('Class name must be a string, %s given', (is_object($className) ? get_class($className) : gettype($className)))); + throw new InvalidArgumentException(sprintf('Class name must be a string, %s given.', (is_object($className) ? get_class($className) : gettype($className)))); } if (in_array($className, $this->classes, true)) { @@ -146,7 +144,7 @@ public function addMultiple(array $classNames) /** * @return string[] */ - public function getAll() + public function getAll(): array { $this->parseClassAttribute(); @@ -158,12 +156,8 @@ public function getAll() * * @return bool */ - public function contains($className) + public function contains(string $className): bool { - if ( ! is_string($className)) { - throw new InvalidArgumentException(sprintf('%s expects parameter 1 to be string, %s given', __METHOD__, (is_object($className) ? get_class($className) : gettype($className)))); - } - $this->parseClassAttribute(); return in_array($className, $this->classes, true); @@ -176,12 +170,8 @@ public function contains($className) * * @throws InvalidArgumentException if class name is not a string */ - public function remove($className) + public function remove(string $className): self { - if ( ! is_string($className)) { - throw new InvalidArgumentException(sprintf('%s expects parameter 1 to be string, %s given', __METHOD__, (is_object($className) ? get_class($className) : gettype($className)))); - } - $this->parseClassAttribute(); $classIndex = array_search($className, $this->classes); @@ -204,13 +194,13 @@ public function remove($className) * * @throws InvalidArgumentException if class name is not a string */ - public function removeMultiple(array $classNames) + public function removeMultiple(array $classNames): self { $this->parseClassAttribute(); foreach ($classNames as $className) { if ( ! is_string($className)) { - throw new InvalidArgumentException(sprintf('Class name must be a string, %s given', (is_object($className) ? get_class($className) : gettype($className)))); + throw new InvalidArgumentException(sprintf('Class name must be a string, %s given.', (is_object($className) ? get_class($className) : gettype($className)))); } $classIndex = array_search($className, $this->classes); @@ -228,19 +218,19 @@ public function removeMultiple(array $classNames) } /** - * @param string[] $exclusions + * @param string[] $preserved * * @return ClassAttribute */ - public function removeAll(array $exclusions = []) + public function removeAll(array $preserved = []): self { $this->parseClassAttribute(); $preservedClasses = []; - foreach ($exclusions as $className) { + foreach ($preserved as $className) { if ( ! is_string($className)) { - throw new InvalidArgumentException(sprintf('Class name must be a string, %s given', (is_object($className) ? get_class($className) : gettype($className)))); + throw new InvalidArgumentException(sprintf('Class name must be a string, %s given.', (is_object($className) ? get_class($className) : gettype($className)))); } if ( ! in_array($className, $this->classes, true)) { @@ -260,7 +250,7 @@ public function removeAll(array $exclusions = []) /** * @return Element */ - public function getElement() + public function getElement(): Element { return $this->element; } diff --git a/vendor/imangazaliev/didom/src/DiDom/Document.php b/vendor/imangazaliev/didom/src/DiDom/Document.php index 614c27d..ca032de 100644 --- a/vendor/imangazaliev/didom/src/DiDom/Document.php +++ b/vendor/imangazaliev/didom/src/DiDom/Document.php @@ -1,5 +1,7 @@ document = $string; @@ -63,10 +65,6 @@ public function __construct($string = null, $isFile = false, $encoding = 'UTF-8' return; } - if ( ! is_string($encoding)) { - throw new InvalidArgumentException(sprintf('%s expects parameter 3 to be string, %s given', __METHOD__, gettype($encoding))); - } - $this->encoding = $encoding; $this->document = new DOMDocument('1.0', $encoding); @@ -81,14 +79,14 @@ public function __construct($string = null, $isFile = false, $encoding = 'UTF-8' /** * Creates a new document. * - * @param string|null $string An HTML or XML string or a file path + * @param DOMDocument|string|null $string An HTML or XML string, a file path or a DOMDocument instance * @param bool $isFile Indicates that the first parameter is a path to a file * @param string $encoding The document encoding * @param string $type The document type * * @return Document */ - public static function create($string = null, $isFile = false, $encoding = 'UTF-8', $type = Document::TYPE_HTML) + public static function create($string = null, bool $isFile = false, string $encoding = 'UTF-8', string $type = Document::TYPE_HTML) { return new Document($string, $isFile, $encoding, $type); } @@ -102,7 +100,7 @@ public static function create($string = null, $isFile = false, $encoding = 'UTF- * * @return Element created element */ - public function createElement($name, $value = null, array $attributes = []) + public function createElement(string $name, ?string $value = null, array $attributes = []): Element { $node = $this->document->createElement($name); @@ -120,7 +118,7 @@ public function createElement($name, $value = null, array $attributes = []) * * @throws InvalidSelectorException */ - public function createElementBySelector($selector, $value = null, array $attributes = []) + public function createElementBySelector(string $selector, ?string $value = null, array $attributes = []): Element { $segments = Query::getSegments($selector); @@ -146,7 +144,7 @@ public function createElementBySelector($selector, $value = null, array $attribu * * @return Element */ - public function createTextNode($content) + public function createTextNode(string $content): Element { return new Element(new DOMText($content)); } @@ -156,7 +154,7 @@ public function createTextNode($content) * * @return Element */ - public function createComment($data) + public function createComment(string $data): Element { return new Element(new DOMComment($data)); } @@ -166,7 +164,7 @@ public function createComment($data) * * @return Element */ - public function createCdataSection($data) + public function createCdataSection(string $data): Element { return new Element(new DOMCdataSection($data)); } @@ -174,7 +172,7 @@ public function createCdataSection($data) /** * @return DocumentFragment */ - public function createDocumentFragment() + public function createDocumentFragment(): DocumentFragment { return new DocumentFragment($this->document->createDocumentFragment()); } @@ -206,7 +204,7 @@ public function appendChild($nodes) } if ( ! $node instanceof DOMNode) { - throw new InvalidArgumentException(sprintf('Argument 1 passed to %s must be an instance of %s\Element or DOMNode, %s given', __METHOD__, __NAMESPACE__, (is_object($node) ? get_class($node) : gettype($node)))); + throw new InvalidArgumentException(sprintf('Argument 1 passed to %s must be an instance of %s\Element or DOMNode, %s given.', __METHOD__, __NAMESPACE__, (is_object($node) ? get_class($node) : gettype($node)))); } Errors::disable(); @@ -233,12 +231,8 @@ public function appendChild($nodes) * * @return Document */ - public function preserveWhiteSpace($value = true) + public function preserveWhiteSpace(bool $value = true): self { - if ( ! is_bool($value)) { - throw new InvalidArgumentException(sprintf('%s expects parameter 1 to be boolean, %s given', __METHOD__, gettype($value))); - } - $this->document->preserveWhiteSpace = $value; return $this; @@ -252,25 +246,15 @@ public function preserveWhiteSpace($value = true) * @param string $type The type of a document * @param int|null $options libxml option constants * - * @return Document - * * @throws InvalidArgumentException if parameter 1 is not a string * @throws InvalidArgumentException if parameter 3 is not a string * @throws InvalidArgumentException if parameter 4 is not an integer or null * @throws RuntimeException if the document type is invalid (not Document::TYPE_HTML or Document::TYPE_XML) */ - public function load($string, $isFile = false, $type = Document::TYPE_HTML, $options = null) + public function load(string $string, bool $isFile = false, string $type = Document::TYPE_HTML, int $options = null): void { - if ( ! is_string($string)) { - throw new InvalidArgumentException(sprintf('%s expects parameter 1 to be string, %s given', __METHOD__, (is_object($string) ? get_class($string) : gettype($string)))); - } - - if ( ! is_string($type)) { - throw new InvalidArgumentException(sprintf('%s expects parameter 3 to be string, %s given', __METHOD__, (is_object($type) ? get_class($type) : gettype($type)))); - } - if ( ! in_array(strtolower($type), [Document::TYPE_HTML, Document::TYPE_XML], true)) { - throw new RuntimeException(sprintf('Document type must be "xml" or "html", %s given', $type)); + throw new RuntimeException(sprintf('Document type must be "xml" or "html", %s given.', $type)); } if ($options === null) { @@ -278,10 +262,6 @@ public function load($string, $isFile = false, $type = Document::TYPE_HTML, $opt $options = LIBXML_HTML_NODEFDTD; } - if ( ! is_int($options)) { - throw new InvalidArgumentException(sprintf('%s expects parameter 4 to be integer, %s given', __METHOD__, (is_object($options) ? get_class($options) : gettype($options)))); - } - $string = trim($string); if ($isFile) { @@ -303,8 +283,6 @@ public function load($string, $isFile = false, $type = Document::TYPE_HTML, $opt } Errors::restore(); - - return $this; } /** @@ -317,9 +295,9 @@ public function load($string, $isFile = false, $type = Document::TYPE_HTML, $opt * * @throws InvalidArgumentException if parameter 1 is not a string */ - public function loadHtml($html, $options = null) + public function loadHtml(string $html, ?int $options = null): void { - return $this->load($html, false, Document::TYPE_HTML, $options); + $this->load($html, false, Document::TYPE_HTML, $options); } /** @@ -328,15 +306,13 @@ public function loadHtml($html, $options = null) * @param string $filename The path to the HTML file * @param int|null $options Additional parameters * - * @return Document - * * @throws InvalidArgumentException if parameter 1 not a string * @throws RuntimeException if the file doesn't exist * @throws RuntimeException if you are unable to load the file */ - public function loadHtmlFile($filename, $options = null) + public function loadHtmlFile(string $filename, ?int $options = null): void { - return $this->load($filename, true, Document::TYPE_HTML, $options); + $this->load($filename, true, Document::TYPE_HTML, $options); } /** @@ -345,13 +321,11 @@ public function loadHtmlFile($filename, $options = null) * @param string $xml The XML string * @param int|null $options Additional parameters * - * @return Document - * * @throws InvalidArgumentException if parameter 1 is not a string */ - public function loadXml($xml, $options = null) + public function loadXml(string $xml, ?int $options = null): void { - return $this->load($xml, false, Document::TYPE_XML, $options); + $this->load($xml, false, Document::TYPE_XML, $options); } /** @@ -360,15 +334,13 @@ public function loadXml($xml, $options = null) * @param string $filename The path to the XML file * @param int|null $options Additional parameters * - * @return Document - * * @throws InvalidArgumentException if the file path is not a string * @throws RuntimeException if the file doesn't exist * @throws RuntimeException if you are unable to load the file */ - public function loadXmlFile($filename, $options = null) + public function loadXmlFile(string $filename, ?int $options = null): void { - return $this->load($filename, true, Document::TYPE_XML, $options); + $this->load($filename, true, Document::TYPE_XML, $options); } /** @@ -381,20 +353,16 @@ public function loadXmlFile($filename, $options = null) * @throws InvalidArgumentException if parameter 1 is not a string * @throws RuntimeException if an error occurred */ - protected function loadFile($filename) + protected function loadFile(string $filename): string { - if ( ! is_string($filename)) { - throw new InvalidArgumentException(sprintf('%s expects parameter 1 to be string, %s given', __METHOD__, gettype($filename))); - } - try { $content = file_get_contents($filename); } catch (Exception $exception) { - throw new RuntimeException(sprintf('Could not load file %s', $filename)); + throw new RuntimeException(sprintf('Could not load file %s.', $filename)); } if ($content === false) { - throw new RuntimeException(sprintf('Could not load file %s', $filename)); + throw new RuntimeException(sprintf('Could not load file %s.', $filename)); } return $content; @@ -408,7 +376,7 @@ protected function loadFile($filename) * * @return bool */ - public function has($expression, $type = Query::TYPE_CSS) + public function has(string $expression, string $type = Query::TYPE_CSS): bool { $expression = Query::compile($expression, $type); $expression = sprintf('count(%s) > 0', $expression); @@ -422,14 +390,14 @@ public function has($expression, $type = Query::TYPE_CSS) * @param string $expression XPath expression or a CSS selector * @param string $type The type of the expression * @param bool $wrapNode Returns array of Element if true, otherwise array of DOMElement - * @param DOMElement|null $contextNode The node in which the search will be performed + * @param Element|DOMElement|null $contextNode The node in which the search will be performed * * @return Element[]|DOMElement[] * * @throws InvalidSelectorException if the selector is invalid * @throws InvalidArgumentException if context node is not DOMElement */ - public function find($expression, $type = Query::TYPE_CSS, $wrapNode = true, $contextNode = null) + public function find(string $expression, string $type = Query::TYPE_CSS, bool $wrapNode = true, $contextNode = null): array { $expression = Query::compile($expression, $type); @@ -439,7 +407,7 @@ public function find($expression, $type = Query::TYPE_CSS, $wrapNode = true, $co } if ( ! $contextNode instanceof DOMElement) { - throw new InvalidArgumentException(sprintf('Argument 4 passed to %s must be an instance of %s\Element or DOMElement, %s given', __METHOD__, __NAMESPACE__, (is_object($contextNode) ? get_class($contextNode) : gettype($contextNode)))); + throw new InvalidArgumentException(sprintf('Argument 4 passed to %s must be an instance of %s\Element or DOMElement, %s given.', __METHOD__, __NAMESPACE__, (is_object($contextNode) ? get_class($contextNode) : gettype($contextNode)))); } if ($type === Query::TYPE_CSS) { @@ -470,13 +438,13 @@ public function find($expression, $type = Query::TYPE_CSS, $wrapNode = true, $co * @param string $expression XPath expression or a CSS selector * @param string $type The type of the expression * @param bool $wrapNode Returns array of Element if true, otherwise array of DOMElement - * @param DOMElement|null $contextNode The node in which the search will be performed + * @param Element|DOMElement|null $contextNode The node in which the search will be performed * * @return Element|DOMElement|null * * @throws InvalidSelectorException if the selector is invalid */ - public function first($expression, $type = Query::TYPE_CSS, $wrapNode = true, $contextNode = null) + public function first(string $expression, string $type = Query::TYPE_CSS, bool $wrapNode = true, $contextNode = null) { $expression = Query::compile($expression, $type); @@ -517,7 +485,7 @@ protected function wrapNode($node) return $node->value; } - throw new InvalidArgumentException(sprintf('Unknown node type "%s"', get_class($node))); + throw new InvalidArgumentException(sprintf('Unknown node type "%s".', get_class($node))); } /** @@ -525,11 +493,11 @@ protected function wrapNode($node) * * @param string $expression XPath expression * @param bool $wrapNode Returns array of Element if true, otherwise array of DOMElement - * @param DOMElement $contextNode The node in which the search will be performed + * @param Element|DOMElement $contextNode The node in which the search will be performed * * @return Element[]|DOMElement[] */ - public function xpath($expression, $wrapNode = true, $contextNode = null) + public function xpath(string $expression, bool $wrapNode = true, $contextNode = null): array { return $this->find($expression, Query::TYPE_XPATH, $wrapNode, $contextNode); } @@ -544,7 +512,7 @@ public function xpath($expression, $wrapNode = true, $contextNode = null) * * @throws InvalidSelectorException */ - public function count($expression, $type = Query::TYPE_CSS) + public function count(string $expression, string $type = Query::TYPE_CSS): int { $expression = Query::compile($expression, $type); $expression = sprintf('count(%s)', $expression); @@ -555,7 +523,7 @@ public function count($expression, $type = Query::TYPE_CSS) /** * @return DOMXPath */ - public function createXpath() + public function createXpath(): DOMXPath { $xpath = new DOMXPath($this->document); @@ -574,16 +542,8 @@ public function createXpath() * @param string $prefix * @param string $namespace */ - public function registerNamespace($prefix, $namespace) + public function registerNamespace(string $prefix, string $namespace) { - if ( ! is_string($prefix)) { - throw new InvalidArgumentException(sprintf('%s expects parameter 2 to be string, %s given', __METHOD__, (is_object($prefix) ? get_class($prefix) : gettype($prefix)))); - } - - if ( ! is_string($namespace)) { - throw new InvalidArgumentException(sprintf('%s expects parameter 2 to be string, %s given', __METHOD__, (is_object($namespace) ? get_class($namespace) : gettype($namespace)))); - } - $this->namespaces[$prefix] = $namespace; } @@ -592,7 +552,7 @@ public function registerNamespace($prefix, $namespace) * * @return string The document html */ - public function html() + public function html(): string { return trim($this->document->saveHTML($this->document)); } @@ -600,11 +560,11 @@ public function html() /** * Dumps the internal document into a string using XML formatting. * - * @param int $options Additional options + * @param int|null $options Additional options * * @return string The document xml */ - public function xml($options = 0) + public function xml(?int $options = 0): string { return trim($this->document->saveXML($this->document, $options)); } @@ -616,12 +576,8 @@ public function xml($options = 0) * * @return Document */ - public function format($format = true) + public function format(bool $format = true): self { - if ( ! is_bool($format)) { - throw new InvalidArgumentException(sprintf('%s expects parameter 1 to be boolean, %s given', __METHOD__, gettype($format))); - } - $this->document->formatOutput = $format; return $this; @@ -632,7 +588,7 @@ public function format($format = true) * * @return string */ - public function text() + public function text(): string { return $this->getElement()->textContent; } @@ -646,13 +602,13 @@ public function text() * * @throws InvalidArgumentException if parameter 1 is not an instance of DOMDocument or Document */ - public function is($document) + public function is($document): bool { if ($document instanceof Document) { $element = $document->getElement(); } else { if ( ! $document instanceof DOMDocument) { - throw new InvalidArgumentException(sprintf('Argument 1 passed to %s must be an instance of %s or DOMDocument, %s given', __METHOD__, __CLASS__, (is_object($document) ? get_class($document) : gettype($document)))); + throw new InvalidArgumentException(sprintf('Argument 1 passed to %s must be an instance of %s or DOMDocument, %s given.', __METHOD__, __CLASS__, (is_object($document) ? get_class($document) : gettype($document)))); } $element = $document->documentElement; @@ -668,9 +624,9 @@ public function is($document) /** * Returns the type of the document (XML or HTML). * - * @return string + * @return string|null */ - public function getType() + public function getType(): ?string { return $this->type; } @@ -678,9 +634,9 @@ public function getType() /** * Returns the encoding of the document. * - * @return string + * @return string|null */ - public function getEncoding() + public function getEncoding(): ?string { return $this->encoding; } @@ -688,15 +644,15 @@ public function getEncoding() /** * @return DOMDocument */ - public function getDocument() + public function getDocument(): DOMDocument { return $this->document; } /** - * @return DOMElement + * @return DOMElement|null */ - public function getElement() + public function getElement(): ?DOMElement { return $this->document->documentElement; } @@ -704,10 +660,10 @@ public function getElement() /** * @return Element */ - public function toElement() + public function toElement(): Element { if ($this->document->documentElement === null) { - throw new RuntimeException('Cannot convert empty document to Element'); + throw new RuntimeException('Cannot convert empty document to Element.'); } return new Element($this->document->documentElement); @@ -718,27 +674,8 @@ public function toElement() * * @return string */ - public function __toString() + public function __toString(): string { return $this->type === Document::TYPE_HTML ? $this->html() : $this->xml(); } - - /** - * Searches for a node in the DOM tree for a given XPath expression or CSS selector. - * - * @param string $expression XPath expression or a CSS selector - * @param string $type The type of the expression - * @param bool $wrapNode Returns array of Element if true, otherwise array of DOMElement - * @param DOMElement|null $contextNode The node in which the search will be performed - * - * @return Element[]|DOMElement[] - * - * @throws InvalidSelectorException - * - * @deprecated Not longer recommended, use Document::find() instead. - */ - public function __invoke($expression, $type = Query::TYPE_CSS, $wrapNode = true, $contextNode = null) - { - return $this->find($expression, $type, $wrapNode, $contextNode); - } } diff --git a/vendor/imangazaliev/didom/src/DiDom/DocumentFragment.php b/vendor/imangazaliev/didom/src/DiDom/DocumentFragment.php index 35c615f..3b30314 100644 --- a/vendor/imangazaliev/didom/src/DiDom/DocumentFragment.php +++ b/vendor/imangazaliev/didom/src/DiDom/DocumentFragment.php @@ -1,9 +1,10 @@ setNode($documentFragment); } diff --git a/vendor/imangazaliev/didom/src/DiDom/Element.php b/vendor/imangazaliev/didom/src/DiDom/Element.php index 770c755..434cff1 100644 --- a/vendor/imangazaliev/didom/src/DiDom/Element.php +++ b/vendor/imangazaliev/didom/src/DiDom/Element.php @@ -1,5 +1,7 @@ createElementBySelector($selector, $value, $attributes); } + public function tagName(): string + { + return $this->node->tagName; + } + /** * Checks that the node matches selector. * @@ -96,12 +100,8 @@ public static function createBySelector($selector, $value = null, array $attribu * @throws InvalidArgumentException if the tag name is not a string * @throws RuntimeException if the tag name is not specified in strict mode */ - public function matches($selector, $strict = false) + public function matches(string $selector, bool $strict = false): bool { - if ( ! is_string($selector)) { - throw new InvalidArgumentException(sprintf('%s expects parameter 1 to be string, %s given', __METHOD__, gettype($selector))); - } - if ( ! $this->node instanceof DOMElement) { return false; } @@ -129,7 +129,7 @@ public function matches($selector, $strict = false) throw new RuntimeException(sprintf('Tag name must be specified in %s', $selector)); } - if ($segments['tag'] !== $this->tag && $segments['tag'] !== '*') { + if ($segments['tag'] !== $this->tagName() && $segments['tag'] !== '*') { return false; } @@ -174,7 +174,7 @@ public function matches($selector, $strict = false) * * @return bool */ - public function hasAttribute($name) + public function hasAttribute(string $name): bool { return $this->node->hasAttribute($name); } @@ -183,18 +183,18 @@ public function hasAttribute($name) * Set an attribute on the element. * * @param string $name The name of an attribute - * @param string $value The value of an attribute + * @param string|integer|float $value The value of an attribute * * @return Element */ - public function setAttribute($name, $value) + public function setAttribute(string $name, $value): Element { if (is_numeric($value)) { $value = (string) $value; } - if ( ! is_string($value) && $value !== null) { - throw new InvalidArgumentException(sprintf('%s expects parameter 2 to be string or null, %s given', __METHOD__, (is_object($value) ? get_class($value) : gettype($value)))); + if ( ! is_string($value)) { + throw new InvalidArgumentException(sprintf('%s expects parameter 2 to be string or null, %s given.', __METHOD__, (is_object($value) ? get_class($value) : gettype($value)))); } $this->node->setAttribute($name, $value); @@ -210,7 +210,7 @@ public function setAttribute($name, $value) * * @return string|null The value of an attribute or null if attribute doesn't exist */ - public function getAttribute($name, $default = null) + public function getAttribute(string $name, ?string $default = null): ?string { if ($this->hasAttribute($name)) { return $this->node->getAttribute($name); @@ -226,7 +226,7 @@ public function getAttribute($name, $default = null) * * @return Element */ - public function removeAttribute($name) + public function removeAttribute(string $name): self { $this->node->removeAttribute($name); @@ -236,18 +236,18 @@ public function removeAttribute($name) /** * Unset all attributes of the element. * - * @param string[] $exclusions + * @param string[] $preserved * * @return Element */ - public function removeAllAttributes(array $exclusions = []) + public function removeAllAttributes(array $preserved = []): self { if ( ! $this->node instanceof DOMElement) { return $this; } foreach ($this->attributes() as $name => $value) { - if (in_array($name, $exclusions, true)) { + if (in_array($name, $preserved, true)) { continue; } @@ -265,7 +265,7 @@ public function removeAllAttributes(array $exclusions = []) * * @return string|null|Element */ - public function attr($name, $value = null) + public function attr(string $name, ?string $value = null) { if ($value === null) { return $this->getAttribute($name); @@ -281,7 +281,7 @@ public function attr($name, $value = null) * * @return array|null */ - public function attributes(array $names = null) + public function attributes(array $names = null): ?array { if ( ! $this->node instanceof DOMElement) { return null; @@ -313,14 +313,14 @@ public function attributes(array $names = null) * * @throws LogicException if the node is not an instance of DOMElement */ - public function classes() + public function classes(): ClassAttribute { if ($this->classAttribute !== null) { return $this->classAttribute; } if ( ! $this->isElementNode()) { - throw new LogicException('Class attribute is available only for element nodes'); + throw new LogicException('Class attribute is available only for element nodes.'); } $this->classAttribute = new ClassAttribute($this); @@ -333,14 +333,14 @@ public function classes() * * @throws LogicException if the node is not an instance of DOMElement */ - public function style() + public function style(): StyleAttribute { if ($this->styleAttribute !== null) { return $this->styleAttribute; } if ( ! $this->isElementNode()) { - throw new LogicException('Style attribute is available only for element nodes'); + throw new LogicException('Style attribute is available only for element nodes.'); } $this->styleAttribute = new StyleAttribute($this); @@ -352,11 +352,11 @@ public function style() * Dynamically set an attribute on the element. * * @param string $name The name of an attribute - * @param string $value The value of an attribute + * @param string|integer|float $value The value of an attribute * * @return Element */ - public function __set($name, $value) + public function __set(string $name, $value) { return $this->setAttribute($name, $value); } @@ -368,12 +368,8 @@ public function __set($name, $value) * * @return string|null */ - public function __get($name) + public function __get(string $name): ?string { - if ($name === 'tag') { - return $this->node->tagName; - } - return $this->getAttribute($name); } @@ -384,7 +380,7 @@ public function __get($name) * * @return bool */ - public function __isset($name) + public function __isset(string $name): bool { return $this->hasAttribute($name); } @@ -394,7 +390,7 @@ public function __isset($name) * * @param string $name The name of an attribute */ - public function __unset($name) + public function __unset(string $name) { $this->removeAttribute($name); } diff --git a/vendor/imangazaliev/didom/src/DiDom/Encoder.php b/vendor/imangazaliev/didom/src/DiDom/Encoder.php index d44c50f..155986e 100644 --- a/vendor/imangazaliev/didom/src/DiDom/Encoder.php +++ b/vendor/imangazaliev/didom/src/DiDom/Encoder.php @@ -1,5 +1,7 @@ node->ownerDocument === null) { - throw new LogicException('Can not prepend a child to element without the owner document'); + throw new LogicException('Can not prepend a child to element without the owner document.'); } $returnArray = true; @@ -78,7 +80,7 @@ public function prependChild($nodes) public function appendChild($nodes) { if ($this->node->ownerDocument === null) { - throw new LogicException('Can not append a child to element without the owner document'); + throw new LogicException('Can not append a child to element without the owner document.'); } $returnArray = true; @@ -99,7 +101,7 @@ public function appendChild($nodes) } if ( ! $node instanceof DOMNode) { - throw new InvalidArgumentException(sprintf('Argument 1 passed to %s must be an instance of %s or DOMNode, %s given', __METHOD__, __CLASS__, (is_object($node) ? get_class($node) : gettype($node)))); + throw new InvalidArgumentException(sprintf('Argument 1 passed to %s must be an instance of %s or DOMNode, %s given.', __METHOD__, __CLASS__, (is_object($node) ? get_class($node) : gettype($node)))); } $clonedNode = $node->cloneNode(true); @@ -129,10 +131,10 @@ public function appendChild($nodes) * @throws InvalidArgumentException if $node is not an instance of DOMNode or Element * @throws InvalidArgumentException if $referenceNode is not an instance of DOMNode or Element */ - public function insertBefore($node, $referenceNode = null) + public function insertBefore($node, $referenceNode = null): self { if ($this->node->ownerDocument === null) { - throw new LogicException('Can not insert a child to an element without the owner document'); + throw new LogicException('Can not insert a child to an element without the owner document.'); } if ($node instanceof Node) { @@ -140,7 +142,7 @@ public function insertBefore($node, $referenceNode = null) } if ( ! $node instanceof DOMNode) { - throw new InvalidArgumentException(sprintf('Argument 1 passed to %s must be an instance of %s or DOMNode, %s given', __METHOD__, __CLASS__, (is_object($node) ? get_class($node) : gettype($node)))); + throw new InvalidArgumentException(sprintf('Argument 1 passed to %s must be an instance of %s or DOMNode, %s given.', __METHOD__, __CLASS__, (is_object($node) ? get_class($node) : gettype($node)))); } if ($referenceNode !== null) { @@ -149,7 +151,7 @@ public function insertBefore($node, $referenceNode = null) } if ( ! $referenceNode instanceof DOMNode) { - throw new InvalidArgumentException(sprintf('Argument 2 passed to %s must be an instance of %s or DOMNode, %s given', __METHOD__, __CLASS__, (is_object($referenceNode) ? get_class($referenceNode) : gettype($referenceNode)))); + throw new InvalidArgumentException(sprintf('Argument 2 passed to %s must be an instance of %s or DOMNode, %s given.', __METHOD__, __CLASS__, (is_object($referenceNode) ? get_class($referenceNode) : gettype($referenceNode)))); } } @@ -177,7 +179,7 @@ public function insertBefore($node, $referenceNode = null) * @throws InvalidArgumentException if $node is not an instance of DOMNode or Element * @throws InvalidArgumentException if $referenceNode is not an instance of DOMNode or Element */ - public function insertAfter($node, $referenceNode = null) + public function insertAfter($node, $referenceNode = null): self { if ($referenceNode === null) { return $this->insertBefore($node); @@ -188,7 +190,7 @@ public function insertAfter($node, $referenceNode = null) } if ( ! $referenceNode instanceof DOMNode) { - throw new InvalidArgumentException(sprintf('Argument 2 passed to %s must be an instance of %s or DOMNode, %s given', __METHOD__, __CLASS__, (is_object($referenceNode) ? get_class($referenceNode) : gettype($referenceNode)))); + throw new InvalidArgumentException(sprintf('Argument 2 passed to %s must be an instance of %s or DOMNode, %s given.', __METHOD__, __CLASS__, (is_object($referenceNode) ? get_class($referenceNode) : gettype($referenceNode)))); } return $this->insertBefore($node, $referenceNode->nextSibling); @@ -205,14 +207,14 @@ public function insertAfter($node, $referenceNode = null) * @throws InvalidArgumentException if $node is not an instance of DOMNode or Element * @throws InvalidArgumentException if $referenceNode is not an instance of DOMNode or Element */ - public function insertSiblingBefore($node) + public function insertSiblingBefore($node): self { if ($this->node->ownerDocument === null) { - throw new LogicException('Can not insert a child to an element without the owner document'); + throw new LogicException('Can not insert a child to an element without the owner document.'); } if ($this->parent() === null) { - throw new LogicException('Can not insert a child to an element without the parent element'); + throw new LogicException('Can not insert a child to an element without the parent element.'); } if ($node instanceof Node) { @@ -220,7 +222,7 @@ public function insertSiblingBefore($node) } if ( ! $node instanceof DOMNode) { - throw new InvalidArgumentException(sprintf('Argument 1 passed to %s must be an instance of %s or DOMNode, %s given', __METHOD__, __CLASS__, (is_object($node) ? get_class($node) : gettype($node)))); + throw new InvalidArgumentException(sprintf('Argument 1 passed to %s must be an instance of %s or DOMNode, %s given.', __METHOD__, __CLASS__, (is_object($node) ? get_class($node) : gettype($node)))); } Errors::disable(); @@ -246,14 +248,14 @@ public function insertSiblingBefore($node) * @throws InvalidArgumentException if $node is not an instance of DOMNode or Element * @throws InvalidArgumentException if $referenceNode is not an instance of DOMNode or Element */ - public function insertSiblingAfter($node) + public function insertSiblingAfter($node): self { if ($this->node->ownerDocument === null) { - throw new LogicException('Can not insert a child to an element without the owner document'); + throw new LogicException('Can not insert a child to an element without the owner document.'); } if ($this->parent() === null) { - throw new LogicException('Can not insert a child to an element without the parent element'); + throw new LogicException('Can not insert a child to an element without the parent element.'); } $nextSibling = $this->nextSibling(); @@ -274,7 +276,7 @@ public function insertSiblingAfter($node) * * @return bool */ - public function has($expression, $type = Query::TYPE_CSS) + public function has(string $expression, string $type = Query::TYPE_CSS): bool { return $this->toDocument()->has($expression, $type); } @@ -290,7 +292,7 @@ public function has($expression, $type = Query::TYPE_CSS) * * @throws InvalidSelectorException */ - public function find($expression, $type = Query::TYPE_CSS, $wrapElement = true) + public function find(string $expression, string $type = Query::TYPE_CSS, bool $wrapElement = true): array { return $this->toDocument()->find($expression, $type, $wrapElement); } @@ -307,12 +309,12 @@ public function find($expression, $type = Query::TYPE_CSS, $wrapElement = true) * @throws LogicException if the current node has no owner document * @throws InvalidSelectorException */ - public function findInDocument($expression, $type = Query::TYPE_CSS, $wrapNode = true) + public function findInDocument(string $expression, string $type = Query::TYPE_CSS, bool $wrapNode = true): array { - $ownerDocument = $this->getDocument(); + $ownerDocument = $this->ownerDocument(); if ($ownerDocument === null) { - throw new LogicException('Can not search in context without the owner document'); + throw new LogicException('Can not search in context without the owner document.'); } return $ownerDocument->find($expression, $type, $wrapNode, $this->node); @@ -329,7 +331,7 @@ public function findInDocument($expression, $type = Query::TYPE_CSS, $wrapNode = * * @throws InvalidSelectorException */ - public function first($expression, $type = Query::TYPE_CSS, $wrapNode = true) + public function first(string $expression, string $type = Query::TYPE_CSS, bool $wrapNode = true) { return $this->toDocument()->first($expression, $type, $wrapNode); } @@ -345,12 +347,12 @@ public function first($expression, $type = Query::TYPE_CSS, $wrapNode = true) * * @throws InvalidSelectorException */ - public function firstInDocument($expression, $type = Query::TYPE_CSS, $wrapNode = true) + public function firstInDocument(string $expression, string $type = Query::TYPE_CSS, bool $wrapNode = true) { - $ownerDocument = $this->getDocument(); + $ownerDocument = $this->ownerDocument(); if ($ownerDocument === null) { - throw new LogicException('Can not search in context without the owner document'); + throw new LogicException('Can not search in context without the owner document.'); } return $ownerDocument->first($expression, $type, $wrapNode, $this->node); @@ -366,7 +368,7 @@ public function firstInDocument($expression, $type = Query::TYPE_CSS, $wrapNode * * @throws InvalidSelectorException */ - public function xpath($expression, $wrapNode = true) + public function xpath(string $expression, bool $wrapNode = true): array { return $this->find($expression, Query::TYPE_XPATH, $wrapNode); } @@ -381,7 +383,7 @@ public function xpath($expression, $wrapNode = true) * * @throws InvalidSelectorException */ - public function count($expression, $type = Query::TYPE_CSS) + public function count(string $expression, string $type = Query::TYPE_CSS): int { return $this->toDocument()->count($expression, $type); } @@ -391,7 +393,7 @@ public function count($expression, $type = Query::TYPE_CSS) * * @return string */ - public function html() + public function html(): string { return $this->toDocument()->html(); } @@ -401,7 +403,7 @@ public function html() * * @return string */ - public function outerHtml() + public function outerHtml(): string { $document = new DOMDocument(); @@ -417,7 +419,7 @@ public function outerHtml() * * @return string */ - public function innerHtml($delimiter = '') + public function innerHtml(string $delimiter = ''): string { $innerHtml = []; @@ -435,7 +437,7 @@ public function innerHtml($delimiter = '') * * @return string */ - public function innerXml($delimiter = '') + public function innerXml(string $delimiter = ''): string { $innerXml = []; @@ -456,32 +458,46 @@ public function innerXml($delimiter = '') * @throws InvalidArgumentException if passed argument is not a string * @throws InvalidSelectorException */ - public function setInnerHtml($html) + public function setInnerHtml(string $html): self { - if ( ! is_string($html)) { - throw new InvalidArgumentException(sprintf('%s expects parameter 1 to be string, %s given', __METHOD__, (is_object($html) ? get_class($html) : gettype($html)))); - } + return $this->setContent($html, Document::TYPE_HTML); + } - $this->removeChildren(); + /** + * Sets inner HTML. + * + * @param string $xml + * + * @return static + * + * @throws InvalidArgumentException if passed argument is not a string + * @throws InvalidSelectorException + */ + public function setInnerXml(string $xml): self + { + return $this->setContent($xml, Document::TYPE_XML); + } - if ($html !== '') { - Errors::disable(); + protected function setContent(string $content, string $type): self + { + $this->removeChildren(); - $html = "$html"; + Errors::disable(); - $document = new Document($html); + $encoding = $this->ownerDocument()->getEncoding() ?? 'UTF-8'; - $fragment = $document->first('htmlfragment')->getNode(); + $document = new Document("$content", false, $encoding, $type); - foreach ($fragment->childNodes as $node) { - $newNode = $this->node->ownerDocument->importNode($node, true); + $fragment = $document->first('didom-fragment')->getNode(); - $this->node->appendChild($newNode); - } + foreach ($fragment->childNodes as $node) { + $newNode = $this->node->ownerDocument->importNode($node, true); - Errors::restore(); + $this->node->appendChild($newNode); } + Errors::restore(); + return $this; } @@ -492,7 +508,7 @@ public function setInnerHtml($html) * * @return string The node XML */ - public function xml($options = 0) + public function xml(int $options = 0): string { return $this->toDocument()->xml($options); } @@ -502,7 +518,7 @@ public function xml($options = 0) * * @return string The node value */ - public function text() + public function text(): string { return $this->node->textContent; } @@ -510,20 +526,20 @@ public function text() /** * Set the value of this node. * - * @param string $value The new value of the node + * @param string|integer|float $value The new value of the node * * @return static * * @throws InvalidArgumentException if parameter 1 is not a string */ - public function setValue($value) + public function setValue($value): self { if (is_numeric($value)) { $value = (string) $value; } - if ( ! is_string($value) && $value !== null) { - throw new InvalidArgumentException(sprintf('%s expects parameter 1 to be string, %s given', __METHOD__, (is_object($value) ? get_class($value) : gettype($value)))); + if ( ! is_string($value)) { + throw new InvalidArgumentException(sprintf('%s expects parameter 1 to be string, integer or float, %s given', __METHOD__, (is_object($value) ? get_class($value) : gettype($value)))); } $this->node->nodeValue = $value; @@ -536,7 +552,7 @@ public function setValue($value) * * @return bool */ - public function isElementNode() + public function isElementNode(): bool { return $this->node instanceof DOMElement; } @@ -546,7 +562,7 @@ public function isElementNode() * * @return bool */ - public function isTextNode() + public function isTextNode(): bool { return $this->node instanceof DOMText; } @@ -556,7 +572,7 @@ public function isTextNode() * * @return bool */ - public function isCommentNode() + public function isCommentNode(): bool { return $this->node instanceof DOMComment; } @@ -566,7 +582,7 @@ public function isCommentNode() * * @return bool */ - public function isCdataSectionNode() + public function isCdataSectionNode(): bool { return $this->node instanceof DOMCdataSection; } @@ -580,14 +596,14 @@ public function isCdataSectionNode() * * @throws InvalidArgumentException if parameter 1 is not an instance of DOMNode */ - public function is($node) + public function is($node): bool { if ($node instanceof Node) { $node = $node->getNode(); } if ( ! $node instanceof DOMNode) { - throw new InvalidArgumentException(sprintf('Argument 1 passed to %s must be an instance of %s or DOMNode, %s given', __METHOD__, __CLASS__, (is_object($node) ? get_class($node) : gettype($node)))); + throw new InvalidArgumentException(sprintf('Argument 1 passed to %s must be an instance of %s or DOMNode, %s given.', __METHOD__, __CLASS__, (is_object($node) ? get_class($node) : gettype($node)))); } return $this->node->isSameNode($node); @@ -619,7 +635,7 @@ public function parent() * * @throws InvalidSelectorException if the selector is invalid */ - public function closest($selector, $strict = false) + public function closest(string $selector, bool $strict = false): ?Element { $node = $this; @@ -636,8 +652,6 @@ public function closest($selector, $strict = false) $node = $parent; } - - return null; } /** @@ -651,7 +665,7 @@ public function closest($selector, $strict = false) * @throws LogicException if the selector used with non DOMElement node type * @throws InvalidSelectorException if the selector is invalid */ - public function previousSibling($selector = null, $nodeType = null) + public function previousSibling(?string $selector = null, ?string $nodeType = null): ?Element { if ($this->node->previousSibling === null) { return null; @@ -665,10 +679,6 @@ public function previousSibling($selector = null, $nodeType = null) $nodeType = 'DOMElement'; } - if ( ! is_string($nodeType)) { - throw new InvalidArgumentException(sprintf('%s expects parameter 2 to be string, %s given', __METHOD__, gettype($nodeType))); - } - $allowedTypes = ['DOMElement', 'DOMText', 'DOMComment', 'DOMCdataSection']; if ( ! in_array($nodeType, $allowedTypes, true)) { @@ -676,7 +686,7 @@ public function previousSibling($selector = null, $nodeType = null) } if ($selector !== null && $nodeType !== 'DOMElement') { - throw new LogicException(sprintf('Selector can be used only with DOMElement node type, %s given', $nodeType)); + throw new LogicException(sprintf('Selector can be used only with DOMElement node type, %s given.', $nodeType)); } $node = $this->node->previousSibling; @@ -711,7 +721,7 @@ public function previousSibling($selector = null, $nodeType = null) * @throws LogicException if the selector used with non DOMElement node type * @throws InvalidSelectorException if the selector is invalid */ - public function previousSiblings($selector = null, $nodeType = null) + public function previousSiblings(?string $selector = null, ?string $nodeType = null): array { if ($this->node->previousSibling === null) { return []; @@ -722,10 +732,6 @@ public function previousSiblings($selector = null, $nodeType = null) } if ($nodeType !== null) { - if ( ! is_string($nodeType)) { - throw new InvalidArgumentException(sprintf('%s expects parameter 2 to be string, %s given', __METHOD__, gettype($nodeType))); - } - $allowedTypes = ['DOMElement', 'DOMText', 'DOMComment', 'DOMCdataSection']; if ( ! in_array($nodeType, $allowedTypes, true)) { @@ -734,7 +740,7 @@ public function previousSiblings($selector = null, $nodeType = null) } if ($selector !== null && $nodeType !== 'DOMElement') { - throw new LogicException(sprintf('Selector can be used only with DOMElement node type, %s given', $nodeType)); + throw new LogicException(sprintf('Selector can be used only with DOMElement node type, %s given.', $nodeType)); } $result = []; @@ -787,7 +793,7 @@ public function previousSiblings($selector = null, $nodeType = null) * @throws LogicException if the selector used with non DOMElement node type * @throws InvalidSelectorException if the selector is invalid */ - public function nextSibling($selector = null, $nodeType = null) + public function nextSibling(?string $selector = null, ?string $nodeType = null): ?Element { if ($this->node->nextSibling === null) { return null; @@ -801,10 +807,6 @@ public function nextSibling($selector = null, $nodeType = null) $nodeType = 'DOMElement'; } - if ( ! is_string($nodeType)) { - throw new InvalidArgumentException(sprintf('%s expects parameter 2 to be string, %s given', __METHOD__, gettype($nodeType))); - } - $allowedTypes = ['DOMElement', 'DOMText', 'DOMComment', 'DOMCdataSection']; if ( ! in_array($nodeType, $allowedTypes, true)) { @@ -812,7 +814,7 @@ public function nextSibling($selector = null, $nodeType = null) } if ($selector !== null && $nodeType !== 'DOMElement') { - throw new LogicException(sprintf('Selector can be used only with DOMElement node type, %s given', $nodeType)); + throw new LogicException(sprintf('Selector can be used only with DOMElement node type, %s given.', $nodeType)); } $node = $this->node->nextSibling; @@ -838,7 +840,7 @@ public function nextSibling($selector = null, $nodeType = null) /** * @param string|null $selector - * @param string $nodeType + * @param string|null $nodeType * * @return Element[] * @@ -847,7 +849,7 @@ public function nextSibling($selector = null, $nodeType = null) * @throws LogicException if the selector used with non DOMElement node type * @throws InvalidSelectorException if the selector is invalid */ - public function nextSiblings($selector = null, $nodeType = null) + public function nextSiblings(?string $selector = null, ?string $nodeType = null): array { if ($this->node->nextSibling === null) { return []; @@ -857,20 +859,14 @@ public function nextSiblings($selector = null, $nodeType = null) $nodeType = 'DOMElement'; } - if ($nodeType !== null) { - if ( ! is_string($nodeType)) { - throw new InvalidArgumentException(sprintf('%s expects parameter 2 to be string, %s given', __METHOD__, gettype($nodeType))); - } - - $allowedTypes = ['DOMElement', 'DOMText', 'DOMComment', 'DOMCdataSection']; + $allowedTypes = ['DOMElement', 'DOMText', 'DOMComment', 'DOMCdataSection']; - if ( ! in_array($nodeType, $allowedTypes, true)) { - throw new RuntimeException(sprintf('Unknown node type "%s". Allowed types: %s', $nodeType, implode(', ', $allowedTypes))); - } + if ($nodeType !== null && ! in_array($nodeType, $allowedTypes, true)) { + throw new RuntimeException(sprintf('Unknown node type "%s". Allowed types: %s', $nodeType, implode(', ', $allowedTypes))); } if ($selector !== null && $nodeType !== 'DOMElement') { - throw new LogicException(sprintf('Selector can be used only with DOMElement node type, %s given', $nodeType)); + throw new LogicException(sprintf('Selector can be used only with DOMElement node type, %s given.', $nodeType)); } $result = []; @@ -917,7 +913,7 @@ public function nextSiblings($selector = null, $nodeType = null) * * @return Element|null */ - public function child($index) + public function child(int $index): ?Element { $child = $this->node->childNodes->item($index); @@ -927,7 +923,7 @@ public function child($index) /** * @return Element|null */ - public function firstChild() + public function firstChild(): ?Element { if ($this->node->firstChild === null) { return null; @@ -939,7 +935,7 @@ public function firstChild() /** * @return Element|null */ - public function lastChild() + public function lastChild(): ?Element { if ($this->node->lastChild === null) { return null; @@ -951,7 +947,7 @@ public function lastChild() /** * @return bool */ - public function hasChildren() + public function hasChildren(): bool { return $this->node->hasChildNodes(); } @@ -959,7 +955,7 @@ public function hasChildren() /** * @return Element[] */ - public function children() + public function children(): array { $children = []; @@ -977,14 +973,14 @@ public function children() * * @return Element the node that has been removed */ - public function removeChild($childNode) + public function removeChild($childNode): Element { if ($childNode instanceof Node) { $childNode = $childNode->getNode(); } if ( ! $childNode instanceof DOMNode) { - throw new InvalidArgumentException(sprintf('Argument 1 passed to %s must be an instance of %s or DOMNode, %s given', __METHOD__, __CLASS__, (is_object($childNode) ? get_class($childNode) : gettype($childNode)))); + throw new InvalidArgumentException(sprintf('Argument 1 passed to %s must be an instance of %s or DOMNode, %s given.', __METHOD__, __CLASS__, (is_object($childNode) ? get_class($childNode) : gettype($childNode)))); } $removedNode = $this->node->removeChild($childNode); @@ -997,7 +993,7 @@ public function removeChild($childNode) * * @return Element[] the nodes that has been removed */ - public function removeChildren() + public function removeChildren(): array { // we need to collect child nodes to array // because removing nodes from the DOMNodeList on iterating is not working @@ -1025,10 +1021,10 @@ public function removeChildren() * * @throws LogicException if the current node has no parent node */ - public function remove() + public function remove(): Element { if ($this->node->parentNode === null) { - throw new LogicException('Can not remove an element without the parent node'); + throw new LogicException('Can not remove an element without the parent node.'); } $removedNode = $this->node->parentNode->removeChild($this->node); @@ -1046,10 +1042,10 @@ public function remove() * * @throws LogicException if the current node has no parent node */ - public function replace($newNode, $clone = true) + public function replace($newNode, bool $clone = true): Element { if ($this->node->parentNode === null) { - throw new LogicException('Can not replace an element without the parent node'); + throw new LogicException('Can not replace an element without the parent node.'); } if ($newNode instanceof Node) { @@ -1057,14 +1053,14 @@ public function replace($newNode, $clone = true) } if ( ! $newNode instanceof DOMNode) { - throw new InvalidArgumentException(sprintf('Argument 1 passed to %s must be an instance of %s or DOMNode, %s given', __METHOD__, __CLASS__, (is_object($newNode) ? get_class($newNode) : gettype($newNode)))); + throw new InvalidArgumentException(sprintf('Argument 1 passed to %s must be an instance of %s or DOMNode, %s given.', __METHOD__, __CLASS__, (is_object($newNode) ? get_class($newNode) : gettype($newNode)))); } if ($clone) { $newNode = $newNode->cloneNode(true); } - if ($newNode->ownerDocument === null || ! $this->getDocument()->is($newNode->ownerDocument)) { + if ($newNode->ownerDocument === null || ! $this->ownerDocument()->is($newNode->ownerDocument)) { $newNode = $this->node->ownerDocument->importNode($newNode, true); } @@ -1078,7 +1074,7 @@ public function replace($newNode, $clone = true) * * @return int */ - public function getLineNo() + public function getLineNo(): int { return $this->node->getLineNo(); } @@ -1090,7 +1086,7 @@ public function getLineNo() * * @return Element The cloned node */ - public function cloneNode($deep = true) + public function cloneNode(bool $deep = true): Element { return new Element($this->node->cloneNode($deep)); } @@ -1102,12 +1098,12 @@ public function cloneNode($deep = true) * * @return static */ - protected function setNode($node) + protected function setNode($node): self { $allowedClasses = ['DOMElement', 'DOMText', 'DOMComment', 'DOMCdataSection', 'DOMDocumentFragment']; if ( ! is_object($node) || ! in_array(get_class($node), $allowedClasses, true)) { - throw new InvalidArgumentException(sprintf('Argument 1 passed to %s must be an instance of DOMElement, DOMText, DOMComment, DOMCdataSection or DOMDocumentFragment, %s given', __METHOD__, (is_object($node) ? get_class($node) : gettype($node)))); + throw new InvalidArgumentException(sprintf('Argument 1 passed to %s must be an instance of DOMElement, DOMText, DOMComment, DOMCdataSection or DOMDocumentFragment, %s given.', __METHOD__, (is_object($node) ? get_class($node) : gettype($node)))); } $this->node = $node; @@ -1130,7 +1126,7 @@ public function getNode() * * @return Document|null */ - public function getDocument() + public function ownerDocument(): ?Document { if ($this->node->ownerDocument === null) { return null; @@ -1146,7 +1142,7 @@ public function getDocument() * * @return Document */ - public function toDocument($encoding = 'UTF-8') + public function toDocument(string $encoding = 'UTF-8'): Document { $document = new Document(null, false, $encoding); @@ -1160,26 +1156,8 @@ public function toDocument($encoding = 'UTF-8') * * @return string */ - public function __toString() + public function __toString(): string { return $this->html(); } - - /** - * Searches for a node in the DOM tree for a given XPath expression or CSS selector. - * - * @param string $expression XPath expression or CSS selector - * @param string $type The type of the expression - * @param bool $wrapNode Returns array of Element if true, otherwise array of DOMElement - * - * @return Element[]|DOMElement[] - * - * @throws InvalidSelectorException - * - * @deprecated Not longer recommended, use Element::find() instead. - */ - public function __invoke($expression, $type = Query::TYPE_CSS, $wrapNode = true) - { - return $this->find($expression, $type, $wrapNode); - } } diff --git a/vendor/imangazaliev/didom/src/DiDom/Query.php b/vendor/imangazaliev/didom/src/DiDom/Query.php index 9bd47f7..094fe2b 100644 --- a/vendor/imangazaliev/didom/src/DiDom/Query.php +++ b/vendor/imangazaliev/didom/src/DiDom/Query.php @@ -1,5 +1,7 @@ ') { $prefix = '/'; @@ -142,7 +136,7 @@ protected static function parseAndConvertSelector($selector, $prefix = '//') * * @throws InvalidSelectorException */ - protected static function parseProperty($selector) + protected static function parseProperty(string $selector): array { $name = '(?P[\w\-]+)'; $args = '(?:\((?P[^\)]+)?\))?'; @@ -150,7 +144,7 @@ protected static function parseProperty($selector) $regexp = '/^::' . $name . $args . '/is'; if (preg_match($regexp, $selector, $matches) !== 1) { - throw new InvalidSelectorException(sprintf('Invalid property "%s"', $selector)); + throw new InvalidSelectorException(sprintf('Invalid property "%s".', $selector)); } $result = []; @@ -172,7 +166,7 @@ protected static function parseProperty($selector) * * @throws InvalidSelectorException if the specified property is unknown */ - protected static function convertProperty($name, array $parameters = []) + protected static function convertProperty(string $name, array $parameters = []): string { if ($name === 'text') { return 'text()'; @@ -192,7 +186,7 @@ protected static function convertProperty($name, array $parameters = []) return sprintf('@*[%s]', implode(' or ', $attributes)); } - throw new InvalidSelectorException(sprintf('Unknown property "%s"', $name)); + throw new InvalidSelectorException(sprintf('Unknown property "%s".', $name)); } /** @@ -206,7 +200,7 @@ protected static function convertProperty($name, array $parameters = []) * * @throws InvalidSelectorException if the specified pseudo-class is unknown */ - protected static function convertPseudo($pseudo, &$tagName, array $parameters = []) + protected static function convertPseudo(string $pseudo, string &$tagName, array $parameters = []): string { switch ($pseudo) { case 'first-child': @@ -226,7 +220,7 @@ protected static function convertPseudo($pseudo, &$tagName, array $parameters = } if ($parameters[1] !== 'true' && $parameters[1] !== 'false') { - throw new InvalidSelectorException(sprintf('Parameter 2 of "contains" pseudo-class must be equal true or false, "%s" given', $parameters[1])); + throw new InvalidSelectorException(sprintf('Parameter 2 of "contains" pseudo-class must be equal true or false, "%s" given.', $parameters[1])); } $caseSensitive = $parameters[1] === 'true'; @@ -236,7 +230,7 @@ protected static function convertPseudo($pseudo, &$tagName, array $parameters = } if ($parameters[2] !== 'true' && $parameters[2] !== 'false') { - throw new InvalidSelectorException(sprintf('Parameter 3 of "contains" pseudo-class must be equal true or false, "%s" given', $parameters[2])); + throw new InvalidSelectorException(sprintf('Parameter 3 of "contains" pseudo-class must be equal true or false, "%s" given.', $parameters[2])); } $fullMatch = $parameters[2] === 'true'; @@ -255,7 +249,7 @@ protected static function convertPseudo($pseudo, &$tagName, array $parameters = return 'count(descendant::*) > 0'; } - throw new InvalidSelectorException(sprintf('Unknown pseudo-class "%s"', $pseudo)); + throw new InvalidSelectorException(sprintf('Unknown pseudo-class "%s".', $pseudo)); } /** @@ -266,7 +260,7 @@ protected static function convertPseudo($pseudo, &$tagName, array $parameters = * * @throws InvalidArgumentException if you neither specify tag name nor attributes */ - public static function buildXpath(array $segments, $prefix = '//') + public static function buildXpath(array $segments, string $prefix = '//'): string { $tagName = isset($segments['tag']) ? $segments['tag'] : '*'; @@ -304,7 +298,7 @@ public static function buildXpath(array $segments, $prefix = '//') } if (count($attributes) === 0 && ! isset($segments['tag'])) { - throw new InvalidArgumentException('The array of segments must contain the name of the tag or at least one attribute'); + throw new InvalidArgumentException('The array of segments must contain the name of the tag or at least one attribute.'); } $xpath = $prefix . $tagName; @@ -318,11 +312,11 @@ public static function buildXpath(array $segments, $prefix = '//') /** * @param string $name The name of an attribute - * @param string $value The value of an attribute + * @param string|null $value The value of an attribute * * @return string */ - protected static function convertAttribute($name, $value) + protected static function convertAttribute(string $name, ?string $value): string { $isSimpleSelector = ! in_array(substr($name, 0, 1), ['^', '!'], true); $isSimpleSelector = $isSimpleSelector && ( ! in_array(substr($name, -1), ['^', '$', '*', '!', '~'], true)); @@ -388,10 +382,10 @@ protected static function convertAttribute($name, $value) * * @throws InvalidSelectorException if the given nth-child expression is empty or invalid */ - protected static function convertNthExpression($expression) + protected static function convertNthExpression(string $expression): string { if ($expression === '') { - throw new InvalidSelectorException('nth-child (or nth-last-child) expression must not be empty'); + throw new InvalidSelectorException('nth-child (or nth-last-child) expression must not be empty.'); } if ($expression === 'odd') { @@ -416,7 +410,7 @@ protected static function convertNthExpression($expression) } } - throw new InvalidSelectorException(sprintf('Invalid nth-child expression "%s"', $expression)); + throw new InvalidSelectorException(sprintf('Invalid nth-child expression "%s".', $expression)); } /** @@ -426,7 +420,7 @@ protected static function convertNthExpression($expression) * * @return string */ - protected static function convertContains($string, $caseSensitive = true, $fullMatch = false) + protected static function convertContains(string $string, bool $caseSensitive = true, bool $fullMatch = false): string { if ($caseSensitive && $fullMatch) { return sprintf('text() = "%s"', $string); @@ -455,7 +449,7 @@ protected static function convertContains($string, $caseSensitive = true, $fullM * * @throws InvalidSelectorException if the selector is empty or not valid */ - public static function getSegments($selector) + public static function getSegments(string $selector): array { $selector = trim($selector); @@ -490,7 +484,7 @@ public static function getSegments($selector) list($name, $value) = array_pad(explode('=', $attribute, 2), 2, null); if ($name === '') { - throw new InvalidSelectorException(sprintf('Invalid selector "%s": attribute name must not be empty', $selector)); + throw new InvalidSelectorException(sprintf('Invalid selector "%s": attribute name must not be empty.', $selector)); } // equal null if specified only the attribute name @@ -533,7 +527,7 @@ public static function getSegments($selector) return $result; } - private static function getSelectorRegex() + private static function getSelectorRegex(): string { $tag = '(?P[\*|\w|\-]+)?'; $id = '(?:#(?P[\w|\-]+))?'; @@ -550,7 +544,7 @@ private static function getSelectorRegex() /** * @return array */ - public static function getCompiled() + public static function getCompiled(): array { return static::$compiled; } @@ -560,7 +554,7 @@ public static function getCompiled() * * @throws InvalidArgumentException if the attributes is not an array */ - public static function setCompiled(array $compiled) + public static function setCompiled(array $compiled): void { static::$compiled = $compiled; } diff --git a/vendor/imangazaliev/didom/src/DiDom/StyleAttribute.php b/vendor/imangazaliev/didom/src/DiDom/StyleAttribute.php index 0002944..a4866c0 100644 --- a/vendor/imangazaliev/didom/src/DiDom/StyleAttribute.php +++ b/vendor/imangazaliev/didom/src/DiDom/StyleAttribute.php @@ -1,5 +1,7 @@ isElementNode()) { - throw new InvalidArgumentException(sprintf('The element must contain DOMElement node')); + throw new InvalidArgumentException(sprintf('The element must contain DOMElement node.')); } $this->element = $element; @@ -85,7 +87,7 @@ protected function parseStyleAttribute() /** * Updates style attribute of the element. */ - protected function updateStyleAttribute() + protected function updateStyleAttribute(): void { $this->styleString = $this->buildStyleString(); @@ -95,7 +97,7 @@ protected function updateStyleAttribute() /** * @return string */ - protected function buildStyleString() + protected function buildStyleString(): string { $properties = []; @@ -115,16 +117,8 @@ protected function buildStyleString() * @throws InvalidArgumentException if property name is not a string * @throws InvalidArgumentException if property value is not a string */ - public function setProperty($name, $value) + public function setProperty(string $name, string $value): self { - if ( ! is_string($name)) { - throw new InvalidArgumentException(sprintf('%s expects parameter 1 to be string, %s given', __METHOD__, (is_object($name) ? get_class($name) : gettype($name)))); - } - - if ( ! is_string($value)) { - throw new InvalidArgumentException(sprintf('%s expects parameter 2 to be string, %s given', __METHOD__, (is_object($value) ? get_class($value) : gettype($value)))); - } - $this->parseStyleAttribute(); $this->properties[$name] = $value; @@ -142,17 +136,17 @@ public function setProperty($name, $value) * @throws InvalidArgumentException if property name is not a string * @throws InvalidArgumentException if property value is not a string */ - public function setMultipleProperties(array $properties) + public function setMultipleProperties(array $properties): self { $this->parseStyleAttribute(); foreach ($properties as $propertyName => $value) { if ( ! is_string($propertyName)) { - throw new InvalidArgumentException(sprintf('Property name must be a string, %s given', (is_object($propertyName) ? get_class($propertyName) : gettype($propertyName)))); + throw new InvalidArgumentException(sprintf('Property name must be a string, %s given.', (is_object($propertyName) ? get_class($propertyName) : gettype($propertyName)))); } if ( ! is_string($value)) { - throw new InvalidArgumentException(sprintf('Property value must be a string, %s given', (is_object($value) ? get_class($value) : gettype($value)))); + throw new InvalidArgumentException(sprintf('Property value must be a string, %s given.', (is_object($value) ? get_class($value) : gettype($value)))); } $this->properties[$propertyName] = $value; @@ -169,12 +163,8 @@ public function setMultipleProperties(array $properties) * * @return mixed */ - public function getProperty($name, $default = null) + public function getProperty(string $name, $default = null) { - if ( ! is_string($name)) { - throw new InvalidArgumentException(sprintf('%s expects parameter 1 to be string, %s given', __METHOD__, (is_object($name) ? get_class($name) : gettype($name)))); - } - $this->parseStyleAttribute(); if ( ! array_key_exists($name, $this->properties)) { @@ -185,13 +175,13 @@ public function getProperty($name, $default = null) } /** - * @param array $propertyNames + * @param string[] $propertyNames * - * @return mixed + * @return array * * @throws InvalidArgumentException if property name is not a string */ - public function getMultipleProperties(array $propertyNames) + public function getMultipleProperties(array $propertyNames): array { $this->parseStyleAttribute(); @@ -199,7 +189,7 @@ public function getMultipleProperties(array $propertyNames) foreach ($propertyNames as $propertyName) { if ( ! is_string($propertyName)) { - throw new InvalidArgumentException(sprintf('Property name must be a string, %s given', (is_object($propertyName) ? get_class($propertyName) : gettype($propertyName)))); + throw new InvalidArgumentException(sprintf('Property name must be a string, %s given.', (is_object($propertyName) ? get_class($propertyName) : gettype($propertyName)))); } if (array_key_exists($propertyName, $this->properties)) { @@ -213,7 +203,7 @@ public function getMultipleProperties(array $propertyNames) /** * @return array */ - public function getAllProperties() + public function getAllProperties(): array { $this->parseStyleAttribute(); @@ -225,12 +215,8 @@ public function getAllProperties() * * @return bool */ - public function hasProperty($name) + public function hasProperty(string $name): bool { - if ( ! is_string($name)) { - throw new InvalidArgumentException(sprintf('%s expects parameter 1 to be string, %s given', __METHOD__, (is_object($name) ? get_class($name) : gettype($name)))); - } - $this->parseStyleAttribute(); return array_key_exists($name, $this->properties); @@ -243,12 +229,8 @@ public function hasProperty($name) * * @throws InvalidArgumentException if property name is not a string */ - public function removeProperty($name) + public function removeProperty(string $name): self { - if ( ! is_string($name)) { - throw new InvalidArgumentException(sprintf('%s expects parameter 1 to be string, %s given', __METHOD__, (is_object($name) ? get_class($name) : gettype($name)))); - } - $this->parseStyleAttribute(); unset($this->properties[$name]); @@ -265,13 +247,13 @@ public function removeProperty($name) * * @throws InvalidArgumentException if property name is not a string */ - public function removeMultipleProperties(array $propertyNames) + public function removeMultipleProperties(array $propertyNames): self { $this->parseStyleAttribute(); foreach ($propertyNames as $propertyName) { if ( ! is_string($propertyName)) { - throw new InvalidArgumentException(sprintf('Property name must be a string, %s given', (is_object($propertyName) ? get_class($propertyName) : gettype($propertyName)))); + throw new InvalidArgumentException(sprintf('Property name must be a string, %s given.', (is_object($propertyName) ? get_class($propertyName) : gettype($propertyName)))); } unset($this->properties[$propertyName]); @@ -283,19 +265,19 @@ public function removeMultipleProperties(array $propertyNames) } /** - * @param string[] $exclusions + * @param string[] $preserved * * @return StyleAttribute */ - public function removeAllProperties(array $exclusions = []) + public function removeAllProperties(array $preserved = []): self { $this->parseStyleAttribute(); $preservedProperties = []; - foreach ($exclusions as $propertyName) { + foreach ($preserved as $propertyName) { if ( ! is_string($propertyName)) { - throw new InvalidArgumentException(sprintf('Property name must be a string, %s given', (is_object($propertyName) ? get_class($propertyName) : gettype($propertyName)))); + throw new InvalidArgumentException(sprintf('Property name must be a string, %s given.', (is_object($propertyName) ? get_class($propertyName) : gettype($propertyName)))); } if ( ! array_key_exists($propertyName, $this->properties)) { @@ -315,7 +297,7 @@ public function removeAllProperties(array $exclusions = []) /** * @return Element */ - public function getElement() + public function getElement(): Element { return $this->element; } From 334162921fe3d40fbfeb1c2d109c75f74c6c9650 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Mon, 8 May 2023 15:07:39 -0600 Subject: [PATCH 2/2] prepare for release --- CHANGELOG.md | 2 +- blueprints.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 675d9f4..4d239ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,5 @@ # v2.1.0 -## mm/dd/2023 +## 05/08/2023 1. [](#improved) * Upgraded to latest `v2.0.1` of DiDOM library to support PHP 8.0 diff --git a/blueprints.yaml b/blueprints.yaml index 40c9fa3..7e5d251 100644 --- a/blueprints.yaml +++ b/blueprints.yaml @@ -1,5 +1,5 @@ name: Image Captions -version: 2.0.3 +version: 2.1.0 type: plugin slug: image-captions description: "Looks for images with defined title attribute and converts them to fig-captions."