diff --git a/composer/autoload_classmap.php b/composer/autoload_classmap.php index 19834d353..5b5a06273 100644 --- a/composer/autoload_classmap.php +++ b/composer/autoload_classmap.php @@ -1536,18 +1536,6 @@ 'FG\\X509\\SAN\\DNSName' => $vendorDir . '/fgrosse/phpasn1/lib/X509/SAN/DNSName.php', 'FG\\X509\\SAN\\IPAddress' => $vendorDir . '/fgrosse/phpasn1/lib/X509/SAN/IPAddress.php', 'FG\\X509\\SAN\\SubjectAlternativeNames' => $vendorDir . '/fgrosse/phpasn1/lib/X509/SAN/SubjectAlternativeNames.php', - 'Fusonic\\Linq\\GroupedLinq' => $vendorDir . '/fusonic/linq/src/Fusonic/Linq/GroupedLinq.php', - 'Fusonic\\Linq\\Helper\\LinqHelper' => $vendorDir . '/fusonic/linq/src/Fusonic/Linq/Helper/LinqHelper.php', - 'Fusonic\\Linq\\Iterator\\DistinctIterator' => $vendorDir . '/fusonic/linq/src/Fusonic/Linq/Iterator/DistinctIterator.php', - 'Fusonic\\Linq\\Iterator\\ExceptIterator' => $vendorDir . '/fusonic/linq/src/Fusonic/Linq/Iterator/ExceptIterator.php', - 'Fusonic\\Linq\\Iterator\\GroupIterator' => $vendorDir . '/fusonic/linq/src/Fusonic/Linq/Iterator/GroupIterator.php', - 'Fusonic\\Linq\\Iterator\\IntersectIterator' => $vendorDir . '/fusonic/linq/src/Fusonic/Linq/Iterator/IntersectIterator.php', - 'Fusonic\\Linq\\Iterator\\OfTypeIterator' => $vendorDir . '/fusonic/linq/src/Fusonic/Linq/Iterator/OfTypeIterator.php', - 'Fusonic\\Linq\\Iterator\\OrderIterator' => $vendorDir . '/fusonic/linq/src/Fusonic/Linq/Iterator/OrderIterator.php', - 'Fusonic\\Linq\\Iterator\\SelectIterator' => $vendorDir . '/fusonic/linq/src/Fusonic/Linq/Iterator/SelectIterator.php', - 'Fusonic\\Linq\\Iterator\\SelectManyIterator' => $vendorDir . '/fusonic/linq/src/Fusonic/Linq/Iterator/SelectManyIterator.php', - 'Fusonic\\Linq\\Iterator\\WhereIterator' => $vendorDir . '/fusonic/linq/src/Fusonic/Linq/Iterator/WhereIterator.php', - 'Fusonic\\Linq\\Linq' => $vendorDir . '/fusonic/linq/src/Fusonic/Linq/Linq.php', 'Fusonic\\OpenGraph\\Consumer' => $vendorDir . '/fusonic/opengraph/src/Consumer.php', 'Fusonic\\OpenGraph\\Elements\\Audio' => $vendorDir . '/fusonic/opengraph/src/Elements/Audio.php', 'Fusonic\\OpenGraph\\Elements\\ElementBase' => $vendorDir . '/fusonic/opengraph/src/Elements/ElementBase.php', diff --git a/composer/autoload_files.php b/composer/autoload_files.php index b20dade95..6843f465f 100644 --- a/composer/autoload_files.php +++ b/composer/autoload_files.php @@ -7,8 +7,8 @@ return array( '6e3fae29631ef280660b3cdad06f25a8' => $vendorDir . '/symfony/deprecation-contracts/function.php', - 'a4a119a56e50fbb293281d9a48007e0e' => $vendorDir . '/symfony/polyfill-php80/bootstrap.php', '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php', + 'a4a119a56e50fbb293281d9a48007e0e' => $vendorDir . '/symfony/polyfill-php80/bootstrap.php', '383eaff206634a77a1be54e64e6459c7' => $vendorDir . '/sabre/uri/lib/functions.php', '7b11c4dc42b3b3023073cb14e519683c' => $vendorDir . '/ralouphie/getallheaders/src/getallheaders.php', 'e69f7f6ee287b969198c3c9d6777bd38' => $vendorDir . '/symfony/polyfill-intl-normalizer/bootstrap.php', diff --git a/composer/autoload_namespaces.php b/composer/autoload_namespaces.php index c43ac4882..225f7eb6a 100644 --- a/composer/autoload_namespaces.php +++ b/composer/autoload_namespaces.php @@ -7,7 +7,6 @@ return array( 'Pimple' => array($vendorDir . '/pimple/pimple/src'), - 'Fusonic\\Linq' => array($vendorDir . '/fusonic/linq/src'), 'Console' => array($vendorDir . '/pear/console_getopt'), 'Archive_Tar' => array($vendorDir . '/pear/archive_tar'), '' => array($vendorDir . '/pear/pear-core-minimal/src'), diff --git a/composer/autoload_static.php b/composer/autoload_static.php index 1dc699d53..8d7e14474 100644 --- a/composer/autoload_static.php +++ b/composer/autoload_static.php @@ -8,8 +8,8 @@ class ComposerStaticInit2f23f73bc0cc116b4b1eee1521aa8652 { public static $files = array ( '6e3fae29631ef280660b3cdad06f25a8' => __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php', - 'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php', '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php', + 'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php', '383eaff206634a77a1be54e64e6459c7' => __DIR__ . '/..' . '/sabre/uri/lib/functions.php', '7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php', 'e69f7f6ee287b969198c3c9d6777bd38' => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer/bootstrap.php', @@ -635,13 +635,6 @@ class ComposerStaticInit2f23f73bc0cc116b4b1eee1521aa8652 0 => __DIR__ . '/..' . '/pimple/pimple/src', ), ), - 'F' => - array ( - 'Fusonic\\Linq' => - array ( - 0 => __DIR__ . '/..' . '/fusonic/linq/src', - ), - ), 'C' => array ( 'Console' => @@ -2193,18 +2186,6 @@ class ComposerStaticInit2f23f73bc0cc116b4b1eee1521aa8652 'FG\\X509\\SAN\\DNSName' => __DIR__ . '/..' . '/fgrosse/phpasn1/lib/X509/SAN/DNSName.php', 'FG\\X509\\SAN\\IPAddress' => __DIR__ . '/..' . '/fgrosse/phpasn1/lib/X509/SAN/IPAddress.php', 'FG\\X509\\SAN\\SubjectAlternativeNames' => __DIR__ . '/..' . '/fgrosse/phpasn1/lib/X509/SAN/SubjectAlternativeNames.php', - 'Fusonic\\Linq\\GroupedLinq' => __DIR__ . '/..' . '/fusonic/linq/src/Fusonic/Linq/GroupedLinq.php', - 'Fusonic\\Linq\\Helper\\LinqHelper' => __DIR__ . '/..' . '/fusonic/linq/src/Fusonic/Linq/Helper/LinqHelper.php', - 'Fusonic\\Linq\\Iterator\\DistinctIterator' => __DIR__ . '/..' . '/fusonic/linq/src/Fusonic/Linq/Iterator/DistinctIterator.php', - 'Fusonic\\Linq\\Iterator\\ExceptIterator' => __DIR__ . '/..' . '/fusonic/linq/src/Fusonic/Linq/Iterator/ExceptIterator.php', - 'Fusonic\\Linq\\Iterator\\GroupIterator' => __DIR__ . '/..' . '/fusonic/linq/src/Fusonic/Linq/Iterator/GroupIterator.php', - 'Fusonic\\Linq\\Iterator\\IntersectIterator' => __DIR__ . '/..' . '/fusonic/linq/src/Fusonic/Linq/Iterator/IntersectIterator.php', - 'Fusonic\\Linq\\Iterator\\OfTypeIterator' => __DIR__ . '/..' . '/fusonic/linq/src/Fusonic/Linq/Iterator/OfTypeIterator.php', - 'Fusonic\\Linq\\Iterator\\OrderIterator' => __DIR__ . '/..' . '/fusonic/linq/src/Fusonic/Linq/Iterator/OrderIterator.php', - 'Fusonic\\Linq\\Iterator\\SelectIterator' => __DIR__ . '/..' . '/fusonic/linq/src/Fusonic/Linq/Iterator/SelectIterator.php', - 'Fusonic\\Linq\\Iterator\\SelectManyIterator' => __DIR__ . '/..' . '/fusonic/linq/src/Fusonic/Linq/Iterator/SelectManyIterator.php', - 'Fusonic\\Linq\\Iterator\\WhereIterator' => __DIR__ . '/..' . '/fusonic/linq/src/Fusonic/Linq/Iterator/WhereIterator.php', - 'Fusonic\\Linq\\Linq' => __DIR__ . '/..' . '/fusonic/linq/src/Fusonic/Linq/Linq.php', 'Fusonic\\OpenGraph\\Consumer' => __DIR__ . '/..' . '/fusonic/opengraph/src/Consumer.php', 'Fusonic\\OpenGraph\\Elements\\Audio' => __DIR__ . '/..' . '/fusonic/opengraph/src/Elements/Audio.php', 'Fusonic\\OpenGraph\\Elements\\ElementBase' => __DIR__ . '/..' . '/fusonic/opengraph/src/Elements/ElementBase.php', diff --git a/composer/installed.json b/composer/installed.json index 34231e2a5..dc1a1ef4a 100644 --- a/composer/installed.json +++ b/composer/installed.json @@ -181,6 +181,10 @@ "MIT" ], "description": "Convenience wrapper around ini_get()", + "support": { + "issues": "https://github.com/bantuXorg/php-ini-get-wrapper/issues", + "source": "https://github.com/bantuXorg/php-ini-get-wrapper/tree/v1.0.1" + }, "install-path": "../bantu/ini-get-wrapper" }, { @@ -218,12 +222,12 @@ "type": "library", "installation-source": "dist", "autoload": { - "psr-4": { - "Assert\\": "lib/Assert" - }, "files": [ "lib/Assert/functions.php" - ] + ], + "psr-4": { + "Assert\\": "lib/Assert" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1077,74 +1081,26 @@ "issues": "https://github.com/fgrosse/PHPASN1/issues", "source": "https://github.com/fgrosse/PHPASN1/tree/v2.3.0" }, + "abandoned": true, "install-path": "../fgrosse/phpasn1" }, - { - "name": "fusonic/linq", - "version": "v1.1.0", - "version_normalized": "1.1.0.0", - "source": { - "type": "git", - "url": "https://github.com/fusonic/linq.git", - "reference": "63520ef1470ca771acbd26871efb945dd4a7a5d8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/fusonic/linq/zipball/63520ef1470ca771acbd26871efb945dd4a7a5d8", - "reference": "63520ef1470ca771acbd26871efb945dd4a7a5d8", - "shasum": "" - }, - "require": { - "php": ">=5.3.2" - }, - "time": "2015-02-26T22:49:17+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-0": { - "Fusonic\\Linq": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fusonic", - "homepage": "http://www.fusonic.net" - } - ], - "description": "LINQ 2 objects class for PHP", - "homepage": "http://fusonic.github.io/fusonic-linq/", - "keywords": [ - "linq", - "linq2objects" - ], - "support": { - "issues": "https://github.com/fusonic/linq/issues", - "source": "https://github.com/fusonic/linq/tree/master" - }, - "install-path": "../fusonic/linq" - }, { "name": "fusonic/opengraph", - "version": "v2.2.0", - "version_normalized": "2.2.0.0", + "version": "v2.3.0", + "version_normalized": "2.3.0.0", "source": { "type": "git", "url": "https://github.com/fusonic/opengraph.git", - "reference": "a63b588fbe56c175ae06e158f1513642653ee3c1" + "reference": "09dca70b04b4221c9dc664e1689e876a3faa50c2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/fusonic/opengraph/zipball/a63b588fbe56c175ae06e158f1513642653ee3c1", - "reference": "a63b588fbe56c175ae06e158f1513642653ee3c1", + "url": "https://api.github.com/repos/fusonic/opengraph/zipball/09dca70b04b4221c9dc664e1689e876a3faa50c2", + "reference": "09dca70b04b4221c9dc664e1689e876a3faa50c2", "shasum": "" }, "require": { "ext-dom": "*", - "fusonic/linq": "^1.0", "php": "^7.4|^8.0", "psr/http-client": "^1.0", "psr/http-factory": "^1.0", @@ -1160,7 +1116,7 @@ "nyholm/psr7": "^1.2", "symfony/http-client": "^5.0" }, - "time": "2022-01-20T05:47:36+00:00", + "time": "2023-12-05T14:26:51+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -1185,7 +1141,7 @@ ], "support": { "issues": "https://github.com/fusonic/opengraph/issues", - "source": "https://github.com/fusonic/opengraph/tree/v2.2.0" + "source": "https://github.com/fusonic/opengraph/tree/v2.3.0" }, "install-path": "../fusonic/opengraph" }, @@ -2481,6 +2437,10 @@ "log", "normalizer" ], + "support": { + "issues": "https://github.com/nextcloud/lognormalizer/issues", + "source": "https://github.com/nextcloud/lognormalizer/tree/v1.0.0" + }, "install-path": "../nextcloud/lognormalizer" }, { @@ -3879,12 +3839,12 @@ }, "installation-source": "dist", "autoload": { - "psr-4": { - "Ramsey\\Uuid\\": "src/" - }, "files": [ "src/functions.php" - ] + ], + "psr-4": { + "Ramsey\\Uuid\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -3906,6 +3866,10 @@ { "url": "https://github.com/ramsey", "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/ramsey/uuid", + "type": "tidelift" } ], "install-path": "../ramsey/uuid" @@ -4645,6 +4609,10 @@ } ], "description": "Automatic BASH completion for Symfony Console Component based applications.", + "support": { + "issues": "https://github.com/stecman/symfony-console-completion/issues", + "source": "https://github.com/stecman/symfony-console-completion/tree/0.11.0" + }, "install-path": "../stecman/symfony-console-completion" }, { @@ -4751,24 +4719,23 @@ }, { "name": "symfony/css-selector", - "version": "v5.4.11", - "version_normalized": "5.4.11.0", + "version": "v6.0.19", + "version_normalized": "6.0.19.0", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", - "reference": "c1681789f059ab756001052164726ae88512ae3d" + "reference": "f1d00bddb83a4cb2138564b2150001cb6ce272b1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/c1681789f059ab756001052164726ae88512ae3d", - "reference": "c1681789f059ab756001052164726ae88512ae3d", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/f1d00bddb83a4cb2138564b2150001cb6ce272b1", + "reference": "f1d00bddb83a4cb2138564b2150001cb6ce272b1", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/polyfill-php80": "^1.16" + "php": ">=8.0.2" }, - "time": "2022-06-27T16:58:25+00:00", + "time": "2023-01-01T08:36:10+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -4800,7 +4767,7 @@ "description": "Converts CSS selectors to XPath expressions", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/css-selector/tree/v5.4.11" + "source": "https://github.com/symfony/css-selector/tree/v6.0.19" }, "funding": [ { @@ -4890,37 +4857,35 @@ }, { "name": "symfony/dom-crawler", - "version": "v5.4.11", - "version_normalized": "5.4.11.0", + "version": "v6.0.19", + "version_normalized": "6.0.19.0", "source": { "type": "git", "url": "https://github.com/symfony/dom-crawler.git", - "reference": "0b900ca5576ecd59e08c76127e616667cfe427a7" + "reference": "622578ff158318b1b49d95068bd6b66c713601e9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/0b900ca5576ecd59e08c76127e616667cfe427a7", - "reference": "0b900ca5576ecd59e08c76127e616667cfe427a7", + "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/622578ff158318b1b49d95068bd6b66c713601e9", + "reference": "622578ff158318b1b49d95068bd6b66c713601e9", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1|^3", + "php": ">=8.0.2", "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php80": "^1.16" + "symfony/polyfill-mbstring": "~1.0" }, "conflict": { "masterminds/html5": "<2.6" }, "require-dev": { "masterminds/html5": "^2.6", - "symfony/css-selector": "^4.4|^5.0|^6.0" + "symfony/css-selector": "^5.4|^6.0" }, "suggest": { "symfony/css-selector": "" }, - "time": "2022-06-27T16:58:25+00:00", + "time": "2023-01-20T17:44:14+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -4948,7 +4913,7 @@ "description": "Eases DOM navigation for HTML and XML documents", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/dom-crawler/tree/v5.4.11" + "source": "https://github.com/symfony/dom-crawler/tree/v6.0.19" }, "funding": [ { @@ -5383,17 +5348,17 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.28.0", - "version_normalized": "1.28.0.0", + "version": "v1.29.0", + "version_normalized": "1.29.0.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb" + "reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb", - "reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ef4d7e442ca910c4764bce785146269b30cb5fc4", + "reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4", "shasum": "" }, "require": { @@ -5405,12 +5370,9 @@ "suggest": { "ext-ctype": "For best performance" }, - "time": "2023-01-26T09:26:14+00:00", + "time": "2024-01-29T20:11:03+00:00", "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -5448,7 +5410,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.29.0" }, "funding": [ { @@ -5729,17 +5691,17 @@ }, { "name": "symfony/polyfill-mbstring", - "version": "v1.28.0", - "version_normalized": "1.28.0.0", + "version": "v1.29.0", + "version_normalized": "1.29.0.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "42292d99c55abe617799667f454222c54c60e229" + "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/42292d99c55abe617799667f454222c54c60e229", - "reference": "42292d99c55abe617799667f454222c54c60e229", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9773676c8a1bb1f8d4340a62efe641cf76eda7ec", + "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec", "shasum": "" }, "require": { @@ -5751,12 +5713,9 @@ "suggest": { "ext-mbstring": "For best performance" }, - "time": "2023-07-28T09:04:16+00:00", + "time": "2024-01-29T20:11:03+00:00", "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -5795,7 +5754,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.29.0" }, "funding": [ { @@ -5976,28 +5935,25 @@ }, { "name": "symfony/polyfill-php80", - "version": "v1.28.0", - "version_normalized": "1.28.0.0", + "version": "v1.29.0", + "version_normalized": "1.29.0.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5" + "reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/6caa57379c4aec19c0a12a38b59b26487dcfe4b5", - "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/87b68208d5c1188808dd7839ee1e6c8ec3b02f1b", + "reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b", "shasum": "" }, "require": { "php": ">=7.1" }, - "time": "2023-01-26T09:26:14+00:00", + "time": "2024-01-29T20:11:03+00:00", "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -6042,7 +5998,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.29.0" }, "funding": [ { @@ -6604,13 +6560,6 @@ }, "installation-source": "dist", "autoload": { - "psr-4": { - "Safe\\": [ - "lib/", - "deprecated/", - "generated/" - ] - }, "files": [ "deprecated/apc.php", "deprecated/libevent.php", @@ -6701,7 +6650,14 @@ "generated/yaz.php", "generated/zip.php", "generated/zlib.php" - ] + ], + "psr-4": { + "Safe\\": [ + "lib/", + "deprecated/", + "generated/" + ] + } }, "notification-url": "https://packagist.org/downloads/", "license": [ diff --git a/composer/installed.php b/composer/installed.php index 02cd6d6f0..746f25222 100644 --- a/composer/installed.php +++ b/composer/installed.php @@ -1,9 +1,9 @@ array( 'name' => 'nextcloud/3rdparty', - 'pretty_version' => 'dev-master', - 'version' => 'dev-master', - 'reference' => 'fe17c4147f7aa5ae661c99e6a52a5cf5e1a994bb', + 'pretty_version' => '1.0.0+no-version-set', + 'version' => '1.0.0.0', + 'reference' => null, 'type' => 'library', 'install_path' => __DIR__ . '/../', 'aliases' => array(), @@ -145,19 +145,10 @@ 'aliases' => array(), 'dev_requirement' => false, ), - 'fusonic/linq' => array( - 'pretty_version' => 'v1.1.0', - 'version' => '1.1.0.0', - 'reference' => '63520ef1470ca771acbd26871efb945dd4a7a5d8', - 'type' => 'library', - 'install_path' => __DIR__ . '/../fusonic/linq', - 'aliases' => array(), - 'dev_requirement' => false, - ), 'fusonic/opengraph' => array( - 'pretty_version' => 'v2.2.0', - 'version' => '2.2.0.0', - 'reference' => 'a63b588fbe56c175ae06e158f1513642653ee3c1', + 'pretty_version' => 'v2.3.0', + 'version' => '2.3.0.0', + 'reference' => '09dca70b04b4221c9dc664e1689e876a3faa50c2', 'type' => 'library', 'install_path' => __DIR__ . '/../fusonic/opengraph', 'aliases' => array(), @@ -317,9 +308,9 @@ 'dev_requirement' => false, ), 'nextcloud/3rdparty' => array( - 'pretty_version' => 'dev-master', - 'version' => 'dev-master', - 'reference' => 'fe17c4147f7aa5ae661c99e6a52a5cf5e1a994bb', + 'pretty_version' => '1.0.0+no-version-set', + 'version' => '1.0.0.0', + 'reference' => null, 'type' => 'library', 'install_path' => __DIR__ . '/../', 'aliases' => array(), @@ -698,9 +689,9 @@ 'dev_requirement' => false, ), 'symfony/css-selector' => array( - 'pretty_version' => 'v5.4.11', - 'version' => '5.4.11.0', - 'reference' => 'c1681789f059ab756001052164726ae88512ae3d', + 'pretty_version' => 'v6.0.19', + 'version' => '6.0.19.0', + 'reference' => 'f1d00bddb83a4cb2138564b2150001cb6ce272b1', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/css-selector', 'aliases' => array(), @@ -716,9 +707,9 @@ 'dev_requirement' => false, ), 'symfony/dom-crawler' => array( - 'pretty_version' => 'v5.4.11', - 'version' => '5.4.11.0', - 'reference' => '0b900ca5576ecd59e08c76127e616667cfe427a7', + 'pretty_version' => 'v6.0.19', + 'version' => '6.0.19.0', + 'reference' => '622578ff158318b1b49d95068bd6b66c713601e9', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/dom-crawler', 'aliases' => array(), @@ -776,9 +767,9 @@ 'dev_requirement' => false, ), 'symfony/polyfill-ctype' => array( - 'pretty_version' => 'v1.28.0', - 'version' => '1.28.0.0', - 'reference' => 'ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb', + 'pretty_version' => 'v1.29.0', + 'version' => '1.29.0.0', + 'reference' => 'ef4d7e442ca910c4764bce785146269b30cb5fc4', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/polyfill-ctype', 'aliases' => array(), @@ -812,9 +803,9 @@ 'dev_requirement' => false, ), 'symfony/polyfill-mbstring' => array( - 'pretty_version' => 'v1.28.0', - 'version' => '1.28.0.0', - 'reference' => '42292d99c55abe617799667f454222c54c60e229', + 'pretty_version' => 'v1.29.0', + 'version' => '1.29.0.0', + 'reference' => '9773676c8a1bb1f8d4340a62efe641cf76eda7ec', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/polyfill-mbstring', 'aliases' => array(), @@ -839,9 +830,9 @@ 'dev_requirement' => false, ), 'symfony/polyfill-php80' => array( - 'pretty_version' => 'v1.28.0', - 'version' => '1.28.0.0', - 'reference' => '6caa57379c4aec19c0a12a38b59b26487dcfe4b5', + 'pretty_version' => 'v1.29.0', + 'version' => '1.29.0.0', + 'reference' => '87b68208d5c1188808dd7839ee1e6c8ec3b02f1b', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/polyfill-php80', 'aliases' => array(), diff --git a/fusonic/linq/LICENSE b/fusonic/linq/LICENSE deleted file mode 100644 index 1617dcba4..000000000 --- a/fusonic/linq/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) 2014 Fusonic GmbH (http://www.fusonic.net) - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/fusonic/linq/src/Fusonic/Linq/GroupedLinq.php b/fusonic/linq/src/Fusonic/Linq/GroupedLinq.php deleted file mode 100644 index 2a2bb5107..000000000 --- a/fusonic/linq/src/Fusonic/Linq/GroupedLinq.php +++ /dev/null @@ -1,35 +0,0 @@ -groupKey = $groupKey; - } - - public function key() - { - return $this->groupKey; - } -} \ No newline at end of file diff --git a/fusonic/linq/src/Fusonic/Linq/Helper/LinqHelper.php b/fusonic/linq/src/Fusonic/Linq/Helper/LinqHelper.php deleted file mode 100644 index f3e8c9aea..000000000 --- a/fusonic/linq/src/Fusonic/Linq/Helper/LinqHelper.php +++ /dev/null @@ -1,67 +0,0 @@ -getIterator(); - } - else if($value instanceof \Iterator) { - return $value; - } - - throw new \UnexpectedValueException("Value must be an array, or implement either the \IteratorAggregate or \Iterator interface"); - } - - public static function isIterable($param) - { - return is_array($param) - || $param instanceof \IteratorAggregate - || $param instanceof \Iterator; - } -} \ No newline at end of file diff --git a/fusonic/linq/src/Fusonic/Linq/Iterator/DistinctIterator.php b/fusonic/linq/src/Fusonic/Linq/Iterator/DistinctIterator.php deleted file mode 100644 index 7651fbfd3..000000000 --- a/fusonic/linq/src/Fusonic/Linq/Iterator/DistinctIterator.php +++ /dev/null @@ -1,62 +0,0 @@ -iterator = $iterator; - } - - public function current() - { - return $this->distinct->current(); - } - - public function next() - { - $this->distinct->next(); - } - - public function key() - { - return $this->distinct->key(); - } - - public function valid() - { - return $this->distinct->valid(); - } - - public function rewind() - { - if ($this->distinct === null) { - $this->getDistincts(); - } - - $this->distinct->rewind(); - } - - private function getDistincts() - { - $data = iterator_to_array($this->iterator); - $distinct = array_unique($data); - $this->distinct = new \ArrayIterator($distinct); - } -} diff --git a/fusonic/linq/src/Fusonic/Linq/Iterator/ExceptIterator.php b/fusonic/linq/src/Fusonic/Linq/Iterator/ExceptIterator.php deleted file mode 100644 index 18d3c2ea0..000000000 --- a/fusonic/linq/src/Fusonic/Linq/Iterator/ExceptIterator.php +++ /dev/null @@ -1,65 +0,0 @@ -first = $first; - $this->second = $second; - } - - public function current() - { - return $this->result->current(); - } - - public function next() - { - $this->result->next(); - } - - public function key() - { - return $this->result->key(); - } - - public function valid() - { - return $this->result->valid(); - } - - public function rewind() - { - if ($this->result === null) { - $this->getResult(); - } - - $this->result->rewind(); - } - - private function getResult() - { - $firstArray = iterator_to_array($this->first); - $secondArray = iterator_to_array($this->second); - $this->result = new ArrayIterator(array_diff($firstArray, $secondArray)); - } -} diff --git a/fusonic/linq/src/Fusonic/Linq/Iterator/GroupIterator.php b/fusonic/linq/src/Fusonic/Linq/Iterator/GroupIterator.php deleted file mode 100644 index 0b2501790..000000000 --- a/fusonic/linq/src/Fusonic/Linq/Iterator/GroupIterator.php +++ /dev/null @@ -1,74 +0,0 @@ -iterator = $iterator; - $this->keySelector = $keySelector; - } - - public function current() - { - $current = $this->grouped->current(); - return new GroupedLinq($current['key'], new \ArrayIterator($current['values'])); - } - - public function next() - { - $this->grouped->next(); - } - - public function key() - { - return $this->grouped->key(); - } - - public function valid() - { - return $this->grouped->valid(); - } - - public function rewind() - { - if ($this->grouped === null) { - $this->doGroup(); - } - - $this->grouped->rewind(); - } - - private function doGroup() - { - $keySelector = $this->keySelector; - $this->grouped = new \ArrayIterator(array()); - foreach ($this->iterator as $value) { - $key = $keySelector($value); - if (!isset($this->grouped[$key])) { - $this->grouped[$key] = array('key' => $key, 'values'=> array()); - } - - $this->grouped[$key]['values'][] = $value; - } - } -} diff --git a/fusonic/linq/src/Fusonic/Linq/Iterator/IntersectIterator.php b/fusonic/linq/src/Fusonic/Linq/Iterator/IntersectIterator.php deleted file mode 100644 index d08c2efe1..000000000 --- a/fusonic/linq/src/Fusonic/Linq/Iterator/IntersectIterator.php +++ /dev/null @@ -1,65 +0,0 @@ -first = $first; - $this->second = $second; - } - - public function current() - { - return $this->intersections->current(); - } - - public function next() - { - $this->intersections->next(); - } - - public function key() - { - return $this->intersections->key(); - } - - public function valid() - { - return $this->intersections->valid(); - } - - public function rewind() - { - if ($this->intersections === null) { - $this->calcIntersections(); - } - - $this->intersections->rewind(); - } - - private function calcIntersections() - { - $firstArray = iterator_to_array($this->first); - $secondArray = iterator_to_array($this->second); - $this->intersections = new ArrayIterator(array_intersect($firstArray, $secondArray)); - } -} diff --git a/fusonic/linq/src/Fusonic/Linq/Iterator/OfTypeIterator.php b/fusonic/linq/src/Fusonic/Linq/Iterator/OfTypeIterator.php deleted file mode 100644 index 46a59482f..000000000 --- a/fusonic/linq/src/Fusonic/Linq/Iterator/OfTypeIterator.php +++ /dev/null @@ -1,94 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Fusonic\Linq\Iterator; - -use FilterIterator; -use Fusonic\Linq\Helper; -use Iterator; - -/** - * Iterator for filtering the Linq query with a specified type. - * @package Fusonic\Linq\Iterator - */ -final class OfTypeIterator - extends - \FilterIterator -{ - /** - * @var callable $acceptCallback - */ - private $acceptCallback; - - /** - * Initializes an instance of OfTypeIterator. - * - * @param Iterator $iterator - * @param string $type - */ - public function __construct(Iterator $iterator, $type) - { - parent::__construct($iterator); - - switch (strtolower($type)) - { - case 'int': - case 'integer': - $this->acceptCallback = function ($current) - { - return is_int($current); - }; - break; - case 'float': - case 'double': - $this->acceptCallback = function ($current) - { - return is_float($current); - }; - break; - case 'string': - $this->acceptCallback = function ($current) - { - return is_string($current); - }; - break; - case 'bool': - case 'boolean': - $this->acceptCallback = function ($current) - { - return is_bool($current); - }; - break; - - default: - $this->acceptCallback = function ($current) use ($type) - { - return $current instanceof $type; - }; - } - } - - /** - * (PHP 5 >= 5.1.0)
- * Check whether the current element of the iterator is acceptable - * @link http://php.net/manual/en/filteriterator.accept.php - * @return bool true if the current element is acceptable, otherwise false. - */ - public function accept() - { - /** @var mixed $current */ - $current = $this->current(); - /** @var callable $func */ - $func = $this->acceptCallback; - - return $func($current); - } -} \ No newline at end of file diff --git a/fusonic/linq/src/Fusonic/Linq/Iterator/OrderIterator.php b/fusonic/linq/src/Fusonic/Linq/Iterator/OrderIterator.php deleted file mode 100644 index 732e79eb2..000000000 --- a/fusonic/linq/src/Fusonic/Linq/Iterator/OrderIterator.php +++ /dev/null @@ -1,113 +0,0 @@ -iterator = $items; - $this->direction = $direction; - $this->orderKeyFunc = $orderKeyFunc; - } - - public function current() - { - return $this->orderedIterator->current(); - } - - public function next() - { - $this->orderedIterator->next(); - } - - public function key() - { - return $this->orderedIterator->key(); - } - - public function valid() - { - return $this->orderedIterator->valid(); - } - - public function rewind() - { - if ($this->orderedIterator == null) { - $this->orderItems(); - } - $this->orderedIterator->rewind(); - } - - public function orderItems() - { - $orderKeyFunc = $this->orderKeyFunc; - $direction = $this->direction; - - $itemIterator = $this->iterator; - $itemIterator->rewind(); - if (!$itemIterator->valid()) { - $this->orderedIterator = new ArrayIterator(); - return; - } - - $firstOrderKey = $orderKeyFunc($itemIterator->current()); - - $sortType = Helper\LinqHelper::LINQ_ORDER_TYPE_NUMERIC; - - if ($firstOrderKey instanceof \DateTime) { - $sortType = Helper\LinqHelper::LINQ_ORDER_TYPE_DATETIME; - } elseif (!is_numeric($firstOrderKey)) { - $sortType = Helper\LinqHelper::LINQ_ORDER_TYPE_ALPHANUMERIC; - } - - $keyMap = array(); - $valueMap = array(); - - foreach ($itemIterator as $value) { - $orderKey = $orderKeyFunc != null ? $orderKeyFunc($value) : $value; - if ($sortType == Helper\LinqHelper::LINQ_ORDER_TYPE_DATETIME) { - $orderKey = $orderKey->getTimeStamp(); - } - $keyMap[] = $orderKey; - $valueMap[] = $value; - } - - if ($sortType == Helper\LinqHelper::LINQ_ORDER_TYPE_DATETIME) { - $sortType = Helper\LinqHelper::LINQ_ORDER_TYPE_NUMERIC; - } - - if ($direction == Helper\LinqHelper::LINQ_ORDER_ASC) { - asort($keyMap, $sortType == Helper\LinqHelper::LINQ_ORDER_TYPE_NUMERIC ? SORT_NUMERIC : SORT_LOCALE_STRING); - } else { - arsort($keyMap, $sortType == Helper\LinqHelper::LINQ_ORDER_TYPE_NUMERIC ? SORT_NUMERIC : SORT_LOCALE_STRING); - } - - $sorted = new ArrayIterator(array()); - foreach ($keyMap as $key => $value) { - $sorted[] = $valueMap[$key]; - } - - $this->orderedIterator = $sorted; - } -} diff --git a/fusonic/linq/src/Fusonic/Linq/Iterator/SelectIterator.php b/fusonic/linq/src/Fusonic/Linq/Iterator/SelectIterator.php deleted file mode 100644 index aa698b3d2..000000000 --- a/fusonic/linq/src/Fusonic/Linq/Iterator/SelectIterator.php +++ /dev/null @@ -1,37 +0,0 @@ -selector = $selector; - } - - public function current() - { - $selector = $this->selector; - return $selector(parent::current()); - } -} diff --git a/fusonic/linq/src/Fusonic/Linq/Iterator/SelectManyIterator.php b/fusonic/linq/src/Fusonic/Linq/Iterator/SelectManyIterator.php deleted file mode 100644 index 310b8bdb6..000000000 --- a/fusonic/linq/src/Fusonic/Linq/Iterator/SelectManyIterator.php +++ /dev/null @@ -1,84 +0,0 @@ -iterator = $iterator; - } - - public function current() - { - if ($this->currentIterator != null) { - return $this->currentIterator->current(); - } - - return null; - } - - public function next() - { - if ($this->currentIterator != null) { - $this->currentIterator->next(); - - if (!$this->currentIterator->valid()) { - $this->iterator->next(); - if ($this->iterator->valid()) { - $this->currentIterator = Helper\LinqHelper::getIteratorOrThrow($this->iterator->current()); - if ($this->currentIterator != null) { - $this->currentIterator->rewind(); - $this->key++; - } - } - } else { - $this->key++; - } - } - } - - public function key() - { - return $this->key; - } - - public function valid() - { - $current = $this->currentIterator; - return $current != null && $current->valid(); - } - - public function rewind() - { - $this->iterator->rewind(); - if ($this->iterator->valid()) { - $current = $this->iterator->current(); - $this->currentIterator = Helper\LinqHelper::getIteratorOrThrow($current); - if ($this->currentIterator != null) { - $this->currentIterator->rewind(); - } - } else { - $this->currentIterator = null; - } - - $this->key = 0; - } -} \ No newline at end of file diff --git a/fusonic/linq/src/Fusonic/Linq/Iterator/WhereIterator.php b/fusonic/linq/src/Fusonic/Linq/Iterator/WhereIterator.php deleted file mode 100644 index 1a757e008..000000000 --- a/fusonic/linq/src/Fusonic/Linq/Iterator/WhereIterator.php +++ /dev/null @@ -1,34 +0,0 @@ -func = $func; - } - - public function accept() - { - $func = $this->func; - $current = $this->current(); - return Helper\LinqHelper::getBoolOrThrowException($func($current)); - } -} \ No newline at end of file diff --git a/fusonic/linq/src/Fusonic/Linq/Linq.php b/fusonic/linq/src/Fusonic/Linq/Linq.php deleted file mode 100644 index f9a568105..000000000 --- a/fusonic/linq/src/Fusonic/Linq/Linq.php +++ /dev/null @@ -1,732 +0,0 @@ -. - */ -class Linq implements IteratorAggregate, Countable -{ - private $iterator; - - /** - * Creates a new Linq object using the provided dataSource. - * - * @param array|\Iterator|IteratorAggregate $dataSource A Traversable sequence as data source. - */ - public function __construct($dataSource) - { - LinqHelper::assertArgumentIsIterable($dataSource, "dataSource"); - $dataSource = LinqHelper::getIteratorOrThrow($dataSource); - - $this->iterator = $dataSource; - } - - /** - * Creates a new Linq object using the provided dataDataSource. - * This is the recommended way for getting a new Linq instance. - * - * @param array|\Iterator|IteratorAggregate $dataSource A Traversable sequence as data source. - * @return Linq - */ - public static function from($dataSource) - { - return new Linq($dataSource); - } - - /** - * Generates a sequence of integral numbers within a specified range. - * - * @param $start The value of the first integer in the sequence. - * @param $count The number of sequential integers to generate. - * @return Linq An sequence that contains a range of sequential int numbers. - * @throws \OutOfRangeException - */ - public static function range($start, $count) - { - if ($count < 0) { - throw new OutOfRangeException('$count must be not be negative.'); - } - - return new Linq(range($start, $start + $count - 1)); - } - - /** - * Filters the Linq object according to func return result. - * - * @param callback $func A func that returns boolean - * @return Linq Filtered results according to $func - */ - public function where($func) - { - return new Linq(new WhereIterator($this->iterator, $func)); - } - - /** - * Filters the Linq object according to type. - * - * @param string $type - * - * @return Linq Filtered results according to $func - */ - public function ofType($type) - { - return new Linq(new OfTypeIterator($this->iterator, $type)); - } - - /** - * Bypasses a specified number of elements and then returns the remaining elements. - * - * @param int $count The number of elements to skip before returning the remaining elements. - * @return Linq A Linq object that contains the elements that occur after the specified index. - */ - public function skip($count) - { - // If its an array iterator we must check the arrays bounds are greater than the skip count. - // This is because the LimitIterator will use the seek() method which will throw an exception if $count > array.bounds. - $innerIterator = $this->iterator; - if ($innerIterator instanceof \ArrayIterator) { - if ($count >= $innerIterator->count()) { - return new Linq(array()); - } - } - - return new Linq(new \LimitIterator($innerIterator, $count, -1)); - } - - /** - * Returns a specified number of contiguous elements from the start of a sequence - * - * @param int $count The number of elements to return. - * @return Linq A Linq object that contains the specified number of elements from the start. - */ - public function take($count) - { - if ($count == 0) { - return new Linq(array()); - } - - return new Linq(new \LimitIterator($this->iterator, 0, $count)); - } - - /** - * Applies an accumulator function over a sequence. - * The aggregate method makes it simple to perform a calculation over a sequence of values. - * This method works by calling $func one time for each element. - * The first element of source is used as the initial aggregate value if $seed parameter is not specified. - * If $seed is specified, this value will be used as the first value. - * - * @param callback $func An accumulator function to be invoked on each element. - * @param mixed $seed - * @throws \RuntimeException if the input sequence contains no elements. - * @return mixed Returns the final result of $func. - */ - public function aggregate($func, $seed = null) - { - $result = null; - $first = true; - - if ($seed !== null) { - $result = $seed; - $first = false; - } - - foreach ($this->iterator as $current) { - if (!$first) { - $result = $func($result, $current); - } else { - $result = $current; - $first = false; - } - } - if ($first) { - throw new \RuntimeException("The input sequence contains no elements."); - } - return $result; - } - - /** - * Splits the sequence in chunks according to $chunksize. - * - * @param $chunksize Specifies how many elements are grouped together per chunk. - * @throws \InvalidArgumentException - * @return Linq - */ - public function chunk($chunksize) - { - if ($chunksize < 1) { - throw new \InvalidArgumentException("chunksize", $chunksize); - } - - $i = -1; - return $this->select( - function ($x) use (&$i) { - $i++; - return array("index" => $i, "value" => $x); - } - ) - ->groupBy( - function ($pair) use ($chunksize) { - return $pair["index"] / $chunksize; - } - ) - ->select( - function (GroupedLinq $group) { - return $group->select( - function ($v) { - return $v["value"]; - } - ); - } - ); - } - - /** - * Determines whether all elements satisfy a condition. - * - * @param callback $func A function to test each element for a condition. - * @return bool True if every element passes the test in the specified func, or if the sequence is empty; otherwise, false. - */ - public function all($func) - { - foreach ($this->iterator as $current) { - $match = LinqHelper::getBoolOrThrowException($func($current)); - if (!$match) { - return false; - } - } - return true; - } - - /** - * Determines whether any element exists or satisfies a condition by invoking $func. - * - * @param callback $func A function to test each element for a condition or NULL to determine if any element exists. - * @return bool True if no $func given and the source sequence contains any elements or True if any elements passed the test in the specified func; otherwise, false. - */ - public function any($func = null) - { - foreach ($this->iterator as $current) { - if ($func === null) { - return true; - } - - $match = LinqHelper::getBoolOrThrowException($func($current)); - if ($match) { - return true; - } - } - return false; - } - - /** - * Counts the elements of this Linq sequence. - * @return int - */ - public function count() - { - if ($this->iterator instanceof Countable) { - return $this->iterator->count(); - } - - return iterator_count($this->iterator); - } - - /** - * Computes the average of all numeric values. Uses $func to obtain the value on each element. - * - * @param callback $func A func that returns any numeric type (int, float etc.) - * @throws \UnexpectedValueException if an item of the sequence is not a numeric value. - * @return double Average of items - */ - public function average($func = null) - { - $resultTotal = 0; - $itemCount = 0; - - $source = $this->getSelectIteratorOrInnerIterator($func); - - foreach ($source as $item) { - if (!is_numeric($item)) { - throw new UnexpectedValueException("Cannot calculate an average on a none numeric value"); - } - - $resultTotal += $item; - $itemCount++; - } - return $itemCount == 0 ? 0 : ($resultTotal / $itemCount); - } - - /** - * Sorts the elements in ascending order according to a key provided by $func. - * - * @param callback $func A function to extract a key from an element. - * @return Linq A new Linq instance whose elements are sorted ascending according to a key. - */ - public function orderBy($func) - { - return $this->order($func, LinqHelper::LINQ_ORDER_ASC); - } - - /** - * Sorts the elements in descending order according to a key provided by $func. - * - * @param callback $func A function to extract a key from an element. - * @return Linq A new Linq instance whose elements are sorted descending according to a key. - */ - public function orderByDescending($func) - { - return $this->order($func, LinqHelper::LINQ_ORDER_DESC); - } - - private function order($func, $direction = LinqHelper::LINQ_ORDER_ASC) - { - return new Linq(new OrderIterator($this->iterator, $func, $direction)); - } - - /** - * Gets the sum of all items or by invoking a transform function on each item to get a numeric value. - * - * @param callback $func A func that returns any numeric type (int, float etc.) from the given element, or NULL to use the element itself. - * @throws \UnexpectedValueException if any element is not a numeric value. - * @return double The sum of all items. - */ - public function sum($func = null) - { - $sum = 0; - $iterator = $this->getSelectIteratorOrInnerIterator($func); - foreach ($iterator as $value) { - if (!is_numeric($value)) { - throw new UnexpectedValueException("sum() only works on numeric values."); - } - - $sum += $value; - } - return $sum; - } - - /** - * Gets the minimum item value of all items or by invoking a transform function on each item to get a numeric value. - * - * @param callback $func A func that returns any numeric type (int, float etc.) from the given element, or NULL to use the element itself. - * @throws \RuntimeException if the sequence contains no elements - * @throws \UnexpectedValueException - * @return double Minimum item value - */ - public function min($func = null) - { - $min = null; - $iterator = $this->getSelectIteratorOrInnerIterator($func); - foreach ($iterator as $value) { - if (!is_numeric($value) && !is_string($value) && !($value instanceof \DateTime)) { - throw new UnexpectedValueException("min() only works on numeric values, strings and DateTime objects."); - } - - if (is_null($min)) { - $min = $value; - } elseif ($min > $value) { - $min = $value; - } - } - - if ($min === null) { - throw new \RuntimeException("Cannot calculate min() as the Linq sequence contains no elements."); - } - - return $min; - } - - /** - * Returns the maximum item value according to $func - * - * @param callback $func A func that returns any numeric type (int, float etc.) - * @throws \RuntimeException if the sequence contains no elements - * @throws \UnexpectedValueException if any element is not a numeric value or a string. - * @return double Maximum item value - */ - public function max($func = null) - { - $max = null; - $iterator = $this->getSelectIteratorOrInnerIterator($func); - foreach ($iterator as $value) { - if (!is_numeric($value) && !is_string($value) && !($value instanceof \DateTime)) { - throw new UnexpectedValueException("max() only works on numeric values, strings and DateTime objects."); - } - - if (is_null($max)) { - $max = $value; - } elseif ($max < $value) { - $max = $value; - } - } - - if ($max === null) { - throw new \RuntimeException("Cannot calculate max() as the Linq sequence contains no elements."); - } - - return $max; - } - - /** - * Projects each element into a new form by invoking the selector function. - * - * @param callback $func A transform function to apply to each element. - * @return Linq A new Linq object whose elements are the result of invoking the transform function on each element of the original Linq object. - */ - public function select($func) - { - return new Linq(new SelectIterator($this->iterator, $func)); - } - - /** - * Projects each element of a sequence to a new Linq and flattens the resulting sequences into one sequence. - * - * @param callback $func A func that returns a sequence (array, Linq, Iterator). - * @throws \UnexpectedValueException if an element is not a traversable sequence. - * @return Linq A new Linq object whose elements are the result of invoking the one-to-many transform function on each element of the input sequence. - */ - public function selectMany($func) - { - return new Linq(new SelectManyIterator(new SelectIterator($this->iterator, $func))); - } - - /** - * Performs the specified action on each element of the Linq sequence and returns the Linq sequence. - * @param callback $func A func that will be evaluated for each item in the linq sequence. - * @return Linq The original Linq sequence that was used to perform the foreach. - */ - public function each($func) - { - foreach ($this->iterator as $item) { - $func($item); - } - return $this; - } - - /** - * Determines whether a sequence contains a specified element. - * This function will use php strict comparison (===). If you need custom comparison use the Linq::any($func) method. - * - * @param mixed $value The value to locate in the sequence. - * @return bool True if $value is found within the sequence; otherwise false. - */ - public function contains($value) - { - return $this->any( - function ($x) use ($value) { - return $x === $value; - } - ); - } - - /** - * Concatenates this Linq object with the given sequence. - * - * @param array|\Iterator $second A sequence which will be concatenated with this Linq object. - * @throws InvalidArgumentException if the given sequence is not traversable. - * @return Linq A new Linq object that contains the concatenated elements of the input sequence and the original Linq sequence. - */ - public function concat($second) - { - LinqHelper::assertArgumentIsIterable($second, "second"); - - $allItems = new \ArrayIterator(array($this->iterator, $second)); - - return new Linq(new SelectManyIterator($allItems)); - } - - /** - * Returns distinct item values of this - * - * @param callback $func - * @return Linq Distinct item values of this - */ - public function distinct($func = null) - { - return new Linq(new DistinctIterator($this->getSelectIteratorOrInnerIterator($func))); - } - - /** - * Intersects the Linq sequence with second Iterable sequence. - * - * @param \Iterator|array An iterator to intersect with: - * @return Linq intersected items - */ - public function intersect($second) - { - LinqHelper::assertArgumentIsIterable($second, "second"); - return new Linq(new IntersectIterator($this->iterator, LinqHelper::getIteratorOrThrow($second))); - } - - /** - * Returns all elements except the ones of the given sequence. - * - * @param array|\Iterator $second - * @return Linq Returns all items of this not occuring in $second - */ - public function except($second) - { - LinqHelper::assertArgumentIsIterable($second, "second"); - return new Linq(new ExceptIterator($this->iterator, LinqHelper::getIteratorOrThrow($second))); - } - - /** - * Returns the element at a specified index. - * This method throws an exception if index is out of range. - * To instead return NULL when the specified index is out of range, use the elementAtOrNull method. - * - * @throws \OutOfRangeException if index is less than 0 or greater than or equal to the number of elements in the sequence. - * @param int $index - * @return mixed Item at $index - */ - public function elementAt($index) - { - return $this->getValueAt($index, true); - } - - /** - * Returns the element at a specified index or NULL if the index is out of range. - * - * @param $index - * @return mixed Item at $index - */ - public function elementAtOrNull($index) - { - return $this->getValueAt($index, false); - } - - private function getValueAt($index, $throwEx) - { - $i = 0; - foreach ($this->iterator as $value) { - if ($i == $index) { - return $value; - } - $i++; - } - - if ($throwEx) { - throw new OutOfRangeException("Index is less than 0 or greater than or equal to the number of elements in the sequence."); - } - - return null; - } - - /** - * Groups the object according to the $func generated key - * - * @param callback $keySelector a func that returns an item as key, item can be any type. - * @return GroupedLinq - */ - public function groupBy($keySelector) - { - return new Linq(new GroupIterator($this->iterator, $keySelector)); - } - - /** - * Returns the last element that satisfies a specified condition. - * @throws \RuntimeException if no element satisfies the condition in predicate or the source sequence is empty. - * - * @param callback $func a func that returns boolean. - * @return Object Last item in this - */ - public function last($func = null) - { - return $this->getLast($func, true); - } - - /** - * Returns the last element that satisfies a condition or NULL if no such element is found. - * - * @param callback $func a func that returns boolean. - * @return mixed - */ - public function lastOrNull($func = null) - { - return $this->getLast($func, false); - } - - /** - * Returns the first element that satisfies a specified condition - * @throws \RuntimeException if no element satisfies the condition in predicate -or- the source sequence is empty / does not match any elements. - * - * @param callback $func a func that returns boolean. - * @return mixed - */ - public function first($func = null) - { - return $this->getFirst($func, true); - } - - /** - * Returns the first element, or NULL if the sequence contains no elements. - * - * @param callback $func a func that returns boolean. - * @return mixed - */ - public function firstOrNull($func = null) - { - return $this->getFirst($func, false); - } - - /** - * Returns the only element that satisfies a specified condition. - * - * @throws \RuntimeException if no element exists or if more than one element exists. - * @param callback $func a func that returns boolean. - * @return mixed - */ - public function single($func = null) - { - return $this->getSingle($func, true); - } - - /** - * Returns the only element that satisfies a specified condition or NULL if no such element exists. - * - * @throws \RuntimeException if more than one element satisfies the condition. - * @param callback $func a func that returns boolean. - * @return mixed - */ - public function singleOrNull($func = null) - { - return $this->getSingle($func, false); - } - - - private function getWhereIteratorOrInnerIterator($func) - { - return $func === null ? $this->iterator : new WhereIterator($this->iterator, $func); - } - - private function getSelectIteratorOrInnerIterator($func) - { - return $func === null ? $this->iterator : new SelectIterator($this->iterator, $func); - } - - private function getSingle($func, $throw) - { - $source = $this->getWhereIteratorOrInnerIterator($func); - - $count = 0; - $single = null; - - foreach ($source as $stored) { - $count++; - - if ($count > 1) { - throw new \RuntimeException("The input sequence contains more than 1 elements."); - } - - $single = $stored; - } - - if ($count == 0 && $throw) { - throw new \RuntimeException("The input sequence contains no matching element."); - } - - return $single; - } - - private function getFirst($func, $throw) - { - $source = $this->getWhereIteratorOrInnerIterator($func); - - $count = 0; - $first = null; - - foreach ($source as $stored) { - $count++; - $first = $stored; - break; - } - - if ($count == 0 && $throw) { - throw new \RuntimeException("The input sequence contains no matching element."); - } - - return $first; - } - - private function getLast($func, $throw) - { - $source = $this->getWhereIteratorOrInnerIterator($func); - - $count = 0; - $last = null; - - foreach ($source as $stored) { - $count++; - $last = $stored; - } - - if ($count == 0 && $throw) { - throw new \RuntimeException("The input sequence contains no matching element."); - } - - return $last; - } - - /** - * Creates an Array from this Linq object with key/value selector(s). - * - * @param callback $keySelector a func that returns the array-key for each element. - * @param callback $valueSelector a func that returns the array-value for each element. - * - * @return Array An array with all values. - */ - public function toArray($keySelector = null, $valueSelector = null) - { - if ($keySelector === null && $valueSelector === null) { - return iterator_to_array($this, false); - } elseif ($keySelector == null) { - return iterator_to_array(new SelectIterator($this->getIterator(), $valueSelector), false); - } else { - $array = array(); - foreach ($this as $value) { - $key = $keySelector($value); - $array[$key] = $valueSelector == null ? $value : $valueSelector($value); - } - return $array; - } - } - - /** - * Retrieves the iterator of this Linq class. - * @link http://php.net/manual/en/iteratoraggregate.getiterator.php - * @return Traversable An instance of an object implementing Iterator or - * Traversable - */ - public function getIterator() - { - return $this->iterator; - } -} \ No newline at end of file diff --git a/fusonic/opengraph/src/Consumer.php b/fusonic/opengraph/src/Consumer.php index 25b03febc..74aec6a64 100644 --- a/fusonic/opengraph/src/Consumer.php +++ b/fusonic/opengraph/src/Consumer.php @@ -2,8 +2,6 @@ namespace Fusonic\OpenGraph; -use DOMElement; -use Fusonic\Linq\Linq; use Fusonic\OpenGraph\Objects\ObjectBase; use Fusonic\OpenGraph\Objects\Website; use LogicException; @@ -97,32 +95,20 @@ private function extractOpenGraphData(string $content): ObjectBase { // Get all meta-tags starting with "og:" $ogMetaTags = $crawler->filter("meta[{$t}^='og:']"); + // Create clean property array - $props = Linq::from($ogMetaTags) - ->select( - function (DOMElement $tag) use ($t) { - $name = strtolower(trim($tag->getAttribute($t))); - $value = trim($tag->getAttribute("content")); - return new Property($name, $value); - } - ) - ->toArray(); + $props = []; + foreach ($ogMetaTags as $tag) { + $name = strtolower(trim($tag->getAttribute($t))); + $value = trim($tag->getAttribute("content")); + $props[] = new Property($name, $value); + } + $properties = array_merge($properties, $props); - } - // Create new object of the correct type - $typeProperty = Linq::from($properties) - ->firstOrNull( - function (Property $property) { - return $property->key === Property::TYPE; - } - ); - switch ($typeProperty !== null ? $typeProperty->value : null) { - default: - $object = new Website(); - break; - } + // Create new object + $object = new Website(); // Assign all properties to the object $object->assignProperties($properties, $this->debug); diff --git a/symfony/css-selector/CssSelectorConverter.php b/symfony/css-selector/CssSelectorConverter.php index bbb6afe21..86ccb7958 100644 --- a/symfony/css-selector/CssSelectorConverter.php +++ b/symfony/css-selector/CssSelectorConverter.php @@ -27,10 +27,10 @@ class CssSelectorConverter { private $translator; - private $cache; + private array $cache; - private static $xmlCache = []; - private static $htmlCache = []; + private static array $xmlCache = []; + private static array $htmlCache = []; /** * @param bool $html Whether HTML support should be enabled. Disable it for XML documents @@ -59,10 +59,8 @@ public function __construct(bool $html = true) * * Optionally, a prefix can be added to the resulting XPath * expression with the $prefix parameter. - * - * @return string */ - public function toXPath(string $cssExpr, string $prefix = 'descendant-or-self::') + public function toXPath(string $cssExpr, string $prefix = 'descendant-or-self::'): string { return $this->cache[$prefix][$cssExpr] ?? $this->cache[$prefix][$cssExpr] = $this->translator->cssToXPath($cssExpr, $prefix); } diff --git a/symfony/css-selector/Exception/SyntaxErrorException.php b/symfony/css-selector/Exception/SyntaxErrorException.php index 7deacf9c5..f73860cef 100644 --- a/symfony/css-selector/Exception/SyntaxErrorException.php +++ b/symfony/css-selector/Exception/SyntaxErrorException.php @@ -23,42 +23,27 @@ */ class SyntaxErrorException extends ParseException { - /** - * @return self - */ - public static function unexpectedToken(string $expectedValue, Token $foundToken) + public static function unexpectedToken(string $expectedValue, Token $foundToken): self { return new self(sprintf('Expected %s, but %s found.', $expectedValue, $foundToken)); } - /** - * @return self - */ - public static function pseudoElementFound(string $pseudoElement, string $unexpectedLocation) + public static function pseudoElementFound(string $pseudoElement, string $unexpectedLocation): self { return new self(sprintf('Unexpected pseudo-element "::%s" found %s.', $pseudoElement, $unexpectedLocation)); } - /** - * @return self - */ - public static function unclosedString(int $position) + public static function unclosedString(int $position): self { return new self(sprintf('Unclosed/invalid string at %s.', $position)); } - /** - * @return self - */ - public static function nestedNot() + public static function nestedNot(): self { return new self('Got nested ::not().'); } - /** - * @return self - */ - public static function stringAsFunctionArgument() + public static function stringAsFunctionArgument(): self { return new self('String not allowed as function argument.'); } diff --git a/symfony/css-selector/LICENSE b/symfony/css-selector/LICENSE index 88bf75bb4..008370457 100644 --- a/symfony/css-selector/LICENSE +++ b/symfony/css-selector/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2022 Fabien Potencier +Copyright (c) 2004-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/symfony/css-selector/Node/AbstractNode.php b/symfony/css-selector/Node/AbstractNode.php index 1306aeacb..d99e80a87 100644 --- a/symfony/css-selector/Node/AbstractNode.php +++ b/symfony/css-selector/Node/AbstractNode.php @@ -23,17 +23,10 @@ */ abstract class AbstractNode implements NodeInterface { - /** - * @var string - */ - private $nodeName; + private string $nodeName; public function getNodeName(): string { - if (null === $this->nodeName) { - $this->nodeName = preg_replace('~.*\\\\([^\\\\]+)Node$~', '$1', static::class); - } - - return $this->nodeName; + return $this->nodeName ??= preg_replace('~.*\\\\([^\\\\]+)Node$~', '$1', static::class); } } diff --git a/symfony/css-selector/Node/AttributeNode.php b/symfony/css-selector/Node/AttributeNode.php index 0b6e0ee0a..bca91eb88 100644 --- a/symfony/css-selector/Node/AttributeNode.php +++ b/symfony/css-selector/Node/AttributeNode.php @@ -24,10 +24,10 @@ class AttributeNode extends AbstractNode { private $selector; - private $namespace; - private $attribute; - private $operator; - private $value; + private ?string $namespace; + private string $attribute; + private string $operator; + private ?string $value; public function __construct(NodeInterface $selector, ?string $namespace, string $attribute, string $operator, ?string $value) { diff --git a/symfony/css-selector/Node/ClassNode.php b/symfony/css-selector/Node/ClassNode.php index 1efca808d..0e9376883 100644 --- a/symfony/css-selector/Node/ClassNode.php +++ b/symfony/css-selector/Node/ClassNode.php @@ -24,7 +24,7 @@ class ClassNode extends AbstractNode { private $selector; - private $name; + private string $name; public function __construct(NodeInterface $selector, string $name) { diff --git a/symfony/css-selector/Node/CombinedSelectorNode.php b/symfony/css-selector/Node/CombinedSelectorNode.php index a217a45ed..f5f996974 100644 --- a/symfony/css-selector/Node/CombinedSelectorNode.php +++ b/symfony/css-selector/Node/CombinedSelectorNode.php @@ -24,7 +24,7 @@ class CombinedSelectorNode extends AbstractNode { private $selector; - private $combinator; + private string $combinator; private $subSelector; public function __construct(NodeInterface $selector, string $combinator, NodeInterface $subSelector) diff --git a/symfony/css-selector/Node/ElementNode.php b/symfony/css-selector/Node/ElementNode.php index fbf8ea0f9..b05164fea 100644 --- a/symfony/css-selector/Node/ElementNode.php +++ b/symfony/css-selector/Node/ElementNode.php @@ -23,8 +23,8 @@ */ class ElementNode extends AbstractNode { - private $namespace; - private $element; + private ?string $namespace; + private ?string $element; public function __construct(string $namespace = null, string $element = null) { diff --git a/symfony/css-selector/Node/FunctionNode.php b/symfony/css-selector/Node/FunctionNode.php index c464cf7c0..e91a1662d 100644 --- a/symfony/css-selector/Node/FunctionNode.php +++ b/symfony/css-selector/Node/FunctionNode.php @@ -26,8 +26,8 @@ class FunctionNode extends AbstractNode { private $selector; - private $name; - private $arguments; + private string $name; + private array $arguments; /** * @param Token[] $arguments diff --git a/symfony/css-selector/Node/HashNode.php b/symfony/css-selector/Node/HashNode.php index 94114c095..119b0d57e 100644 --- a/symfony/css-selector/Node/HashNode.php +++ b/symfony/css-selector/Node/HashNode.php @@ -24,7 +24,7 @@ class HashNode extends AbstractNode { private $selector; - private $id; + private string $id; public function __construct(NodeInterface $selector, string $id) { diff --git a/symfony/css-selector/Node/PseudoNode.php b/symfony/css-selector/Node/PseudoNode.php index 12b7bd266..5d6325a5e 100644 --- a/symfony/css-selector/Node/PseudoNode.php +++ b/symfony/css-selector/Node/PseudoNode.php @@ -24,7 +24,7 @@ class PseudoNode extends AbstractNode { private $selector; - private $identifier; + private string $identifier; public function __construct(NodeInterface $selector, string $identifier) { diff --git a/symfony/css-selector/Node/SelectorNode.php b/symfony/css-selector/Node/SelectorNode.php index 6e52b2fa7..55fae1e76 100644 --- a/symfony/css-selector/Node/SelectorNode.php +++ b/symfony/css-selector/Node/SelectorNode.php @@ -24,7 +24,7 @@ class SelectorNode extends AbstractNode { private $tree; - private $pseudoElement; + private ?string $pseudoElement; public function __construct(NodeInterface $tree, string $pseudoElement = null) { diff --git a/symfony/css-selector/Node/Specificity.php b/symfony/css-selector/Node/Specificity.php index b00f6d281..bb8e5e346 100644 --- a/symfony/css-selector/Node/Specificity.php +++ b/symfony/css-selector/Node/Specificity.php @@ -29,9 +29,9 @@ class Specificity public const B_FACTOR = 10; public const C_FACTOR = 1; - private $a; - private $b; - private $c; + private int $a; + private int $b; + private int $c; public function __construct(int $a, int $b, int $c) { diff --git a/symfony/css-selector/Parser/Reader.php b/symfony/css-selector/Parser/Reader.php index 4b43effed..c0b6923a4 100644 --- a/symfony/css-selector/Parser/Reader.php +++ b/symfony/css-selector/Parser/Reader.php @@ -23,9 +23,9 @@ */ class Reader { - private $source; - private $length; - private $position = 0; + private string $source; + private int $length; + private int $position = 0; public function __construct(string $source) { @@ -60,10 +60,7 @@ public function getOffset(string $string) return false === $position ? false : $position - $this->position; } - /** - * @return array|false - */ - public function findPattern(string $pattern) + public function findPattern(string $pattern): array|false { $source = substr($this->source, $this->position); diff --git a/symfony/css-selector/Parser/Token.php b/symfony/css-selector/Parser/Token.php index a053203c0..a538d07f0 100644 --- a/symfony/css-selector/Parser/Token.php +++ b/symfony/css-selector/Parser/Token.php @@ -31,9 +31,9 @@ class Token public const TYPE_NUMBER = 'number'; public const TYPE_STRING = 'string'; - private $type; - private $value; - private $position; + private ?string $type; + private ?string $value; + private ?int $position; public function __construct(?string $type, ?string $value, ?int $position) { diff --git a/symfony/css-selector/Parser/TokenStream.php b/symfony/css-selector/Parser/TokenStream.php index 2085f2dd7..e2c15a642 100644 --- a/symfony/css-selector/Parser/TokenStream.php +++ b/symfony/css-selector/Parser/TokenStream.php @@ -29,34 +29,23 @@ class TokenStream /** * @var Token[] */ - private $tokens = []; + private array $tokens = []; /** * @var Token[] */ - private $used = []; + private array $used = []; - /** - * @var int - */ - private $cursor = 0; - - /** - * @var Token|null - */ + private int $cursor = 0; private $peeked; - - /** - * @var bool - */ - private $peeking = false; + private bool $peeking = false; /** * Pushes a token. * * @return $this */ - public function push(Token $token): self + public function push(Token $token): static { $this->tokens[] = $token; @@ -68,7 +57,7 @@ public function push(Token $token): self * * @return $this */ - public function freeze(): self + public function freeze(): static { return $this; } diff --git a/symfony/css-selector/Parser/Tokenizer/Tokenizer.php b/symfony/css-selector/Parser/Tokenizer/Tokenizer.php index e0dcc5bf1..35c96a484 100644 --- a/symfony/css-selector/Parser/Tokenizer/Tokenizer.php +++ b/symfony/css-selector/Parser/Tokenizer/Tokenizer.php @@ -31,7 +31,7 @@ class Tokenizer /** * @var Handler\HandlerInterface[] */ - private $handlers; + private array $handlers; public function __construct() { diff --git a/symfony/css-selector/Parser/Tokenizer/TokenizerPatterns.php b/symfony/css-selector/Parser/Tokenizer/TokenizerPatterns.php index 5f16ac48f..3c77cf091 100644 --- a/symfony/css-selector/Parser/Tokenizer/TokenizerPatterns.php +++ b/symfony/css-selector/Parser/Tokenizer/TokenizerPatterns.php @@ -23,18 +23,18 @@ */ class TokenizerPatterns { - private $unicodeEscapePattern; - private $simpleEscapePattern; - private $newLineEscapePattern; - private $escapePattern; - private $stringEscapePattern; - private $nonAsciiPattern; - private $nmCharPattern; - private $nmStartPattern; - private $identifierPattern; - private $hashPattern; - private $numberPattern; - private $quotedStringPattern; + private string $unicodeEscapePattern; + private string $simpleEscapePattern; + private string $newLineEscapePattern; + private string $escapePattern; + private string $stringEscapePattern; + private string $nonAsciiPattern; + private string $nmCharPattern; + private string $nmStartPattern; + private string $identifierPattern; + private string $hashPattern; + private string $numberPattern; + private string $quotedStringPattern; public function __construct() { @@ -49,22 +49,22 @@ public function __construct() $this->identifierPattern = '-?(?:'.$this->nmStartPattern.')(?:'.$this->nmCharPattern.')*'; $this->hashPattern = '#((?:'.$this->nmCharPattern.')+)'; $this->numberPattern = '[+-]?(?:[0-9]*\.[0-9]+|[0-9]+)'; - $this->quotedStringPattern = '([^\n\r\f%s]|'.$this->stringEscapePattern.')*'; + $this->quotedStringPattern = '([^\n\r\f\\\\%s]|'.$this->stringEscapePattern.')*'; } public function getNewLineEscapePattern(): string { - return '~^'.$this->newLineEscapePattern.'~'; + return '~'.$this->newLineEscapePattern.'~'; } public function getSimpleEscapePattern(): string { - return '~^'.$this->simpleEscapePattern.'~'; + return '~'.$this->simpleEscapePattern.'~'; } public function getUnicodeEscapePattern(): string { - return '~^'.$this->unicodeEscapePattern.'~i'; + return '~'.$this->unicodeEscapePattern.'~i'; } public function getIdentifierPattern(): string diff --git a/symfony/css-selector/XPath/Extension/NodeExtension.php b/symfony/css-selector/XPath/Extension/NodeExtension.php index aa6f3f704..642702bbb 100644 --- a/symfony/css-selector/XPath/Extension/NodeExtension.php +++ b/symfony/css-selector/XPath/Extension/NodeExtension.php @@ -31,7 +31,7 @@ class NodeExtension extends AbstractExtension public const ATTRIBUTE_NAME_IN_LOWER_CASE = 2; public const ATTRIBUTE_VALUE_IN_LOWER_CASE = 4; - private $flags; + private int $flags; public function __construct(int $flags = 0) { @@ -41,7 +41,7 @@ public function __construct(int $flags = 0) /** * @return $this */ - public function setFlag(int $flag, bool $on): self + public function setFlag(int $flag, bool $on): static { if ($on && !$this->hasFlag($flag)) { $this->flags += $flag; diff --git a/symfony/css-selector/XPath/Translator.php b/symfony/css-selector/XPath/Translator.php index 8ce473036..c0bb29dee 100644 --- a/symfony/css-selector/XPath/Translator.php +++ b/symfony/css-selector/XPath/Translator.php @@ -35,18 +35,18 @@ class Translator implements TranslatorInterface /** * @var ParserInterface[] */ - private $shortcutParsers = []; + private array $shortcutParsers = []; /** * @var Extension\ExtensionInterface[] */ - private $extensions = []; + private array $extensions = []; - private $nodeTranslators = []; - private $combinationTranslators = []; - private $functionTranslators = []; - private $pseudoClassTranslators = []; - private $attributeMatchingTranslators = []; + private array $nodeTranslators = []; + private array $combinationTranslators = []; + private array $functionTranslators = []; + private array $pseudoClassTranslators = []; + private array $attributeMatchingTranslators = []; public function __construct(ParserInterface $parser = null) { @@ -117,7 +117,7 @@ public function selectorToXPath(SelectorNode $selector, string $prefix = 'descen /** * @return $this */ - public function registerExtension(Extension\ExtensionInterface $extension): self + public function registerExtension(Extension\ExtensionInterface $extension): static { $this->extensions[$extension->getName()] = $extension; @@ -145,7 +145,7 @@ public function getExtension(string $name): Extension\ExtensionInterface /** * @return $this */ - public function registerParserShortcut(ParserInterface $shortcut): self + public function registerParserShortcut(ParserInterface $shortcut): static { $this->shortcutParsers[] = $shortcut; diff --git a/symfony/css-selector/XPath/XPathExpr.php b/symfony/css-selector/XPath/XPathExpr.php index e45ce7d8c..a76e30bec 100644 --- a/symfony/css-selector/XPath/XPathExpr.php +++ b/symfony/css-selector/XPath/XPathExpr.php @@ -23,9 +23,9 @@ */ class XPathExpr { - private $path; - private $element; - private $condition; + private string $path; + private string $element; + private string $condition; public function __construct(string $path = '', string $element = '*', string $condition = '', bool $starPrefix = false) { @@ -46,7 +46,7 @@ public function getElement(): string /** * @return $this */ - public function addCondition(string $condition): self + public function addCondition(string $condition): static { $this->condition = $this->condition ? sprintf('(%s) and (%s)', $this->condition, $condition) : $condition; @@ -61,7 +61,7 @@ public function getCondition(): string /** * @return $this */ - public function addNameTest(): self + public function addNameTest(): static { if ('*' !== $this->element) { $this->addCondition('name() = '.Translator::getXpathLiteral($this->element)); @@ -74,7 +74,7 @@ public function addNameTest(): self /** * @return $this */ - public function addStarPrefix(): self + public function addStarPrefix(): static { $this->path .= '*/'; @@ -86,7 +86,7 @@ public function addStarPrefix(): self * * @return $this */ - public function join(string $combiner, self $expr): self + public function join(string $combiner, self $expr): static { $path = $this->__toString().$combiner; diff --git a/symfony/dom-crawler/AbstractUriElement.php b/symfony/dom-crawler/AbstractUriElement.php index 8ff0b992a..c14174251 100644 --- a/symfony/dom-crawler/AbstractUriElement.php +++ b/symfony/dom-crawler/AbstractUriElement.php @@ -55,49 +55,39 @@ public function __construct(\DOMElement $node, string $currentUri = null, ?strin /** * Gets the node associated with this link. - * - * @return \DOMElement */ - public function getNode() + public function getNode(): \DOMElement { return $this->node; } /** * Gets the method associated with this link. - * - * @return string */ - public function getMethod() + public function getMethod(): string { return $this->method ?? 'GET'; } /** * Gets the URI associated with this link. - * - * @return string */ - public function getUri() + public function getUri(): string { return UriResolver::resolve($this->getRawUri(), $this->currentUri); } /** * Returns raw URI data. - * - * @return string */ - abstract protected function getRawUri(); + abstract protected function getRawUri(): string; /** * Returns the canonicalized URI path (see RFC 3986, section 5.2.4). * * @param string $path URI path - * - * @return string */ - protected function canonicalizePath(string $path) + protected function canonicalizePath(string $path): string { if ('' === $path || '/' === $path) { return $path; diff --git a/symfony/dom-crawler/Crawler.php b/symfony/dom-crawler/Crawler.php index a32bc1dd8..3cd410fd7 100644 --- a/symfony/dom-crawler/Crawler.php +++ b/symfony/dom-crawler/Crawler.php @@ -30,58 +30,40 @@ class Crawler implements \Countable, \IteratorAggregate /** * The default namespace prefix to be used with XPath and CSS expressions. - * - * @var string */ - private $defaultNamespacePrefix = 'default'; + private string $defaultNamespacePrefix = 'default'; /** * A map of manually registered namespaces. * * @var array */ - private $namespaces = []; + private array $namespaces = []; /** * A map of cached namespaces. - * - * @var \ArrayObject */ - private $cachedNamespaces; + private \ArrayObject $cachedNamespaces; - /** - * The base href value. - * - * @var string|null - */ - private $baseHref; - - /** - * @var \DOMDocument|null - */ - private $document; + private ?string $baseHref; + private ?\DOMDocument $document = null; /** * @var list<\DOMNode> */ - private $nodes = []; + private array $nodes = []; /** * Whether the Crawler contains HTML or XML content (used when converting CSS to XPath). - * - * @var bool */ - private $isHtml = true; + private bool $isHtml = true; - /** - * @var HTML5|null - */ private $html5Parser; /** * @param \DOMNodeList|\DOMNode|\DOMNode[]|string|null $node A Node to use as the base for the crawling */ - public function __construct($node = null, string $uri = null, string $baseHref = null) + public function __construct(\DOMNodeList|\DOMNode|array|string $node = null, string $uri = null, string $baseHref = null) { $this->uri = $uri; $this->baseHref = $baseHref ?: $uri; @@ -93,20 +75,16 @@ public function __construct($node = null, string $uri = null, string $baseHref = /** * Returns the current URI. - * - * @return string|null */ - public function getUri() + public function getUri(): ?string { return $this->uri; } /** * Returns base href. - * - * @return string|null */ - public function getBaseHref() + public function getBaseHref(): ?string { return $this->baseHref; } @@ -131,7 +109,7 @@ public function clear() * * @throws \InvalidArgumentException when node is not the expected type */ - public function add($node) + public function add(\DOMNodeList|\DOMNode|array|string|null $node) { if ($node instanceof \DOMNodeList) { $this->addNodeList($node); @@ -235,9 +213,6 @@ public function addXmlContent(string $content, string $charset = 'UTF-8', int $o } $internalErrors = libxml_use_internal_errors(true); - if (\LIBXML_VERSION < 20900) { - $disableEntities = libxml_disable_entity_loader(true); - } $dom = new \DOMDocument('1.0', $charset); $dom->validateOnParse = true; @@ -247,9 +222,6 @@ public function addXmlContent(string $content, string $charset = 'UTF-8', int $o } libxml_use_internal_errors($internalErrors); - if (\LIBXML_VERSION < 20900) { - libxml_disable_entity_loader($disableEntities); - } $this->addDocument($dom); @@ -323,10 +295,8 @@ public function addNode(\DOMNode $node) /** * Returns a node given its position in the node list. - * - * @return static */ - public function eq(int $position) + public function eq(int $position): static { if (isset($this->nodes[$position])) { return $this->createSubCrawler($this->nodes[$position]); @@ -351,7 +321,7 @@ public function eq(int $position) * * @return array An array of values returned by the anonymous function */ - public function each(\Closure $closure) + public function each(\Closure $closure): array { $data = []; foreach ($this->nodes as $i => $node) { @@ -363,10 +333,8 @@ public function each(\Closure $closure) /** * Slices the list of nodes by $offset and $length. - * - * @return static */ - public function slice(int $offset = 0, int $length = null) + public function slice(int $offset = 0, int $length = null): static { return $this->createSubCrawler(\array_slice($this->nodes, $offset, $length)); } @@ -377,10 +345,8 @@ public function slice(int $offset = 0, int $length = null) * To remove a node from the list, the anonymous function must return false. * * @param \Closure $closure An anonymous function - * - * @return static */ - public function reduce(\Closure $closure) + public function reduce(\Closure $closure): static { $nodes = []; foreach ($this->nodes as $i => $node) { @@ -394,20 +360,16 @@ public function reduce(\Closure $closure) /** * Returns the first node of the current selection. - * - * @return static */ - public function first() + public function first(): static { return $this->eq(0); } /** * Returns the last node of the current selection. - * - * @return static */ - public function last() + public function last(): static { return $this->eq(\count($this->nodes) - 1); } @@ -415,11 +377,9 @@ public function last() /** * Returns the siblings nodes of the current selection. * - * @return static - * * @throws \InvalidArgumentException When current node is empty */ - public function siblings() + public function siblings(): static { if (!$this->nodes) { throw new \InvalidArgumentException('The current node list is empty.'); @@ -470,11 +430,9 @@ public function closest(string $selector): ?self /** * Returns the next siblings nodes of the current selection. * - * @return static - * * @throws \InvalidArgumentException When current node is empty */ - public function nextAll() + public function nextAll(): static { if (!$this->nodes) { throw new \InvalidArgumentException('The current node list is empty.'); @@ -486,11 +444,9 @@ public function nextAll() /** * Returns the previous sibling nodes of the current selection. * - * @return static - * * @throws \InvalidArgumentException */ - public function previousAll() + public function previousAll(): static { if (!$this->nodes) { throw new \InvalidArgumentException('The current node list is empty.'); @@ -499,28 +455,12 @@ public function previousAll() return $this->createSubCrawler($this->sibling($this->getNode(0), 'previousSibling')); } - /** - * Returns the parent nodes of the current selection. - * - * @return static - * - * @throws \InvalidArgumentException When current node is empty - */ - public function parents() - { - trigger_deprecation('symfony/dom-crawler', '5.3', 'The %s() method is deprecated, use ancestors() instead.', __METHOD__); - - return $this->ancestors(); - } - /** * Returns the ancestors of the current selection. * - * @return static - * * @throws \InvalidArgumentException When the current node is empty */ - public function ancestors() + public function ancestors(): static { if (!$this->nodes) { throw new \InvalidArgumentException('The current node list is empty.'); @@ -541,12 +481,10 @@ public function ancestors() /** * Returns the children nodes of the current selection. * - * @return static - * * @throws \InvalidArgumentException When current node is empty * @throws \RuntimeException If the CssSelector Component is not available and $selector is provided */ - public function children(string $selector = null) + public function children(string $selector = null): static { if (!$this->nodes) { throw new \InvalidArgumentException('The current node list is empty.'); @@ -567,11 +505,9 @@ public function children(string $selector = null) /** * Returns the attribute value of the first node of the list. * - * @return string|null - * * @throws \InvalidArgumentException When current node is empty */ - public function attr(string $attribute) + public function attr(string $attribute): ?string { if (!$this->nodes) { throw new \InvalidArgumentException('The current node list is empty.'); @@ -585,11 +521,9 @@ public function attr(string $attribute) /** * Returns the node name of the first node of the list. * - * @return string - * * @throws \InvalidArgumentException When current node is empty */ - public function nodeName() + public function nodeName(): string { if (!$this->nodes) { throw new \InvalidArgumentException('The current node list is empty.'); @@ -606,11 +540,9 @@ public function nodeName() * @param string|null $default When not null: the value to return when the current node is empty * @param bool $normalizeWhitespace Whether whitespaces should be trimmed and normalized to single spaces * - * @return string - * * @throws \InvalidArgumentException When current node is empty */ - public function text(string $default = null, bool $normalizeWhitespace = true) + public function text(string $default = null, bool $normalizeWhitespace = true): string { if (!$this->nodes) { if (null !== $default) { @@ -623,7 +555,7 @@ public function text(string $default = null, bool $normalizeWhitespace = true) $text = $this->getNode(0)->nodeValue; if ($normalizeWhitespace) { - return trim(preg_replace('/(?:\s{2,}+|[^\S ])/', ' ', $text)); + return trim(preg_replace("/(?:[ \n\r\t\x0C]{2,}+|[\n\r\t\x0C])/", ' ', $text), " \n\r\t\x0C"); } return $text; @@ -642,11 +574,9 @@ public function innerText(): string * * @param string|null $default When not null: the value to return when the current node is empty * - * @return string - * * @throws \InvalidArgumentException When current node is empty */ - public function html(string $default = null) + public function html(string $default = null): string { if (!$this->nodes) { if (null !== $default) { @@ -692,10 +622,8 @@ public function outerHtml(): string * * Since an XPath expression might evaluate to either a simple type or a \DOMNodeList, * this method will return either an array of simple types or a new Crawler instance. - * - * @return array|Crawler */ - public function evaluate(string $xpath) + public function evaluate(string $xpath): array|Crawler { if (null === $this->document) { throw new \LogicException('Cannot evaluate the expression on an uninitialized crawler.'); @@ -723,10 +651,8 @@ public function evaluate(string $xpath) * Example: * * $crawler->filter('h1 a')->extract(['_text', 'href']); - * - * @return array */ - public function extract(array $attributes) + public function extract(array $attributes): array { $count = \count($attributes); @@ -756,10 +682,8 @@ public function extract(array $attributes) * is considered as a fake parent of the elements inside it. * This means that a child selector "div" or "./div" will match only * the div elements of the current crawler, not their children. - * - * @return static */ - public function filterXPath(string $xpath) + public function filterXPath(string $xpath): static { $xpath = $this->relativize($xpath); @@ -776,11 +700,9 @@ public function filterXPath(string $xpath) * * This method only works if you have installed the CssSelector Symfony Component. * - * @return static - * * @throws \RuntimeException if the CssSelector Component is not available */ - public function filter(string $selector) + public function filter(string $selector): static { $converter = $this->createCssSelectorConverter(); @@ -790,10 +712,8 @@ public function filter(string $selector) /** * Selects links by name or alt value for clickable images. - * - * @return static */ - public function selectLink(string $value) + public function selectLink(string $value): static { return $this->filterRelativeXPath( sprintf('descendant-or-self::a[contains(concat(\' \', normalize-space(string(.)), \' \'), %1$s) or ./img[contains(concat(\' \', normalize-space(string(@alt)), \' \'), %1$s)]]', static::xpathLiteral(' '.$value.' ')) @@ -802,10 +722,8 @@ public function selectLink(string $value) /** * Selects images by alt value. - * - * @return static */ - public function selectImage(string $value) + public function selectImage(string $value): static { $xpath = sprintf('descendant-or-self::img[contains(normalize-space(string(@alt)), %s)]', static::xpathLiteral($value)); @@ -814,10 +732,8 @@ public function selectImage(string $value) /** * Selects a button by name or alt value for images. - * - * @return static */ - public function selectButton(string $value) + public function selectButton(string $value): static { return $this->filterRelativeXPath( sprintf('descendant-or-self::input[((contains(%1$s, "submit") or contains(%1$s, "button")) and contains(concat(\' \', normalize-space(string(@value)), \' \'), %2$s)) or (contains(%1$s, "image") and contains(concat(\' \', normalize-space(string(@alt)), \' \'), %2$s)) or @id=%3$s or @name=%3$s] | descendant-or-self::button[contains(concat(\' \', normalize-space(string(.)), \' \'), %2$s) or @id=%3$s or @name=%3$s]', 'translate(@type, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz")', static::xpathLiteral(' '.$value.' '), static::xpathLiteral($value)) @@ -827,11 +743,9 @@ public function selectButton(string $value) /** * Returns a Link object for the first node in the list. * - * @return Link - * * @throws \InvalidArgumentException If the current node list is empty or the selected node is not instance of DOMElement */ - public function link(string $method = 'get') + public function link(string $method = 'get'): Link { if (!$this->nodes) { throw new \InvalidArgumentException('The current node list is empty.'); @@ -853,7 +767,7 @@ public function link(string $method = 'get') * * @throws \InvalidArgumentException If the current node list contains non-DOMElement instances */ - public function links() + public function links(): array { $links = []; foreach ($this->nodes as $node) { @@ -870,11 +784,9 @@ public function links() /** * Returns an Image object for the first node in the list. * - * @return Image - * * @throws \InvalidArgumentException If the current node list is empty */ - public function image() + public function image(): Image { if (!\count($this)) { throw new \InvalidArgumentException('The current node list is empty.'); @@ -894,7 +806,7 @@ public function image() * * @return Image[] */ - public function images() + public function images(): array { $images = []; foreach ($this as $node) { @@ -911,11 +823,9 @@ public function images() /** * Returns a Form object for the first node in the list. * - * @return Form - * * @throws \InvalidArgumentException If the current node list is empty or the selected node is not instance of DOMElement */ - public function form(array $values = null, string $method = null) + public function form(array $values = null, string $method = null): Form { if (!$this->nodes) { throw new \InvalidArgumentException('The current node list is empty.'); @@ -964,10 +874,8 @@ public function registerNamespace(string $prefix, string $namespace) * * echo Crawler::xpathLiteral('a\'b"c'); * //prints concat('a', "'", 'b"c') - * - * @return string */ - public static function xpathLiteral(string $s) + public static function xpathLiteral(string $s): string { if (!str_contains($s, "'")) { return sprintf("'%s'", $s); @@ -997,10 +905,8 @@ public static function xpathLiteral(string $s) * Filters the list of nodes with an XPath expression. * * The XPath expression should already be processed to apply it in the context of each node. - * - * @return static */ - private function filterRelativeXPath(string $xpath): object + private function filterRelativeXPath(string $xpath): static { $crawler = $this->createSubCrawler(null); if (null === $this->document) { @@ -1106,19 +1012,12 @@ private function relativize(string $xpath): string return $xpath; // The XPath expression is invalid } - /** - * @return \DOMNode|null - */ - public function getNode(int $position) + public function getNode(int $position): ?\DOMNode { return $this->nodes[$position] ?? null; } - /** - * @return int - */ - #[\ReturnTypeWillChange] - public function count() + public function count(): int { return \count($this->nodes); } @@ -1126,16 +1025,12 @@ public function count() /** * @return \ArrayIterator */ - #[\ReturnTypeWillChange] - public function getIterator() + public function getIterator(): \ArrayIterator { return new \ArrayIterator($this->nodes); } - /** - * @return array - */ - protected function sibling(\DOMNode $node, string $siblingDir = 'nextSibling') + protected function sibling(\DOMNode $node, string $siblingDir = 'nextSibling'): array { $nodes = []; @@ -1159,9 +1054,6 @@ private function parseXhtml(string $htmlContent, string $charset = 'UTF-8'): \DO $htmlContent = $this->convertToHtmlEntities($htmlContent, $charset); $internalErrors = libxml_use_internal_errors(true); - if (\LIBXML_VERSION < 20900) { - $disableEntities = libxml_disable_entity_loader(true); - } $dom = new \DOMDocument('1.0', $charset); $dom->validateOnParse = true; @@ -1171,9 +1063,6 @@ private function parseXhtml(string $htmlContent, string $charset = 'UTF-8'): \DO } libxml_use_internal_errors($internalErrors); - if (\LIBXML_VERSION < 20900) { - libxml_disable_entity_loader($disableEntities); - } return $dom; } @@ -1249,10 +1138,8 @@ private function findNamespacePrefixes(string $xpath): array * Creates a crawler for some subnodes. * * @param \DOMNodeList|\DOMNode|\DOMNode[]|string|null $nodes - * - * @return static */ - private function createSubCrawler($nodes): object + private function createSubCrawler(\DOMNodeList|\DOMNode|array|string|null $nodes): static { $crawler = new static($nodes, $this->uri, $this->baseHref); $crawler->isHtml = $this->isHtml; diff --git a/symfony/dom-crawler/Field/ChoiceFormField.php b/symfony/dom-crawler/Field/ChoiceFormField.php index 9eed27ba4..918a18e2f 100644 --- a/symfony/dom-crawler/Field/ChoiceFormField.php +++ b/symfony/dom-crawler/Field/ChoiceFormField.php @@ -20,29 +20,17 @@ */ class ChoiceFormField extends FormField { - /** - * @var string - */ - private $type; - /** - * @var bool - */ - private $multiple; - /** - * @var array - */ - private $options; - /** - * @var bool - */ - private $validationDisabled = false; + private string $type; + private bool $multiple; + private array $options; + private bool $validationDisabled = false; /** * Returns true if the field should be included in the submitted values. * * @return bool true if the field should be included in the submitted values, false otherwise */ - public function hasValue() + public function hasValue(): bool { // don't send a value for unchecked checkboxes if (\in_array($this->type, ['checkbox', 'radio']) && null === $this->value) { @@ -54,10 +42,8 @@ public function hasValue() /** * Check if the current selected option is disabled. - * - * @return bool */ - public function isDisabled() + public function isDisabled(): bool { if (parent::isDisabled() && 'select' === $this->type) { return true; @@ -74,10 +60,8 @@ public function isDisabled() /** * Sets the value of the field. - * - * @param string|array $value The value of the field */ - public function select($value) + public function select(string|array|bool $value) { $this->setValue($value); } @@ -113,11 +97,9 @@ public function untick() /** * Sets the value of the field. * - * @param string|array|bool|null $value The value of the field - * * @throws \InvalidArgumentException When value type provided is not correct */ - public function setValue($value) + public function setValue(string|array|bool|null $value) { if ('checkbox' === $this->type && false === $value) { // uncheck @@ -175,20 +157,16 @@ public function addChoice(\DOMElement $node) /** * Returns the type of the choice field (radio, select, or checkbox). - * - * @return string */ - public function getType() + public function getType(): string { return $this->type; } /** * Returns true if the field accepts multiple values. - * - * @return bool */ - public function isMultiple() + public function isMultiple(): bool { return $this->multiple; } @@ -268,11 +246,9 @@ private function buildOptionValue(\DOMElement $node): array /** * Checks whether given value is in the existing options. * - * @internal since Symfony 5.3 - * - * @return bool + * @internal */ - public function containsOption(string $optionValue, array $options) + public function containsOption(string $optionValue, array $options): bool { if ($this->validationDisabled) { return true; @@ -290,11 +266,9 @@ public function containsOption(string $optionValue, array $options) /** * Returns list of available field options. * - * @internal since Symfony 5.3 - * - * @return array + * @internal */ - public function availableOptionValues() + public function availableOptionValues(): array { $values = []; @@ -308,11 +282,11 @@ public function availableOptionValues() /** * Disables the internal validation of the field. * - * @internal since Symfony 5.3 + * @internal * * @return $this */ - public function disableValidation() + public function disableValidation(): static { $this->validationDisabled = true; diff --git a/symfony/dom-crawler/Field/FormField.php b/symfony/dom-crawler/Field/FormField.php index 066af4a16..2edb1090f 100644 --- a/symfony/dom-crawler/Field/FormField.php +++ b/symfony/dom-crawler/Field/FormField.php @@ -57,10 +57,8 @@ public function __construct(\DOMElement $node) /** * Returns the label tag associated to the field or null if none. - * - * @return \DOMElement|null */ - public function getLabel() + public function getLabel(): ?\DOMElement { $xpath = new \DOMXPath($this->node->ownerDocument); @@ -78,20 +76,16 @@ public function getLabel() /** * Returns the name of the field. - * - * @return string */ - public function getName() + public function getName(): string { return $this->name; } /** * Gets the value of the field. - * - * @return string|array|null */ - public function getValue() + public function getValue(): string|array|null { return $this->value; } @@ -106,20 +100,16 @@ public function setValue(?string $value) /** * Returns true if the field should be included in the submitted values. - * - * @return bool */ - public function hasValue() + public function hasValue(): bool { return true; } /** * Check if the current field is disabled. - * - * @return bool */ - public function isDisabled() + public function isDisabled(): bool { return $this->node->hasAttribute('disabled'); } diff --git a/symfony/dom-crawler/Form.php b/symfony/dom-crawler/Form.php index ebad35b38..8d0b2aa46 100644 --- a/symfony/dom-crawler/Form.php +++ b/symfony/dom-crawler/Form.php @@ -21,20 +21,9 @@ */ class Form extends Link implements \ArrayAccess { - /** - * @var \DOMElement - */ - private $button; - - /** - * @var FormFieldRegistry - */ + private \DOMElement $button; private $fields; - - /** - * @var string - */ - private $baseHref; + private ?string $baseHref; /** * @param \DOMElement $node A \DOMElement instance @@ -54,10 +43,8 @@ public function __construct(\DOMElement $node, string $currentUri = null, string /** * Gets the form node associated with this form. - * - * @return \DOMElement */ - public function getFormNode() + public function getFormNode(): \DOMElement { return $this->node; } @@ -69,7 +56,7 @@ public function getFormNode() * * @return $this */ - public function setValues(array $values) + public function setValues(array $values): static { foreach ($values as $name => $value) { $this->fields->set($name, $value); @@ -82,10 +69,8 @@ public function setValues(array $values) * Gets the field values. * * The returned array does not include file fields (@see getFiles). - * - * @return array */ - public function getValues() + public function getValues(): array { $values = []; foreach ($this->fields->all() as $name => $field) { @@ -103,10 +88,8 @@ public function getValues() /** * Gets the file field values. - * - * @return array */ - public function getFiles() + public function getFiles(): array { if (!\in_array($this->getMethod(), ['POST', 'PUT', 'DELETE', 'PATCH'])) { return []; @@ -132,10 +115,8 @@ public function getFiles() * * This method converts fields with the array notation * (like foo[bar] to arrays) like PHP does. - * - * @return array */ - public function getPhpValues() + public function getPhpValues(): array { $values = []; foreach ($this->getValues() as $name => $value) { @@ -159,10 +140,8 @@ public function getPhpValues() * (@see getPhpValues), rather than uploaded files found in $_FILES. * For a compound file field foo[bar] it will create foo[bar][name], * instead of foo[name][bar] which would be found in $_FILES. - * - * @return array */ - public function getPhpFiles() + public function getPhpFiles(): array { $values = []; foreach ($this->getFiles() as $name => $value) { @@ -195,10 +174,8 @@ function (&$value, $key) { * The returned URI is not the same as the form "action" attribute. * This method merges the value if the method is GET to mimics * browser behavior. - * - * @return string */ - public function getUri() + public function getUri(): string { $uri = parent::getUri(); @@ -219,7 +196,7 @@ public function getUri() return $uri; } - protected function getRawUri() + protected function getRawUri(): string { // If the form was created from a button rather than the form node, check for HTML5 action overrides if ($this->button !== $this->node && $this->button->getAttribute('formaction')) { @@ -233,10 +210,8 @@ protected function getRawUri() * Gets the form method. * * If no method is defined in the form, GET is returned. - * - * @return string */ - public function getMethod() + public function getMethod(): string { if (null !== $this->method) { return $this->method; @@ -262,10 +237,8 @@ public function getName(): string /** * Returns true if the named field exists. - * - * @return bool */ - public function has(string $name) + public function has(string $name): bool { return $this->fields->has($name); } @@ -285,7 +258,7 @@ public function remove(string $name) * * @throws \InvalidArgumentException When field is not present in this form */ - public function get(string $name) + public function get(string $name): FormField|array { return $this->fields->get($name); } @@ -303,7 +276,7 @@ public function set(FormField $field) * * @return FormField[] */ - public function all() + public function all(): array { return $this->fields->all(); } @@ -312,11 +285,8 @@ public function all() * Returns true if the named field exists. * * @param string $name The field name - * - * @return bool */ - #[\ReturnTypeWillChange] - public function offsetExists($name) + public function offsetExists(mixed $name): bool { return $this->has($name); } @@ -330,8 +300,7 @@ public function offsetExists($name) * * @throws \InvalidArgumentException if the field does not exist */ - #[\ReturnTypeWillChange] - public function offsetGet($name) + public function offsetGet(mixed $name): FormField|array { return $this->fields->get($name); } @@ -342,12 +311,9 @@ public function offsetGet($name) * @param string $name The field name * @param string|array $value The value of the field * - * @return void - * * @throws \InvalidArgumentException if the field does not exist */ - #[\ReturnTypeWillChange] - public function offsetSet($name, $value) + public function offsetSet(mixed $name, mixed $value): void { $this->fields->set($name, $value); } @@ -356,11 +322,8 @@ public function offsetSet($name, $value) * Removes a field from the form. * * @param string $name The field name - * - * @return void */ - #[\ReturnTypeWillChange] - public function offsetUnset($name) + public function offsetUnset(mixed $name): void { $this->fields->remove($name); } @@ -370,7 +333,7 @@ public function offsetUnset($name) * * @return $this */ - public function disableValidation() + public function disableValidation(): static { foreach ($this->fields->all() as $field) { if ($field instanceof Field\ChoiceFormField) { diff --git a/symfony/dom-crawler/FormFieldRegistry.php b/symfony/dom-crawler/FormFieldRegistry.php index 93522adcb..3db15b8fb 100644 --- a/symfony/dom-crawler/FormFieldRegistry.php +++ b/symfony/dom-crawler/FormFieldRegistry.php @@ -20,9 +20,8 @@ */ class FormFieldRegistry { - private $fields = []; - - private $base = ''; + private array $fields = []; + private string $base = ''; /** * Adds a field to the registry. @@ -47,7 +46,7 @@ public function add(FormField $field) } /** - * Removes a field based on the fully qualifed name and its children from the registry. + * Removes a field based on the fully qualified name and its children from the registry. */ public function remove(string $name) { @@ -64,13 +63,13 @@ public function remove(string $name) } /** - * Returns the value of the field based on the fully qualifed name and its children. + * Returns the value of the field based on the fully qualified name and its children. * * @return FormField|FormField[]|FormField[][] * * @throws \InvalidArgumentException if the field does not exist */ - public function &get(string $name) + public function &get(string $name): FormField|array { $segments = $this->getSegments($name); $target = &$this->fields; @@ -102,11 +101,9 @@ public function has(string $name): bool /** * Set the value of a field based on the fully qualified name and its children. * - * @param mixed $value The value - * * @throws \InvalidArgumentException if the field does not exist */ - public function set(string $name, $value) + public function set(string $name, mixed $value) { $target = &$this->get($name); if ((!\is_array($value) && $target instanceof Field\FormField) || $target instanceof Field\ChoiceFormField) { diff --git a/symfony/dom-crawler/Image.php b/symfony/dom-crawler/Image.php index b1ac5ca2c..e57364151 100644 --- a/symfony/dom-crawler/Image.php +++ b/symfony/dom-crawler/Image.php @@ -21,7 +21,7 @@ public function __construct(\DOMElement $node, string $currentUri = null) parent::__construct($node, $currentUri, 'GET'); } - protected function getRawUri() + protected function getRawUri(): string { return $this->node->getAttribute('src'); } diff --git a/symfony/dom-crawler/LICENSE b/symfony/dom-crawler/LICENSE index 88bf75bb4..008370457 100644 --- a/symfony/dom-crawler/LICENSE +++ b/symfony/dom-crawler/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2022 Fabien Potencier +Copyright (c) 2004-2023 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/symfony/dom-crawler/Link.php b/symfony/dom-crawler/Link.php index 80a356e46..658b4fd8a 100644 --- a/symfony/dom-crawler/Link.php +++ b/symfony/dom-crawler/Link.php @@ -18,7 +18,7 @@ */ class Link extends AbstractUriElement { - protected function getRawUri() + protected function getRawUri(): string { return $this->node->getAttribute('href'); }