From 69e22c50fbf6bf813e28fc29e0d7fdc2c3608e07 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Sun, 11 Feb 2024 20:35:45 +0000 Subject: [PATCH] Updated Rector to commit df8d2b78edd46542e6426fec606c3ea98d712532 https://github.com/rectorphp/rector-src/commit/df8d2b78edd46542e6426fec606c3ea98d712532 Copy subtype phpdoc on ClassPropertyAssignToConstructorPromotionRector (#8438) (#5603) --- vendor/bin/yaml-lint | 94 ++ vendor/composer/autoload_classmap.php | 12 + vendor/composer/autoload_files.php | 2 +- vendor/composer/autoload_psr4.php | 1 + vendor/composer/autoload_static.php | 19 +- vendor/composer/installed.json | 86 +- vendor/composer/installed.php | 2 +- .../src/GeneratedConfig.php | 2 +- vendor/rector/rector-doctrine/composer.json | 3 +- vendor/scoper-autoload.php | 1 + vendor/symfony/yaml/CHANGELOG.md | 253 ++++ vendor/symfony/yaml/Command/LintCommand.php | 243 ++++ vendor/symfony/yaml/Dumper.php | 140 +++ vendor/symfony/yaml/Escaper.php | 74 ++ .../symfony/yaml/Exception/DumpException.php | 20 + .../yaml/Exception/ExceptionInterface.php | 20 + .../symfony/yaml/Exception/ParseException.php | 125 ++ .../yaml/Exception/RuntimeException.php | 20 + vendor/symfony/yaml/Inline.php | 735 ++++++++++++ vendor/symfony/yaml/LICENSE | 19 + vendor/symfony/yaml/Parser.php | 1062 +++++++++++++++++ vendor/symfony/yaml/README.md | 13 + vendor/symfony/yaml/Resources/bin/yaml-lint | 35 + vendor/symfony/yaml/Tag/TaggedValue.php | 46 + vendor/symfony/yaml/Unescaper.php | 120 ++ vendor/symfony/yaml/Yaml.php | 91 ++ vendor/symfony/yaml/composer.json | 41 + 27 files changed, 3269 insertions(+), 10 deletions(-) create mode 100755 vendor/bin/yaml-lint create mode 100644 vendor/symfony/yaml/CHANGELOG.md create mode 100644 vendor/symfony/yaml/Command/LintCommand.php create mode 100644 vendor/symfony/yaml/Dumper.php create mode 100644 vendor/symfony/yaml/Escaper.php create mode 100644 vendor/symfony/yaml/Exception/DumpException.php create mode 100644 vendor/symfony/yaml/Exception/ExceptionInterface.php create mode 100644 vendor/symfony/yaml/Exception/ParseException.php create mode 100644 vendor/symfony/yaml/Exception/RuntimeException.php create mode 100644 vendor/symfony/yaml/Inline.php create mode 100644 vendor/symfony/yaml/LICENSE create mode 100644 vendor/symfony/yaml/Parser.php create mode 100644 vendor/symfony/yaml/README.md create mode 100755 vendor/symfony/yaml/Resources/bin/yaml-lint create mode 100644 vendor/symfony/yaml/Tag/TaggedValue.php create mode 100644 vendor/symfony/yaml/Unescaper.php create mode 100644 vendor/symfony/yaml/Yaml.php create mode 100644 vendor/symfony/yaml/composer.json diff --git a/vendor/bin/yaml-lint b/vendor/bin/yaml-lint new file mode 100755 index 00000000000..903863f1d01 --- /dev/null +++ b/vendor/bin/yaml-lint @@ -0,0 +1,94 @@ +#!/usr/bin/env php +realpath = \realpath($opened_path) ?: $opened_path; + $opened_path = $this->realpath; + $this->handle = \fopen($this->realpath, $mode); + $this->position = 0; + return (bool) $this->handle; + } + public function stream_read($count) + { + $data = \fread($this->handle, $count); + if ($this->position === 0) { + $data = \preg_replace('{^#!.*\\r?\\n}', '', $data); + } + $this->position += \strlen($data); + return $data; + } + public function stream_cast($castAs) + { + return $this->handle; + } + public function stream_close() + { + \fclose($this->handle); + } + public function stream_lock($operation) + { + return $operation ? \flock($this->handle, $operation) : \true; + } + public function stream_seek($offset, $whence) + { + if (0 === \fseek($this->handle, $offset, $whence)) { + $this->position = \ftell($this->handle); + return \true; + } + return \false; + } + public function stream_tell() + { + return $this->position; + } + public function stream_eof() + { + return \feof($this->handle); + } + public function stream_stat() + { + return array(); + } + public function stream_set_option($option, $arg1, $arg2) + { + return \true; + } + public function url_stat($path, $flags) + { + $path = \substr($path, 17); + if (\file_exists($path)) { + return \stat($path); + } + return \false; + } + } + } + if (\function_exists('stream_get_wrappers') && \in_array('phpvfscomposer', \stream_get_wrappers(), \true) || \function_exists('stream_wrapper_register') && \stream_wrapper_register('phpvfscomposer', 'RectorPrefix202402\\Composer\\BinProxyWrapper')) { + return include "phpvfscomposer://" . __DIR__ . '/..' . '/symfony/yaml/Resources/bin/yaml-lint'; + } +} +return include __DIR__ . '/..' . '/symfony/yaml/Resources/bin/yaml-lint'; diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index ad1d06aafac..5cd3cb17005 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -923,6 +923,18 @@ return array( 'RectorPrefix202402\\Symfony\\Component\\Process\\Pipes\\WindowsPipes' => $vendorDir . '/symfony/process/Pipes/WindowsPipes.php', 'RectorPrefix202402\\Symfony\\Component\\Process\\Process' => $vendorDir . '/symfony/process/Process.php', 'RectorPrefix202402\\Symfony\\Component\\Process\\ProcessUtils' => $vendorDir . '/symfony/process/ProcessUtils.php', + 'RectorPrefix202402\\Symfony\\Component\\Yaml\\Command\\LintCommand' => $vendorDir . '/symfony/yaml/Command/LintCommand.php', + 'RectorPrefix202402\\Symfony\\Component\\Yaml\\Dumper' => $vendorDir . '/symfony/yaml/Dumper.php', + 'RectorPrefix202402\\Symfony\\Component\\Yaml\\Escaper' => $vendorDir . '/symfony/yaml/Escaper.php', + 'RectorPrefix202402\\Symfony\\Component\\Yaml\\Exception\\DumpException' => $vendorDir . '/symfony/yaml/Exception/DumpException.php', + 'RectorPrefix202402\\Symfony\\Component\\Yaml\\Exception\\ExceptionInterface' => $vendorDir . '/symfony/yaml/Exception/ExceptionInterface.php', + 'RectorPrefix202402\\Symfony\\Component\\Yaml\\Exception\\ParseException' => $vendorDir . '/symfony/yaml/Exception/ParseException.php', + 'RectorPrefix202402\\Symfony\\Component\\Yaml\\Exception\\RuntimeException' => $vendorDir . '/symfony/yaml/Exception/RuntimeException.php', + 'RectorPrefix202402\\Symfony\\Component\\Yaml\\Inline' => $vendorDir . '/symfony/yaml/Inline.php', + 'RectorPrefix202402\\Symfony\\Component\\Yaml\\Parser' => $vendorDir . '/symfony/yaml/Parser.php', + 'RectorPrefix202402\\Symfony\\Component\\Yaml\\Tag\\TaggedValue' => $vendorDir . '/symfony/yaml/Tag/TaggedValue.php', + 'RectorPrefix202402\\Symfony\\Component\\Yaml\\Unescaper' => $vendorDir . '/symfony/yaml/Unescaper.php', + 'RectorPrefix202402\\Symfony\\Component\\Yaml\\Yaml' => $vendorDir . '/symfony/yaml/Yaml.php', 'RectorPrefix202402\\Symfony\\Contracts\\Service\\Attribute\\Required' => $vendorDir . '/symfony/service-contracts/Attribute/Required.php', 'RectorPrefix202402\\Symfony\\Contracts\\Service\\Attribute\\SubscribedService' => $vendorDir . '/symfony/service-contracts/Attribute/SubscribedService.php', 'RectorPrefix202402\\Symfony\\Contracts\\Service\\ResetInterface' => $vendorDir . '/symfony/service-contracts/ResetInterface.php', diff --git a/vendor/composer/autoload_files.php b/vendor/composer/autoload_files.php index e7ce77a8383..fd67d90bf4b 100644 --- a/vendor/composer/autoload_files.php +++ b/vendor/composer/autoload_files.php @@ -7,7 +7,7 @@ $baseDir = dirname($vendorDir); return array( 'ad155f8f1cf0d418fe49e248db8c661b' => $vendorDir . '/react/promise/src/functions_include.php', - '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php', '6e3fae29631ef280660b3cdad06f25a8' => $vendorDir . '/symfony/deprecation-contracts/function.php', + '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php', '30bca7fff093e8069bed7c55247e2bf8' => $baseDir . '/src/functions/node_helper.php', ); diff --git a/vendor/composer/autoload_psr4.php b/vendor/composer/autoload_psr4.php index dd9e7bd67b7..1084fb30fa6 100644 --- a/vendor/composer/autoload_psr4.php +++ b/vendor/composer/autoload_psr4.php @@ -17,6 +17,7 @@ return array( 'RectorPrefix202402\\Webmozart\\Assert\\' => array($vendorDir . '/webmozart/assert/src'), 'RectorPrefix202402\\Symplify\\EasyParallel\\' => array($vendorDir . '/symplify/easy-parallel/src'), 'RectorPrefix202402\\Symfony\\Contracts\\Service\\' => array($vendorDir . '/symfony/service-contracts'), + 'RectorPrefix202402\\Symfony\\Component\\Yaml\\' => array($vendorDir . '/symfony/yaml'), 'RectorPrefix202402\\Symfony\\Component\\Process\\' => array($vendorDir . '/symfony/process'), 'RectorPrefix202402\\Symfony\\Component\\Finder\\' => array($vendorDir . '/symfony/finder'), 'RectorPrefix202402\\Symfony\\Component\\Filesystem\\' => array($vendorDir . '/symfony/filesystem'), diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 22bb775ab03..387cd3af81d 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -8,8 +8,8 @@ class ComposerStaticInit2d887a2f87c676eb32b3e04612865e54 { public static $files = array ( 'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php', - '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php', '6e3fae29631ef280660b3cdad06f25a8' => __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php', + '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php', '30bca7fff093e8069bed7c55247e2bf8' => __DIR__ . '/../..' . '/src/functions/node_helper.php', ); @@ -30,6 +30,7 @@ class ComposerStaticInit2d887a2f87c676eb32b3e04612865e54 'RectorPrefix202402\\Webmozart\\Assert\\' => 36, 'RectorPrefix202402\\Symplify\\EasyParallel\\' => 41, 'RectorPrefix202402\\Symfony\\Contracts\\Service\\' => 45, + 'RectorPrefix202402\\Symfony\\Component\\Yaml\\' => 42, 'RectorPrefix202402\\Symfony\\Component\\Process\\' => 45, 'RectorPrefix202402\\Symfony\\Component\\Finder\\' => 44, 'RectorPrefix202402\\Symfony\\Component\\Filesystem\\' => 48, @@ -113,6 +114,10 @@ class ComposerStaticInit2d887a2f87c676eb32b3e04612865e54 array ( 0 => __DIR__ . '/..' . '/symfony/service-contracts', ), + 'RectorPrefix202402\\Symfony\\Component\\Yaml\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/yaml', + ), 'RectorPrefix202402\\Symfony\\Component\\Process\\' => array ( 0 => __DIR__ . '/..' . '/symfony/process', @@ -1137,6 +1142,18 @@ class ComposerStaticInit2d887a2f87c676eb32b3e04612865e54 'RectorPrefix202402\\Symfony\\Component\\Process\\Pipes\\WindowsPipes' => __DIR__ . '/..' . '/symfony/process/Pipes/WindowsPipes.php', 'RectorPrefix202402\\Symfony\\Component\\Process\\Process' => __DIR__ . '/..' . '/symfony/process/Process.php', 'RectorPrefix202402\\Symfony\\Component\\Process\\ProcessUtils' => __DIR__ . '/..' . '/symfony/process/ProcessUtils.php', + 'RectorPrefix202402\\Symfony\\Component\\Yaml\\Command\\LintCommand' => __DIR__ . '/..' . '/symfony/yaml/Command/LintCommand.php', + 'RectorPrefix202402\\Symfony\\Component\\Yaml\\Dumper' => __DIR__ . '/..' . '/symfony/yaml/Dumper.php', + 'RectorPrefix202402\\Symfony\\Component\\Yaml\\Escaper' => __DIR__ . '/..' . '/symfony/yaml/Escaper.php', + 'RectorPrefix202402\\Symfony\\Component\\Yaml\\Exception\\DumpException' => __DIR__ . '/..' . '/symfony/yaml/Exception/DumpException.php', + 'RectorPrefix202402\\Symfony\\Component\\Yaml\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/symfony/yaml/Exception/ExceptionInterface.php', + 'RectorPrefix202402\\Symfony\\Component\\Yaml\\Exception\\ParseException' => __DIR__ . '/..' . '/symfony/yaml/Exception/ParseException.php', + 'RectorPrefix202402\\Symfony\\Component\\Yaml\\Exception\\RuntimeException' => __DIR__ . '/..' . '/symfony/yaml/Exception/RuntimeException.php', + 'RectorPrefix202402\\Symfony\\Component\\Yaml\\Inline' => __DIR__ . '/..' . '/symfony/yaml/Inline.php', + 'RectorPrefix202402\\Symfony\\Component\\Yaml\\Parser' => __DIR__ . '/..' . '/symfony/yaml/Parser.php', + 'RectorPrefix202402\\Symfony\\Component\\Yaml\\Tag\\TaggedValue' => __DIR__ . '/..' . '/symfony/yaml/Tag/TaggedValue.php', + 'RectorPrefix202402\\Symfony\\Component\\Yaml\\Unescaper' => __DIR__ . '/..' . '/symfony/yaml/Unescaper.php', + 'RectorPrefix202402\\Symfony\\Component\\Yaml\\Yaml' => __DIR__ . '/..' . '/symfony/yaml/Yaml.php', 'RectorPrefix202402\\Symfony\\Contracts\\Service\\Attribute\\Required' => __DIR__ . '/..' . '/symfony/service-contracts/Attribute/Required.php', 'RectorPrefix202402\\Symfony\\Contracts\\Service\\Attribute\\SubscribedService' => __DIR__ . '/..' . '/symfony/service-contracts/Attribute/SubscribedService.php', 'RectorPrefix202402\\Symfony\\Contracts\\Service\\ResetInterface' => __DIR__ . '/..' . '/symfony/service-contracts/ResetInterface.php', diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 5185b628f33..27fcfd2223d 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -1679,16 +1679,17 @@ "source": { "type": "git", "url": "https:\/\/github.com\/rectorphp\/rector-doctrine.git", - "reference": "9057680e74d0243c60b9f6fb89c1fe448d363505" + "reference": "4eb75185edb27fd390328303f8996ccf34a73e70" }, "dist": { "type": "zip", - "url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-doctrine\/zipball\/9057680e74d0243c60b9f6fb89c1fe448d363505", - "reference": "9057680e74d0243c60b9f6fb89c1fe448d363505", + "url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-doctrine\/zipball\/4eb75185edb27fd390328303f8996ccf34a73e70", + "reference": "4eb75185edb27fd390328303f8996ccf34a73e70", "shasum": "" }, "require": { - "php": ">=8.2" + "php": ">=8.2", + "symfony\/yaml": "^6.4" }, "require-dev": { "doctrine\/orm": "^2.18", @@ -1707,7 +1708,7 @@ "tomasvotruba\/unused-public": "^0.3", "tracy\/tracy": "^2.10" }, - "time": "2024-02-09T11:41:38+00:00", + "time": "2024-02-11T20:31:00+00:00", "default-branch": true, "type": "rector-extension", "extra": { @@ -2531,6 +2532,81 @@ ], "install-path": "..\/symfony\/service-contracts" }, + { + "name": "symfony\/yaml", + "version": "v6.4.3", + "version_normalized": "6.4.3.0", + "source": { + "type": "git", + "url": "https:\/\/github.com\/symfony\/yaml.git", + "reference": "d75715985f0f94f978e3a8fa42533e10db921b90" + }, + "dist": { + "type": "zip", + "url": "https:\/\/api.github.com\/repos\/symfony\/yaml\/zipball\/d75715985f0f94f978e3a8fa42533e10db921b90", + "reference": "d75715985f0f94f978e3a8fa42533e10db921b90", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "symfony\/deprecation-contracts": "^2.5|^3", + "symfony\/polyfill-ctype": "^1.8" + }, + "conflict": { + "symfony\/console": "<5.4" + }, + "require-dev": { + "symfony\/console": "^5.4|^6.0|^7.0" + }, + "time": "2024-01-23T14:51:35+00:00", + "bin": [ + "Resources\/bin\/yaml-lint" + ], + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "RectorPrefix202402\\Symfony\\Component\\Yaml\\": "" + }, + "exclude-from-classmap": [ + "\/Tests\/" + ] + }, + "notification-url": "https:\/\/packagist.org\/downloads\/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https:\/\/symfony.com\/contributors" + } + ], + "description": "Loads and dumps YAML files", + "homepage": "https:\/\/symfony.com", + "support": { + "source": "https:\/\/github.com\/symfony\/yaml\/tree\/v6.4.3" + }, + "funding": [ + { + "url": "https:\/\/symfony.com\/sponsor", + "type": "custom" + }, + { + "url": "https:\/\/github.com\/fabpot", + "type": "github" + }, + { + "url": "https:\/\/tidelift.com\/funding\/github\/packagist\/symfony\/symfony", + "type": "tidelift" + } + ], + "install-path": "..\/symfony\/yaml" + }, { "name": "symplify\/easy-parallel", "version": "11.2.2", diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index 4af720056b4..eb50cdf6143 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -2,4 +2,4 @@ namespace RectorPrefix202402; -return array('root' => array('name' => 'rector/rector-src', 'pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => null, 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), 'dev' => \false), 'versions' => array('clue/ndjson-react' => array('pretty_version' => 'v1.3.0', 'version' => '1.3.0.0', 'reference' => '392dc165fce93b5bb5c637b67e59619223c931b0', 'type' => 'library', 'install_path' => __DIR__ . '/../clue/ndjson-react', 'aliases' => array(), 'dev_requirement' => \false), 'composer/pcre' => array('pretty_version' => '3.1.1', 'version' => '3.1.1.0', 'reference' => '00104306927c7a0919b4ced2aaa6782c1e61a3c9', 'type' => 'library', 'install_path' => __DIR__ . '/./pcre', 'aliases' => array(), 'dev_requirement' => \false), 'composer/semver' => array('pretty_version' => '3.4.0', 'version' => '3.4.0.0', 'reference' => '35e8d0af4486141bc745f23a29cc2091eb624a32', 'type' => 'library', 'install_path' => __DIR__ . '/./semver', 'aliases' => array(), 'dev_requirement' => \false), 'composer/xdebug-handler' => array('pretty_version' => '3.0.3', 'version' => '3.0.3.0', 'reference' => 'ced299686f41dce890debac69273b47ffe98a40c', 'type' => 'library', 'install_path' => __DIR__ . '/./xdebug-handler', 'aliases' => array(), 'dev_requirement' => \false), 'doctrine/inflector' => array('pretty_version' => '2.0.9', 'version' => '2.0.9.0', 'reference' => '2930cd5ef353871c821d5c43ed030d39ac8cfe65', 'type' => 'library', 'install_path' => __DIR__ . '/../doctrine/inflector', 'aliases' => array(), 'dev_requirement' => \false), 'evenement/evenement' => array('pretty_version' => 'v3.0.2', 'version' => '3.0.2.0', 'reference' => '0a16b0d71ab13284339abb99d9d2bd813640efbc', 'type' => 'library', 'install_path' => __DIR__ . '/../evenement/evenement', 'aliases' => array(), 'dev_requirement' => \false), 'fidry/cpu-core-counter' => array('pretty_version' => '1.1.0', 'version' => '1.1.0.0', 'reference' => 'f92996c4d5c1a696a6a970e20f7c4216200fcc42', 'type' => 'library', 'install_path' => __DIR__ . '/../fidry/cpu-core-counter', 'aliases' => array(), 'dev_requirement' => \false), 'illuminate/container' => array('pretty_version' => 'v10.43.0', 'version' => '10.43.0.0', 'reference' => 'ddc26273085fad3c471b2602ad820e0097ff7939', 'type' => 'library', 'install_path' => __DIR__ . '/../illuminate/container', 'aliases' => array(), 'dev_requirement' => \false), 'illuminate/contracts' => array('pretty_version' => 'v10.43.0', 'version' => '10.43.0.0', 'reference' => '8d7152c4a1f5d9cf7da3e8b71f23e4556f6138ac', 'type' => 'library', 'install_path' => __DIR__ . '/../illuminate/contracts', 'aliases' => array(), 'dev_requirement' => \false), 'nette/utils' => array('pretty_version' => 'v3.2.10', 'version' => '3.2.10.0', 'reference' => 'a4175c62652f2300c8017fb7e640f9ccb11648d2', 'type' => 'library', 'install_path' => __DIR__ . '/../nette/utils', 'aliases' => array(), 'dev_requirement' => \false), 'nikic/php-parser' => array('pretty_version' => 'v4.18.0', 'version' => '4.18.0.0', 'reference' => '1bcbb2179f97633e98bbbc87044ee2611c7d7999', 'type' => 'library', 'install_path' => __DIR__ . '/../nikic/php-parser', 'aliases' => array(), 'dev_requirement' => \false), 'ondram/ci-detector' => array('pretty_version' => '4.1.0', 'version' => '4.1.0.0', 'reference' => '8a4b664e916df82ff26a44709942dfd593fa6f30', 'type' => 'library', 'install_path' => __DIR__ . '/../ondram/ci-detector', 'aliases' => array(), 'dev_requirement' => \false), 'phpstan/phpdoc-parser' => array('pretty_version' => '1.25.0', 'version' => '1.25.0.0', 'reference' => 'bd84b629c8de41aa2ae82c067c955e06f1b00240', 'type' => 'library', 'install_path' => __DIR__ . '/../phpstan/phpdoc-parser', 'aliases' => array(), 'dev_requirement' => \false), 'phpstan/phpstan' => array('dev_requirement' => \false, 'replaced' => array(0 => '^1.10.57')), 'psr/container' => array('pretty_version' => '2.0.2', 'version' => '2.0.2.0', 'reference' => 'c71ecc56dfe541dbd90c5360474fbc405f8d5963', 'type' => 'library', 'install_path' => __DIR__ . '/../psr/container', 'aliases' => array(), 'dev_requirement' => \false), 'psr/container-implementation' => array('dev_requirement' => \false, 'provided' => array(0 => '1.1|2.0')), 'psr/log' => array('pretty_version' => '3.0.0', 'version' => '3.0.0.0', 'reference' => 'fe5ea303b0887d5caefd3d431c3e61ad47037001', 'type' => 'library', 'install_path' => __DIR__ . '/../psr/log', 'aliases' => array(), 'dev_requirement' => \false), 'psr/log-implementation' => array('dev_requirement' => \false, 'provided' => array(0 => '1.0|2.0|3.0')), 'psr/simple-cache' => array('pretty_version' => '3.0.0', 'version' => '3.0.0.0', 'reference' => '764e0b3939f5ca87cb904f570ef9be2d78a07865', 'type' => 'library', 'install_path' => __DIR__ . '/../psr/simple-cache', 'aliases' => array(), 'dev_requirement' => \false), 'react/cache' => array('pretty_version' => 'v1.2.0', 'version' => '1.2.0.0', 'reference' => 'd47c472b64aa5608225f47965a484b75c7817d5b', 'type' => 'library', 'install_path' => __DIR__ . '/../react/cache', 'aliases' => array(), 'dev_requirement' => \false), 'react/child-process' => array('pretty_version' => 'v0.6.5', 'version' => '0.6.5.0', 'reference' => 'e71eb1aa55f057c7a4a0d08d06b0b0a484bead43', 'type' => 'library', 'install_path' => __DIR__ . '/../react/child-process', 'aliases' => array(), 'dev_requirement' => \false), 'react/dns' => array('pretty_version' => 'v1.12.0', 'version' => '1.12.0.0', 'reference' => 'c134600642fa615b46b41237ef243daa65bb64ec', 'type' => 'library', 'install_path' => __DIR__ . '/../react/dns', 'aliases' => array(), 'dev_requirement' => \false), 'react/event-loop' => array('pretty_version' => 'v1.5.0', 'version' => '1.5.0.0', 'reference' => 'bbe0bd8c51ffc05ee43f1729087ed3bdf7d53354', 'type' => 'library', 'install_path' => __DIR__ . '/../react/event-loop', 'aliases' => array(), 'dev_requirement' => \false), 'react/promise' => array('pretty_version' => 'v2.11.0', 'version' => '2.11.0.0', 'reference' => '1a8460931ea36dc5c76838fec5734d55c88c6831', 'type' => 'library', 'install_path' => __DIR__ . '/../react/promise', 'aliases' => array(), 'dev_requirement' => \false), 'react/socket' => array('pretty_version' => 'v1.15.0', 'version' => '1.15.0.0', 'reference' => '216d3aec0b87f04a40ca04f481e6af01bdd1d038', 'type' => 'library', 'install_path' => __DIR__ . '/../react/socket', 'aliases' => array(), 'dev_requirement' => \false), 'react/stream' => array('pretty_version' => 'v1.3.0', 'version' => '1.3.0.0', 'reference' => '6fbc9672905c7d5a885f2da2fc696f65840f4a66', 'type' => 'library', 'install_path' => __DIR__ . '/../react/stream', 'aliases' => array(), 'dev_requirement' => \false), 'rector/extension-installer' => array('pretty_version' => '0.11.2', 'version' => '0.11.2.0', 'reference' => '05544e9b195863b8571ae2a3b903cbec7fa062e0', 'type' => 'composer-plugin', 'install_path' => __DIR__ . '/../rector/extension-installer', 'aliases' => array(), 'dev_requirement' => \false), 'rector/rector' => array('dev_requirement' => \false, 'replaced' => array(0 => 'dev-main')), 'rector/rector-doctrine' => array('pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => '9057680e74d0243c60b9f6fb89c1fe448d363505', 'type' => 'rector-extension', 'install_path' => __DIR__ . '/../rector/rector-doctrine', 'aliases' => array(0 => '9999999-dev'), 'dev_requirement' => \false), 'rector/rector-downgrade-php' => array('pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => '8d1aab27edc3409cd976ddf109ac4933ec33ad5b', 'type' => 'rector-extension', 'install_path' => __DIR__ . '/../rector/rector-downgrade-php', 'aliases' => array(0 => '9999999-dev'), 'dev_requirement' => \false), 'rector/rector-phpunit' => array('pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => 'f091938e0b34c64acab524c2acff911cea769b57', 'type' => 'rector-extension', 'install_path' => __DIR__ . '/../rector/rector-phpunit', 'aliases' => array(0 => '0.11.x-dev'), 'dev_requirement' => \false), 'rector/rector-src' => array('pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => null, 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), 'dev_requirement' => \false), 'rector/rector-symfony' => array('pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => '5a62f1739e6feb5463d95ed02063aae860d358e4', 'type' => 'rector-extension', 'install_path' => __DIR__ . '/../rector/rector-symfony', 'aliases' => array(0 => '9999999-dev'), 'dev_requirement' => \false), 'sebastian/diff' => array('pretty_version' => '5.1.0', 'version' => '5.1.0.0', 'reference' => 'fbf413a49e54f6b9b17e12d900ac7f6101591b7f', 'type' => 'library', 'install_path' => __DIR__ . '/../sebastian/diff', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/console' => array('pretty_version' => 'v6.4.3', 'version' => '6.4.3.0', 'reference' => '2aaf83b4de5b9d43b93e4aec6f2f8b676f7c567e', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/console', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/deprecation-contracts' => array('pretty_version' => 'v3.4.0', 'version' => '3.4.0.0', 'reference' => '7c3aff79d10325257a001fcf92d991f24fc967cf', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/deprecation-contracts', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/filesystem' => array('pretty_version' => 'v6.4.3', 'version' => '6.4.3.0', 'reference' => '7f3b1755eb49297a0827a7575d5d2b2fd11cc9fb', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/filesystem', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/finder' => array('pretty_version' => 'v6.4.0', 'version' => '6.4.0.0', 'reference' => '11d736e97f116ac375a81f96e662911a34cd50ce', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/finder', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/polyfill-ctype' => array('dev_requirement' => \false, 'replaced' => array(0 => '*')), 'symfony/polyfill-intl-grapheme' => array('dev_requirement' => \false, 'replaced' => array(0 => '*')), 'symfony/polyfill-mbstring' => array('pretty_version' => 'v1.29.0', 'version' => '1.29.0.0', 'reference' => '9773676c8a1bb1f8d4340a62efe641cf76eda7ec', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/polyfill-mbstring', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/process' => array('pretty_version' => 'v6.4.3', 'version' => '6.4.3.0', 'reference' => '31642b0818bfcff85930344ef93193f8c607e0a3', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/process', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/service-contracts' => array('pretty_version' => 'v3.4.1', 'version' => '3.4.1.0', 'reference' => 'fe07cbc8d837f60caf7018068e350cc5163681a0', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/service-contracts', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/string' => array('dev_requirement' => \false, 'replaced' => array(0 => '*')), 'symplify/easy-parallel' => array('pretty_version' => '11.2.2', 'version' => '11.2.2.0', 'reference' => '8586c18bb8efb31cd192a4e5cc94ae7813f72ed9', 'type' => 'library', 'install_path' => __DIR__ . '/../symplify/easy-parallel', 'aliases' => array(), 'dev_requirement' => \false), 'symplify/rule-doc-generator-contracts' => array('pretty_version' => '11.1.26', 'version' => '11.1.26.0', 'reference' => '3e66b3fec678b74a076395ec629d535fb95293b5', 'type' => 'library', 'install_path' => __DIR__ . '/../symplify/rule-doc-generator-contracts', 'aliases' => array(), 'dev_requirement' => \false), 'webmozart/assert' => array('pretty_version' => '1.11.0', 'version' => '1.11.0.0', 'reference' => '11cb2199493b2f8a3b53e7f19068fc6aac760991', 'type' => 'library', 'install_path' => __DIR__ . '/../webmozart/assert', 'aliases' => array(), 'dev_requirement' => \false))); +return array('root' => array('name' => 'rector/rector-src', 'pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => null, 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), 'dev' => \false), 'versions' => array('clue/ndjson-react' => array('pretty_version' => 'v1.3.0', 'version' => '1.3.0.0', 'reference' => '392dc165fce93b5bb5c637b67e59619223c931b0', 'type' => 'library', 'install_path' => __DIR__ . '/../clue/ndjson-react', 'aliases' => array(), 'dev_requirement' => \false), 'composer/pcre' => array('pretty_version' => '3.1.1', 'version' => '3.1.1.0', 'reference' => '00104306927c7a0919b4ced2aaa6782c1e61a3c9', 'type' => 'library', 'install_path' => __DIR__ . '/./pcre', 'aliases' => array(), 'dev_requirement' => \false), 'composer/semver' => array('pretty_version' => '3.4.0', 'version' => '3.4.0.0', 'reference' => '35e8d0af4486141bc745f23a29cc2091eb624a32', 'type' => 'library', 'install_path' => __DIR__ . '/./semver', 'aliases' => array(), 'dev_requirement' => \false), 'composer/xdebug-handler' => array('pretty_version' => '3.0.3', 'version' => '3.0.3.0', 'reference' => 'ced299686f41dce890debac69273b47ffe98a40c', 'type' => 'library', 'install_path' => __DIR__ . '/./xdebug-handler', 'aliases' => array(), 'dev_requirement' => \false), 'doctrine/inflector' => array('pretty_version' => '2.0.9', 'version' => '2.0.9.0', 'reference' => '2930cd5ef353871c821d5c43ed030d39ac8cfe65', 'type' => 'library', 'install_path' => __DIR__ . '/../doctrine/inflector', 'aliases' => array(), 'dev_requirement' => \false), 'evenement/evenement' => array('pretty_version' => 'v3.0.2', 'version' => '3.0.2.0', 'reference' => '0a16b0d71ab13284339abb99d9d2bd813640efbc', 'type' => 'library', 'install_path' => __DIR__ . '/../evenement/evenement', 'aliases' => array(), 'dev_requirement' => \false), 'fidry/cpu-core-counter' => array('pretty_version' => '1.1.0', 'version' => '1.1.0.0', 'reference' => 'f92996c4d5c1a696a6a970e20f7c4216200fcc42', 'type' => 'library', 'install_path' => __DIR__ . '/../fidry/cpu-core-counter', 'aliases' => array(), 'dev_requirement' => \false), 'illuminate/container' => array('pretty_version' => 'v10.43.0', 'version' => '10.43.0.0', 'reference' => 'ddc26273085fad3c471b2602ad820e0097ff7939', 'type' => 'library', 'install_path' => __DIR__ . '/../illuminate/container', 'aliases' => array(), 'dev_requirement' => \false), 'illuminate/contracts' => array('pretty_version' => 'v10.43.0', 'version' => '10.43.0.0', 'reference' => '8d7152c4a1f5d9cf7da3e8b71f23e4556f6138ac', 'type' => 'library', 'install_path' => __DIR__ . '/../illuminate/contracts', 'aliases' => array(), 'dev_requirement' => \false), 'nette/utils' => array('pretty_version' => 'v3.2.10', 'version' => '3.2.10.0', 'reference' => 'a4175c62652f2300c8017fb7e640f9ccb11648d2', 'type' => 'library', 'install_path' => __DIR__ . '/../nette/utils', 'aliases' => array(), 'dev_requirement' => \false), 'nikic/php-parser' => array('pretty_version' => 'v4.18.0', 'version' => '4.18.0.0', 'reference' => '1bcbb2179f97633e98bbbc87044ee2611c7d7999', 'type' => 'library', 'install_path' => __DIR__ . '/../nikic/php-parser', 'aliases' => array(), 'dev_requirement' => \false), 'ondram/ci-detector' => array('pretty_version' => '4.1.0', 'version' => '4.1.0.0', 'reference' => '8a4b664e916df82ff26a44709942dfd593fa6f30', 'type' => 'library', 'install_path' => __DIR__ . '/../ondram/ci-detector', 'aliases' => array(), 'dev_requirement' => \false), 'phpstan/phpdoc-parser' => array('pretty_version' => '1.25.0', 'version' => '1.25.0.0', 'reference' => 'bd84b629c8de41aa2ae82c067c955e06f1b00240', 'type' => 'library', 'install_path' => __DIR__ . '/../phpstan/phpdoc-parser', 'aliases' => array(), 'dev_requirement' => \false), 'phpstan/phpstan' => array('dev_requirement' => \false, 'replaced' => array(0 => '^1.10.57')), 'psr/container' => array('pretty_version' => '2.0.2', 'version' => '2.0.2.0', 'reference' => 'c71ecc56dfe541dbd90c5360474fbc405f8d5963', 'type' => 'library', 'install_path' => __DIR__ . '/../psr/container', 'aliases' => array(), 'dev_requirement' => \false), 'psr/container-implementation' => array('dev_requirement' => \false, 'provided' => array(0 => '1.1|2.0')), 'psr/log' => array('pretty_version' => '3.0.0', 'version' => '3.0.0.0', 'reference' => 'fe5ea303b0887d5caefd3d431c3e61ad47037001', 'type' => 'library', 'install_path' => __DIR__ . '/../psr/log', 'aliases' => array(), 'dev_requirement' => \false), 'psr/log-implementation' => array('dev_requirement' => \false, 'provided' => array(0 => '1.0|2.0|3.0')), 'psr/simple-cache' => array('pretty_version' => '3.0.0', 'version' => '3.0.0.0', 'reference' => '764e0b3939f5ca87cb904f570ef9be2d78a07865', 'type' => 'library', 'install_path' => __DIR__ . '/../psr/simple-cache', 'aliases' => array(), 'dev_requirement' => \false), 'react/cache' => array('pretty_version' => 'v1.2.0', 'version' => '1.2.0.0', 'reference' => 'd47c472b64aa5608225f47965a484b75c7817d5b', 'type' => 'library', 'install_path' => __DIR__ . '/../react/cache', 'aliases' => array(), 'dev_requirement' => \false), 'react/child-process' => array('pretty_version' => 'v0.6.5', 'version' => '0.6.5.0', 'reference' => 'e71eb1aa55f057c7a4a0d08d06b0b0a484bead43', 'type' => 'library', 'install_path' => __DIR__ . '/../react/child-process', 'aliases' => array(), 'dev_requirement' => \false), 'react/dns' => array('pretty_version' => 'v1.12.0', 'version' => '1.12.0.0', 'reference' => 'c134600642fa615b46b41237ef243daa65bb64ec', 'type' => 'library', 'install_path' => __DIR__ . '/../react/dns', 'aliases' => array(), 'dev_requirement' => \false), 'react/event-loop' => array('pretty_version' => 'v1.5.0', 'version' => '1.5.0.0', 'reference' => 'bbe0bd8c51ffc05ee43f1729087ed3bdf7d53354', 'type' => 'library', 'install_path' => __DIR__ . '/../react/event-loop', 'aliases' => array(), 'dev_requirement' => \false), 'react/promise' => array('pretty_version' => 'v2.11.0', 'version' => '2.11.0.0', 'reference' => '1a8460931ea36dc5c76838fec5734d55c88c6831', 'type' => 'library', 'install_path' => __DIR__ . '/../react/promise', 'aliases' => array(), 'dev_requirement' => \false), 'react/socket' => array('pretty_version' => 'v1.15.0', 'version' => '1.15.0.0', 'reference' => '216d3aec0b87f04a40ca04f481e6af01bdd1d038', 'type' => 'library', 'install_path' => __DIR__ . '/../react/socket', 'aliases' => array(), 'dev_requirement' => \false), 'react/stream' => array('pretty_version' => 'v1.3.0', 'version' => '1.3.0.0', 'reference' => '6fbc9672905c7d5a885f2da2fc696f65840f4a66', 'type' => 'library', 'install_path' => __DIR__ . '/../react/stream', 'aliases' => array(), 'dev_requirement' => \false), 'rector/extension-installer' => array('pretty_version' => '0.11.2', 'version' => '0.11.2.0', 'reference' => '05544e9b195863b8571ae2a3b903cbec7fa062e0', 'type' => 'composer-plugin', 'install_path' => __DIR__ . '/../rector/extension-installer', 'aliases' => array(), 'dev_requirement' => \false), 'rector/rector' => array('dev_requirement' => \false, 'replaced' => array(0 => 'dev-main')), 'rector/rector-doctrine' => array('pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => '4eb75185edb27fd390328303f8996ccf34a73e70', 'type' => 'rector-extension', 'install_path' => __DIR__ . '/../rector/rector-doctrine', 'aliases' => array(0 => '9999999-dev'), 'dev_requirement' => \false), 'rector/rector-downgrade-php' => array('pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => '8d1aab27edc3409cd976ddf109ac4933ec33ad5b', 'type' => 'rector-extension', 'install_path' => __DIR__ . '/../rector/rector-downgrade-php', 'aliases' => array(0 => '9999999-dev'), 'dev_requirement' => \false), 'rector/rector-phpunit' => array('pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => 'f091938e0b34c64acab524c2acff911cea769b57', 'type' => 'rector-extension', 'install_path' => __DIR__ . '/../rector/rector-phpunit', 'aliases' => array(0 => '0.11.x-dev'), 'dev_requirement' => \false), 'rector/rector-src' => array('pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => null, 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), 'dev_requirement' => \false), 'rector/rector-symfony' => array('pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => '5a62f1739e6feb5463d95ed02063aae860d358e4', 'type' => 'rector-extension', 'install_path' => __DIR__ . '/../rector/rector-symfony', 'aliases' => array(0 => '9999999-dev'), 'dev_requirement' => \false), 'sebastian/diff' => array('pretty_version' => '5.1.0', 'version' => '5.1.0.0', 'reference' => 'fbf413a49e54f6b9b17e12d900ac7f6101591b7f', 'type' => 'library', 'install_path' => __DIR__ . '/../sebastian/diff', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/console' => array('pretty_version' => 'v6.4.3', 'version' => '6.4.3.0', 'reference' => '2aaf83b4de5b9d43b93e4aec6f2f8b676f7c567e', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/console', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/deprecation-contracts' => array('pretty_version' => 'v3.4.0', 'version' => '3.4.0.0', 'reference' => '7c3aff79d10325257a001fcf92d991f24fc967cf', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/deprecation-contracts', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/filesystem' => array('pretty_version' => 'v6.4.3', 'version' => '6.4.3.0', 'reference' => '7f3b1755eb49297a0827a7575d5d2b2fd11cc9fb', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/filesystem', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/finder' => array('pretty_version' => 'v6.4.0', 'version' => '6.4.0.0', 'reference' => '11d736e97f116ac375a81f96e662911a34cd50ce', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/finder', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/polyfill-ctype' => array('dev_requirement' => \false, 'replaced' => array(0 => '*')), 'symfony/polyfill-intl-grapheme' => array('dev_requirement' => \false, 'replaced' => array(0 => '*')), 'symfony/polyfill-mbstring' => array('pretty_version' => 'v1.29.0', 'version' => '1.29.0.0', 'reference' => '9773676c8a1bb1f8d4340a62efe641cf76eda7ec', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/polyfill-mbstring', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/process' => array('pretty_version' => 'v6.4.3', 'version' => '6.4.3.0', 'reference' => '31642b0818bfcff85930344ef93193f8c607e0a3', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/process', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/service-contracts' => array('pretty_version' => 'v3.4.1', 'version' => '3.4.1.0', 'reference' => 'fe07cbc8d837f60caf7018068e350cc5163681a0', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/service-contracts', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/string' => array('dev_requirement' => \false, 'replaced' => array(0 => '*')), 'symfony/yaml' => array('pretty_version' => 'v6.4.3', 'version' => '6.4.3.0', 'reference' => 'd75715985f0f94f978e3a8fa42533e10db921b90', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/yaml', 'aliases' => array(), 'dev_requirement' => \false), 'symplify/easy-parallel' => array('pretty_version' => '11.2.2', 'version' => '11.2.2.0', 'reference' => '8586c18bb8efb31cd192a4e5cc94ae7813f72ed9', 'type' => 'library', 'install_path' => __DIR__ . '/../symplify/easy-parallel', 'aliases' => array(), 'dev_requirement' => \false), 'symplify/rule-doc-generator-contracts' => array('pretty_version' => '11.1.26', 'version' => '11.1.26.0', 'reference' => '3e66b3fec678b74a076395ec629d535fb95293b5', 'type' => 'library', 'install_path' => __DIR__ . '/../symplify/rule-doc-generator-contracts', 'aliases' => array(), 'dev_requirement' => \false), 'webmozart/assert' => array('pretty_version' => '1.11.0', 'version' => '1.11.0.0', 'reference' => '11cb2199493b2f8a3b53e7f19068fc6aac760991', 'type' => 'library', 'install_path' => __DIR__ . '/../webmozart/assert', 'aliases' => array(), 'dev_requirement' => \false))); diff --git a/vendor/rector/extension-installer/src/GeneratedConfig.php b/vendor/rector/extension-installer/src/GeneratedConfig.php index 9ac74bb6cba..e41c96079a5 100644 --- a/vendor/rector/extension-installer/src/GeneratedConfig.php +++ b/vendor/rector/extension-installer/src/GeneratedConfig.php @@ -9,7 +9,7 @@ namespace Rector\RectorInstaller; */ final class GeneratedConfig { - public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => NULL, 'version' => 'dev-main 9057680'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => NULL, 'version' => 'dev-main 8d1aab2'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => NULL, 'version' => 'dev-main f091938'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => NULL, 'version' => 'dev-main 5a62f17')); + public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => NULL, 'version' => 'dev-main 4eb7518'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => NULL, 'version' => 'dev-main 8d1aab2'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => NULL, 'version' => 'dev-main f091938'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => NULL, 'version' => 'dev-main 5a62f17')); private function __construct() { } diff --git a/vendor/rector/rector-doctrine/composer.json b/vendor/rector/rector-doctrine/composer.json index 694cbcd8087..3e20220e37a 100644 --- a/vendor/rector/rector-doctrine/composer.json +++ b/vendor/rector/rector-doctrine/composer.json @@ -4,7 +4,8 @@ "license": "MIT", "description": "Rector upgrades rules for Doctrine", "require": { - "php": ">=8.2" + "php": ">=8.2", + "symfony\/yaml": "^6.4" }, "require-dev": { "doctrine\/orm": "^2.18", diff --git a/vendor/scoper-autoload.php b/vendor/scoper-autoload.php index 118b659376f..9c0b012435c 100644 --- a/vendor/scoper-autoload.php +++ b/vendor/scoper-autoload.php @@ -36,6 +36,7 @@ humbug_phpscoper_expose_class('Product', 'RectorPrefix202402\Product'); // Function aliases. For more information see: // https://github.com/humbug/php-scoper/blob/master/docs/further-reading.md#function-aliases if (!function_exists('formatErrorMessage')) { function formatErrorMessage() { return \RectorPrefix202402\formatErrorMessage(...func_get_args()); } } +if (!function_exists('includeIfExists')) { function includeIfExists() { return \RectorPrefix202402\includeIfExists(...func_get_args()); } } if (!function_exists('mb_check_encoding')) { function mb_check_encoding() { return \RectorPrefix202402\mb_check_encoding(...func_get_args()); } } if (!function_exists('mb_chr')) { function mb_chr() { return \RectorPrefix202402\mb_chr(...func_get_args()); } } if (!function_exists('mb_convert_case')) { function mb_convert_case() { return \RectorPrefix202402\mb_convert_case(...func_get_args()); } } diff --git a/vendor/symfony/yaml/CHANGELOG.md b/vendor/symfony/yaml/CHANGELOG.md new file mode 100644 index 00000000000..0c2021f48b2 --- /dev/null +++ b/vendor/symfony/yaml/CHANGELOG.md @@ -0,0 +1,253 @@ +CHANGELOG +========= + +6.3 +--- + + * Add support to dump int keys as strings by using the `Yaml::DUMP_NUMERIC_KEY_AS_STRING` flag + +6.2 +--- + + * Add support for `!php/enum` and `!php/enum *->value` + * Deprecate the `!php/const:` tag in key which will be replaced by the `!php/const` tag (without the colon) since 3.4 + +6.1 +--- + + * In cases where it will likely improve readability, strings containing single quotes will be double-quoted + +5.4 +--- + + * Add new `lint:yaml dirname --exclude=/dirname/foo.yaml --exclude=/dirname/bar.yaml` + option to exclude one or more specific files from multiple file list + * Allow negatable for the parse tags option with `--no-parse-tags` + +5.3 +--- + + * Added `github` format support & autodetection to render errors as annotations + when running the YAML linter command in a Github Action environment. + +5.1.0 +----- + + * Added support for parsing numbers prefixed with `0o` as octal numbers. + * Deprecated support for parsing numbers starting with `0` as octal numbers. They will be parsed as strings as of Symfony 6.0. Prefix numbers with `0o` + so that they are parsed as octal numbers. + + Before: + + ```yaml + Yaml::parse('072'); + ``` + + After: + + ```yaml + Yaml::parse('0o72'); + ``` + + * Added `yaml-lint` binary. + * Deprecated using the `!php/object` and `!php/const` tags without a value. + +5.0.0 +----- + + * Removed support for mappings inside multi-line strings. + * removed support for implicit STDIN usage in the `lint:yaml` command, use `lint:yaml -` (append a dash) instead to make it explicit. + +4.4.0 +----- + + * Added support for parsing the inline notation spanning multiple lines. + * Added support to dump `null` as `~` by using the `Yaml::DUMP_NULL_AS_TILDE` flag. + * deprecated accepting STDIN implicitly when using the `lint:yaml` command, use `lint:yaml -` (append a dash) instead to make it explicit. + +4.3.0 +----- + + * Using a mapping inside a multi-line string is deprecated and will throw a `ParseException` in 5.0. + +4.2.0 +----- + + * added support for multiple files or directories in `LintCommand` + +4.0.0 +----- + + * The behavior of the non-specific tag `!` is changed and now forces + non-evaluating your values. + * complex mappings will throw a `ParseException` + * support for the comma as a group separator for floats has been dropped, use + the underscore instead + * support for the `!!php/object` tag has been dropped, use the `!php/object` + tag instead + * duplicate mapping keys throw a `ParseException` + * non-string mapping keys throw a `ParseException`, use the `Yaml::PARSE_KEYS_AS_STRINGS` + flag to cast them to strings + * `%` at the beginning of an unquoted string throw a `ParseException` + * mappings with a colon (`:`) that is not followed by a whitespace throw a + `ParseException` + * the `Dumper::setIndentation()` method has been removed + * being able to pass boolean options to the `Yaml::parse()`, `Yaml::dump()`, + `Parser::parse()`, and `Dumper::dump()` methods to configure the behavior of + the parser and dumper is no longer supported, pass bitmask flags instead + * the constructor arguments of the `Parser` class have been removed + * the `Inline` class is internal and no longer part of the BC promise + * removed support for the `!str` tag, use the `!!str` tag instead + * added support for tagged scalars. + + ```yml + Yaml::parse('!foo bar', Yaml::PARSE_CUSTOM_TAGS); + // returns TaggedValue('foo', 'bar'); + ``` + +3.4.0 +----- + + * added support for parsing YAML files using the `Yaml::parseFile()` or `Parser::parseFile()` method + + * the `Dumper`, `Parser`, and `Yaml` classes are marked as final + + * Deprecated the `!php/object:` tag which will be replaced by the + `!php/object` tag (without the colon) in 4.0. + + * Deprecated the `!php/const:` tag which will be replaced by the + `!php/const` tag (without the colon) in 4.0. + + * Support for the `!str` tag is deprecated, use the `!!str` tag instead. + + * Deprecated using the non-specific tag `!` as its behavior will change in 4.0. + It will force non-evaluating your values in 4.0. Use plain integers or `!!float` instead. + +3.3.0 +----- + + * Starting an unquoted string with a question mark followed by a space is + deprecated and will throw a `ParseException` in Symfony 4.0. + + * Deprecated support for implicitly parsing non-string mapping keys as strings. + Mapping keys that are no strings will lead to a `ParseException` in Symfony + 4.0. Use quotes to opt-in for keys to be parsed as strings. + + Before: + + ```php + $yaml = << new A(), 'bar' => 1], 0, 0, Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE | Yaml::DUMP_OBJECT); + ``` + +3.0.0 +----- + + * Yaml::parse() now throws an exception when a blackslash is not escaped + in double-quoted strings + +2.8.0 +----- + + * Deprecated usage of a colon in an unquoted mapping value + * Deprecated usage of @, \`, | and > at the beginning of an unquoted string + * When surrounding strings with double-quotes, you must now escape `\` characters. Not + escaping those characters (when surrounded by double-quotes) is deprecated. + + Before: + + ```yml + class: "Foo\Var" + ``` + + After: + + ```yml + class: "Foo\\Var" + ``` + +2.1.0 +----- + + * Yaml::parse() does not evaluate loaded files as PHP files by default + anymore (call Yaml::enablePhpParsing() to get back the old behavior) diff --git a/vendor/symfony/yaml/Command/LintCommand.php b/vendor/symfony/yaml/Command/LintCommand.php new file mode 100644 index 00000000000..405473b1644 --- /dev/null +++ b/vendor/symfony/yaml/Command/LintCommand.php @@ -0,0 +1,243 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace RectorPrefix202402\Symfony\Component\Yaml\Command; + +use RectorPrefix202402\Symfony\Component\Console\Attribute\AsCommand; +use RectorPrefix202402\Symfony\Component\Console\CI\GithubActionReporter; +use RectorPrefix202402\Symfony\Component\Console\Command\Command; +use RectorPrefix202402\Symfony\Component\Console\Completion\CompletionInput; +use RectorPrefix202402\Symfony\Component\Console\Completion\CompletionSuggestions; +use RectorPrefix202402\Symfony\Component\Console\Exception\InvalidArgumentException; +use RectorPrefix202402\Symfony\Component\Console\Exception\RuntimeException; +use RectorPrefix202402\Symfony\Component\Console\Input\InputArgument; +use RectorPrefix202402\Symfony\Component\Console\Input\InputInterface; +use RectorPrefix202402\Symfony\Component\Console\Input\InputOption; +use RectorPrefix202402\Symfony\Component\Console\Output\OutputInterface; +use RectorPrefix202402\Symfony\Component\Console\Style\SymfonyStyle; +use RectorPrefix202402\Symfony\Component\Yaml\Exception\ParseException; +use RectorPrefix202402\Symfony\Component\Yaml\Parser; +use RectorPrefix202402\Symfony\Component\Yaml\Yaml; +/** + * Validates YAML files syntax and outputs encountered errors. + * + * @author Grégoire Pineau + * @author Robin Chalas + */ +class LintCommand extends Command +{ + /** + * @var \Symfony\Component\Yaml\Parser + */ + private $parser; + /** + * @var string|null + */ + private $format; + /** + * @var bool + */ + private $displayCorrectFiles; + /** + * @var \Closure|null + */ + private $directoryIteratorProvider; + /** + * @var \Closure|null + */ + private $isReadableProvider; + public function __construct(?string $name = null, ?callable $directoryIteratorProvider = null, ?callable $isReadableProvider = null) + { + parent::__construct($name); + $this->directoryIteratorProvider = null === $directoryIteratorProvider ? null : \Closure::fromCallable($directoryIteratorProvider); + $this->isReadableProvider = null === $isReadableProvider ? null : \Closure::fromCallable($isReadableProvider); + } + /** + * @return void + */ + protected function configure() + { + $this->addArgument('filename', InputArgument::IS_ARRAY, 'A file, a directory or "-" for reading from STDIN')->addOption('format', null, InputOption::VALUE_REQUIRED, \sprintf('The output format ("%s")', \implode('", "', $this->getAvailableFormatOptions())))->addOption('exclude', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Path(s) to exclude')->addOption('parse-tags', null, InputOption::VALUE_NEGATABLE, 'Parse custom tags', null)->setHelp(<<%command.name% command lints a YAML file and outputs to STDOUT +the first encountered syntax error. + +You can validates YAML contents passed from STDIN: + + cat filename | php %command.full_name% - + +You can also validate the syntax of a file: + + php %command.full_name% filename + +Or of a whole directory: + + php %command.full_name% dirname + php %command.full_name% dirname --format=json + +You can also exclude one or more specific files: + + php %command.full_name% dirname --exclude="dirname/foo.yaml" --exclude="dirname/bar.yaml" + +EOF +); + } + protected function execute(InputInterface $input, OutputInterface $output) : int + { + $io = new SymfonyStyle($input, $output); + $filenames = (array) $input->getArgument('filename'); + $excludes = $input->getOption('exclude'); + $this->format = $input->getOption('format'); + $flags = $input->getOption('parse-tags'); + if (null === $this->format) { + // Autodetect format according to CI environment + $this->format = \class_exists(GithubActionReporter::class) && GithubActionReporter::isGithubActionEnvironment() ? 'github' : 'txt'; + } + $flags = $flags ? Yaml::PARSE_CUSTOM_TAGS : 0; + $this->displayCorrectFiles = $output->isVerbose(); + if (['-'] === $filenames) { + return $this->display($io, [$this->validate(\file_get_contents('php://stdin'), $flags)]); + } + if (!$filenames) { + throw new RuntimeException('Please provide a filename or pipe file content to STDIN.'); + } + $filesInfo = []; + foreach ($filenames as $filename) { + if (!$this->isReadable($filename)) { + throw new RuntimeException(\sprintf('File or directory "%s" is not readable.', $filename)); + } + foreach ($this->getFiles($filename) as $file) { + if (!\in_array($file->getPathname(), $excludes, \true)) { + $filesInfo[] = $this->validate(\file_get_contents($file), $flags, $file); + } + } + } + return $this->display($io, $filesInfo); + } + private function validate(string $content, int $flags, ?string $file = null) : array + { + $prevErrorHandler = \set_error_handler(function ($level, $message, $file, $line) use(&$prevErrorHandler) { + if (\E_USER_DEPRECATED === $level) { + throw new ParseException($message, $this->getParser()->getRealCurrentLineNb() + 1); + } + return $prevErrorHandler ? $prevErrorHandler($level, $message, $file, $line) : \false; + }); + try { + $this->getParser()->parse($content, Yaml::PARSE_CONSTANT | $flags); + } catch (ParseException $e) { + return ['file' => $file, 'line' => $e->getParsedLine(), 'valid' => \false, 'message' => $e->getMessage()]; + } finally { + \restore_error_handler(); + } + return ['file' => $file, 'valid' => \true]; + } + private function display(SymfonyStyle $io, array $files) : int + { + switch ($this->format) { + case 'txt': + return $this->displayTxt($io, $files); + case 'json': + return $this->displayJson($io, $files); + case 'github': + return $this->displayTxt($io, $files, \true); + default: + throw new InvalidArgumentException(\sprintf('Supported formats are "%s".', \implode('", "', $this->getAvailableFormatOptions()))); + } + } + private function displayTxt(SymfonyStyle $io, array $filesInfo, bool $errorAsGithubAnnotations = \false) : int + { + $countFiles = \count($filesInfo); + $erroredFiles = 0; + $suggestTagOption = \false; + if ($errorAsGithubAnnotations) { + $githubReporter = new GithubActionReporter($io); + } + foreach ($filesInfo as $info) { + if ($info['valid'] && $this->displayCorrectFiles) { + $io->comment('OK' . ($info['file'] ? \sprintf(' in %s', $info['file']) : '')); + } elseif (!$info['valid']) { + ++$erroredFiles; + $io->text(' ERROR ' . ($info['file'] ? \sprintf(' in %s', $info['file']) : '')); + $io->text(\sprintf(' >> %s', $info['message'])); + if (\strpos($info['message'], 'PARSE_CUSTOM_TAGS') !== \false) { + $suggestTagOption = \true; + } + if ($errorAsGithubAnnotations) { + $githubReporter->error($info['message'], $info['file'] ?? 'php://stdin', $info['line']); + } + } + } + if (0 === $erroredFiles) { + $io->success(\sprintf('All %d YAML files contain valid syntax.', $countFiles)); + } else { + $io->warning(\sprintf('%d YAML files have valid syntax and %d contain errors.%s', $countFiles - $erroredFiles, $erroredFiles, $suggestTagOption ? ' Use the --parse-tags option if you want parse custom tags.' : '')); + } + return \min($erroredFiles, 1); + } + private function displayJson(SymfonyStyle $io, array $filesInfo) : int + { + $errors = 0; + \array_walk($filesInfo, function (&$v) use(&$errors) { + $v['file'] = (string) $v['file']; + if (!$v['valid']) { + ++$errors; + } + if (isset($v['message']) && \strpos($v['message'], 'PARSE_CUSTOM_TAGS') !== \false) { + $v['message'] .= ' Use the --parse-tags option if you want parse custom tags.'; + } + }); + $io->writeln(\json_encode($filesInfo, \JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES)); + return \min($errors, 1); + } + private function getFiles(string $fileOrDirectory) : iterable + { + if (\is_file($fileOrDirectory)) { + (yield new \SplFileInfo($fileOrDirectory)); + return; + } + foreach ($this->getDirectoryIterator($fileOrDirectory) as $file) { + if (!\in_array($file->getExtension(), ['yml', 'yaml'])) { + continue; + } + (yield $file); + } + } + private function getParser() : Parser + { + return $this->parser = $this->parser ?? new Parser(); + } + private function getDirectoryIterator(string $directory) : iterable + { + $default = function ($directory) { + return new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($directory, \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS), \RecursiveIteratorIterator::LEAVES_ONLY); + }; + if (null !== $this->directoryIteratorProvider) { + return ($this->directoryIteratorProvider)($directory, $default); + } + return $default($directory); + } + private function isReadable(string $fileOrDirectory) : bool + { + $default = \Closure::fromCallable('is_readable'); + if (null !== $this->isReadableProvider) { + return ($this->isReadableProvider)($fileOrDirectory, $default); + } + return $default($fileOrDirectory); + } + public function complete(CompletionInput $input, CompletionSuggestions $suggestions) : void + { + if ($input->mustSuggestOptionValuesFor('format')) { + $suggestions->suggestValues($this->getAvailableFormatOptions()); + } + } + private function getAvailableFormatOptions() : array + { + return ['txt', 'json', 'github']; + } +} diff --git a/vendor/symfony/yaml/Dumper.php b/vendor/symfony/yaml/Dumper.php new file mode 100644 index 00000000000..50d8fd82c41 --- /dev/null +++ b/vendor/symfony/yaml/Dumper.php @@ -0,0 +1,140 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace RectorPrefix202402\Symfony\Component\Yaml; + +use RectorPrefix202402\Symfony\Component\Yaml\Tag\TaggedValue; +/** + * Dumper dumps PHP variables to YAML strings. + * + * @author Fabien Potencier + * + * @final + */ +class Dumper +{ + /** + * The amount of spaces to use for indentation of nested nodes. + * @var int + */ + private $indentation; + public function __construct(int $indentation = 4) + { + if ($indentation < 1) { + throw new \InvalidArgumentException('The indentation must be greater than zero.'); + } + $this->indentation = $indentation; + } + /** + * Dumps a PHP value to YAML. + * + * @param mixed $input The PHP value + * @param int $inline The level where you switch to inline YAML + * @param int $indent The level of indentation (used internally) + * @param int $flags A bit field of Yaml::DUMP_* constants to customize the dumped YAML string + */ + public function dump($input, int $inline = 0, int $indent = 0, int $flags = 0) : string + { + $output = ''; + $prefix = $indent ? \str_repeat(' ', $indent) : ''; + $dumpObjectAsInlineMap = \true; + if (Yaml::DUMP_OBJECT_AS_MAP & $flags && ($input instanceof \ArrayObject || $input instanceof \stdClass)) { + $dumpObjectAsInlineMap = empty((array) $input); + } + if ($inline <= 0 || !\is_array($input) && !$input instanceof TaggedValue && $dumpObjectAsInlineMap || empty($input)) { + $output .= $prefix . Inline::dump($input, $flags); + } elseif ($input instanceof TaggedValue) { + $output .= $this->dumpTaggedValue($input, $inline, $indent, $flags, $prefix); + } else { + $dumpAsMap = Inline::isHash($input); + foreach ($input as $key => $value) { + if ('' !== $output && "\n" !== $output[-1]) { + $output .= "\n"; + } + if (\is_int($key) && Yaml::DUMP_NUMERIC_KEY_AS_STRING & $flags) { + $key = (string) $key; + } + if (Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK & $flags && \is_string($value) && \strpos($value, "\n") !== \false && \strpos($value, "\r") === \false) { + $blockIndentationIndicator = $this->getBlockIndentationIndicator($value); + if (isset($value[-2]) && "\n" === $value[-2] && "\n" === $value[-1]) { + $blockChompingIndicator = '+'; + } elseif ("\n" === $value[-1]) { + $blockChompingIndicator = ''; + } else { + $blockChompingIndicator = '-'; + } + $output .= \sprintf('%s%s%s |%s%s', $prefix, $dumpAsMap ? Inline::dump($key, $flags) . ':' : '-', '', $blockIndentationIndicator, $blockChompingIndicator); + foreach (\explode("\n", $value) as $row) { + if ('' === $row) { + $output .= "\n"; + } else { + $output .= \sprintf("\n%s%s%s", $prefix, \str_repeat(' ', $this->indentation), $row); + } + } + continue; + } + if ($value instanceof TaggedValue) { + $output .= \sprintf('%s%s !%s', $prefix, $dumpAsMap ? Inline::dump($key, $flags) . ':' : '-', $value->getTag()); + if (Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK & $flags && \is_string($value->getValue()) && \strpos($value->getValue(), "\n") !== \false && \strpos($value->getValue(), "\r\n") === \false) { + $blockIndentationIndicator = $this->getBlockIndentationIndicator($value->getValue()); + $output .= \sprintf(' |%s', $blockIndentationIndicator); + foreach (\explode("\n", $value->getValue()) as $row) { + $output .= \sprintf("\n%s%s%s", $prefix, \str_repeat(' ', $this->indentation), $row); + } + continue; + } + if ($inline - 1 <= 0 || null === $value->getValue() || \is_scalar($value->getValue())) { + $output .= ' ' . $this->dump($value->getValue(), $inline - 1, 0, $flags) . "\n"; + } else { + $output .= "\n"; + $output .= $this->dump($value->getValue(), $inline - 1, $dumpAsMap ? $indent + $this->indentation : $indent + 2, $flags); + } + continue; + } + $dumpObjectAsInlineMap = \true; + if (Yaml::DUMP_OBJECT_AS_MAP & $flags && ($value instanceof \ArrayObject || $value instanceof \stdClass)) { + $dumpObjectAsInlineMap = empty((array) $value); + } + $willBeInlined = $inline - 1 <= 0 || !\is_array($value) && $dumpObjectAsInlineMap || empty($value); + $output .= \sprintf('%s%s%s%s', $prefix, $dumpAsMap ? Inline::dump($key, $flags) . ':' : '-', $willBeInlined ? ' ' : "\n", $this->dump($value, $inline - 1, $willBeInlined ? 0 : $indent + $this->indentation, $flags)) . ($willBeInlined ? "\n" : ''); + } + } + return $output; + } + private function dumpTaggedValue(TaggedValue $value, int $inline, int $indent, int $flags, string $prefix) : string + { + $output = \sprintf('%s!%s', $prefix ? $prefix . ' ' : '', $value->getTag()); + if (Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK & $flags && \is_string($value->getValue()) && \strpos($value->getValue(), "\n") !== \false && \strpos($value->getValue(), "\r\n") === \false) { + $blockIndentationIndicator = $this->getBlockIndentationIndicator($value->getValue()); + $output .= \sprintf(' |%s', $blockIndentationIndicator); + foreach (\explode("\n", $value->getValue()) as $row) { + $output .= \sprintf("\n%s%s%s", $prefix, \str_repeat(' ', $this->indentation), $row); + } + return $output; + } + if ($inline - 1 <= 0 || null === $value->getValue() || \is_scalar($value->getValue())) { + return $output . ' ' . $this->dump($value->getValue(), $inline - 1, 0, $flags) . "\n"; + } + return $output . "\n" . $this->dump($value->getValue(), $inline - 1, $indent, $flags); + } + private function getBlockIndentationIndicator(string $value) : string + { + $lines = \explode("\n", $value); + // If the first line (that is neither empty nor contains only spaces) + // starts with a space character, the spec requires a block indentation indicator + // http://www.yaml.org/spec/1.2/spec.html#id2793979 + foreach ($lines as $line) { + if ('' !== \trim($line, ' ')) { + return ' ' === \substr($line, 0, 1) ? (string) $this->indentation : ''; + } + } + return ''; + } +} diff --git a/vendor/symfony/yaml/Escaper.php b/vendor/symfony/yaml/Escaper.php new file mode 100644 index 00000000000..aa1948f1312 --- /dev/null +++ b/vendor/symfony/yaml/Escaper.php @@ -0,0 +1,74 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace RectorPrefix202402\Symfony\Component\Yaml; + +/** + * Escaper encapsulates escaping rules for single and double-quoted + * YAML strings. + * + * @author Matthew Lewinski + * + * @internal + */ +class Escaper +{ + // Characters that would cause a dumped string to require double quoting. + public const REGEX_CHARACTER_TO_ESCAPE = "[\\x00-\\x1f]||…| |
|
"; + // Mapping arrays for escaping a double quoted string. The backslash is + // first to ensure proper escaping because str_replace operates iteratively + // on the input arrays. This ordering of the characters avoids the use of strtr, + // which performs more slowly. + private const ESCAPEES = ['\\', '\\\\', '\\"', '"', "\x00", "\x01", "\x02", "\x03", "\x04", "\x05", "\x06", "\x07", "\x08", "\t", "\n", "\v", "\f", "\r", "\x0e", "\x0f", "\x10", "\x11", "\x12", "\x13", "\x14", "\x15", "\x16", "\x17", "\x18", "\x19", "\x1a", "\x1b", "\x1c", "\x1d", "\x1e", "\x1f", "", "…", " ", "
", "
"]; + private const ESCAPED = ['\\\\', '\\"', '\\\\', '\\"', '\\0', '\\x01', '\\x02', '\\x03', '\\x04', '\\x05', '\\x06', '\\a', '\\b', '\\t', '\\n', '\\v', '\\f', '\\r', '\\x0e', '\\x0f', '\\x10', '\\x11', '\\x12', '\\x13', '\\x14', '\\x15', '\\x16', '\\x17', '\\x18', '\\x19', '\\x1a', '\\e', '\\x1c', '\\x1d', '\\x1e', '\\x1f', '\\x7f', '\\N', '\\_', '\\L', '\\P']; + /** + * Determines if a PHP value would require double quoting in YAML. + * + * @param string $value A PHP value + */ + public static function requiresDoubleQuoting(string $value) : bool + { + return 0 < \preg_match('/' . self::REGEX_CHARACTER_TO_ESCAPE . '/u', $value); + } + /** + * Escapes and surrounds a PHP value with double quotes. + * + * @param string $value A PHP value + */ + public static function escapeWithDoubleQuotes(string $value) : string + { + return \sprintf('"%s"', \str_replace(self::ESCAPEES, self::ESCAPED, $value)); + } + /** + * Determines if a PHP value would require single quoting in YAML. + * + * @param string $value A PHP value + */ + public static function requiresSingleQuoting(string $value) : bool + { + // Determines if a PHP value is entirely composed of a value that would + // require single quoting in YAML. + if (\in_array(\strtolower($value), ['null', '~', 'true', 'false', 'y', 'n', 'yes', 'no', 'on', 'off'])) { + return \true; + } + // Determines if the PHP value contains any single characters that would + // cause it to require single quoting in YAML. + return 0 < \preg_match('/[ \\s \' " \\: \\{ \\} \\[ \\] , & \\* \\# \\?] | \\A[ \\- ? | < > = ! % @ ` \\p{Zs}]/xu', $value); + } + /** + * Escapes and surrounds a PHP value with single quotes. + * + * @param string $value A PHP value + */ + public static function escapeWithSingleQuotes(string $value) : string + { + return \sprintf("'%s'", \str_replace('\'', '\'\'', $value)); + } +} diff --git a/vendor/symfony/yaml/Exception/DumpException.php b/vendor/symfony/yaml/Exception/DumpException.php new file mode 100644 index 00000000000..686b44d6e92 --- /dev/null +++ b/vendor/symfony/yaml/Exception/DumpException.php @@ -0,0 +1,20 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace RectorPrefix202402\Symfony\Component\Yaml\Exception; + +/** + * Exception class thrown when an error occurs during dumping. + * + * @author Fabien Potencier + */ +class DumpException extends RuntimeException +{ +} diff --git a/vendor/symfony/yaml/Exception/ExceptionInterface.php b/vendor/symfony/yaml/Exception/ExceptionInterface.php new file mode 100644 index 00000000000..df3d85b298c --- /dev/null +++ b/vendor/symfony/yaml/Exception/ExceptionInterface.php @@ -0,0 +1,20 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace RectorPrefix202402\Symfony\Component\Yaml\Exception; + +/** + * Exception interface for all exceptions thrown by the component. + * + * @author Fabien Potencier + */ +interface ExceptionInterface extends \Throwable +{ +} diff --git a/vendor/symfony/yaml/Exception/ParseException.php b/vendor/symfony/yaml/Exception/ParseException.php new file mode 100644 index 00000000000..47299c71f95 --- /dev/null +++ b/vendor/symfony/yaml/Exception/ParseException.php @@ -0,0 +1,125 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace RectorPrefix202402\Symfony\Component\Yaml\Exception; + +/** + * Exception class thrown when an error occurs during parsing. + * + * @author Fabien Potencier + */ +class ParseException extends RuntimeException +{ + /** + * @var string|null + */ + private $parsedFile; + /** + * @var int + */ + private $parsedLine; + /** + * @var string|null + */ + private $snippet; + /** + * @var string + */ + private $rawMessage; + /** + * @param string $message The error message + * @param int $parsedLine The line where the error occurred + * @param string|null $snippet The snippet of code near the problem + * @param string|null $parsedFile The file name where the error occurred + */ + public function __construct(string $message, int $parsedLine = -1, ?string $snippet = null, ?string $parsedFile = null, ?\Throwable $previous = null) + { + $this->parsedFile = $parsedFile; + $this->parsedLine = $parsedLine; + $this->snippet = $snippet; + $this->rawMessage = $message; + $this->updateRepr(); + parent::__construct($this->message, 0, $previous); + } + /** + * Gets the snippet of code near the error. + */ + public function getSnippet() : string + { + return $this->snippet; + } + /** + * Sets the snippet of code near the error. + * + * @return void + */ + public function setSnippet(string $snippet) + { + $this->snippet = $snippet; + $this->updateRepr(); + } + /** + * Gets the filename where the error occurred. + * + * This method returns null if a string is parsed. + */ + public function getParsedFile() : string + { + return $this->parsedFile; + } + /** + * Sets the filename where the error occurred. + * + * @return void + */ + public function setParsedFile(string $parsedFile) + { + $this->parsedFile = $parsedFile; + $this->updateRepr(); + } + /** + * Gets the line where the error occurred. + */ + public function getParsedLine() : int + { + return $this->parsedLine; + } + /** + * Sets the line where the error occurred. + * + * @return void + */ + public function setParsedLine(int $parsedLine) + { + $this->parsedLine = $parsedLine; + $this->updateRepr(); + } + private function updateRepr() : void + { + $this->message = $this->rawMessage; + $dot = \false; + if (\substr_compare($this->message, '.', -\strlen('.')) === 0) { + $this->message = \substr($this->message, 0, -1); + $dot = \true; + } + if (null !== $this->parsedFile) { + $this->message .= \sprintf(' in %s', \json_encode($this->parsedFile, \JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE)); + } + if ($this->parsedLine >= 0) { + $this->message .= \sprintf(' at line %d', $this->parsedLine); + } + if ($this->snippet) { + $this->message .= \sprintf(' (near "%s")', $this->snippet); + } + if ($dot) { + $this->message .= '.'; + } + } +} diff --git a/vendor/symfony/yaml/Exception/RuntimeException.php b/vendor/symfony/yaml/Exception/RuntimeException.php new file mode 100644 index 00000000000..9c8022805d4 --- /dev/null +++ b/vendor/symfony/yaml/Exception/RuntimeException.php @@ -0,0 +1,20 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace RectorPrefix202402\Symfony\Component\Yaml\Exception; + +/** + * Exception class thrown when an error occurs during parsing. + * + * @author Romain Neutron + */ +class RuntimeException extends \RuntimeException implements ExceptionInterface +{ +} diff --git a/vendor/symfony/yaml/Inline.php b/vendor/symfony/yaml/Inline.php new file mode 100644 index 00000000000..5eeaf303c30 --- /dev/null +++ b/vendor/symfony/yaml/Inline.php @@ -0,0 +1,735 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace RectorPrefix202402\Symfony\Component\Yaml; + +use RectorPrefix202402\Symfony\Component\Yaml\Exception\DumpException; +use RectorPrefix202402\Symfony\Component\Yaml\Exception\ParseException; +use RectorPrefix202402\Symfony\Component\Yaml\Tag\TaggedValue; +/** + * Inline implements a YAML parser/dumper for the YAML inline syntax. + * + * @author Fabien Potencier + * + * @internal + */ +class Inline +{ + public const REGEX_QUOTED_STRING = '(?:"([^"\\\\]*+(?:\\\\.[^"\\\\]*+)*+)"|\'([^\']*+(?:\'\'[^\']*+)*+)\')'; + /** + * @var int + */ + public static $parsedLineNumber = -1; + /** + * @var string|null + */ + public static $parsedFilename; + /** + * @var bool + */ + private static $exceptionOnInvalidType = \false; + /** + * @var bool + */ + private static $objectSupport = \false; + /** + * @var bool + */ + private static $objectForMap = \false; + /** + * @var bool + */ + private static $constantSupport = \false; + public static function initialize(int $flags, ?int $parsedLineNumber = null, ?string $parsedFilename = null) : void + { + self::$exceptionOnInvalidType = (bool) (Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE & $flags); + self::$objectSupport = (bool) (Yaml::PARSE_OBJECT & $flags); + self::$objectForMap = (bool) (Yaml::PARSE_OBJECT_FOR_MAP & $flags); + self::$constantSupport = (bool) (Yaml::PARSE_CONSTANT & $flags); + self::$parsedFilename = $parsedFilename; + if (null !== $parsedLineNumber) { + self::$parsedLineNumber = $parsedLineNumber; + } + } + /** + * Converts a YAML string to a PHP value. + * + * @param int $flags A bit field of Yaml::PARSE_* constants to customize the YAML parser behavior + * @param array $references Mapping of variable names to values + * + * @throws ParseException + * @return mixed + */ + public static function parse(string $value, int $flags = 0, array &$references = []) + { + self::initialize($flags); + $value = \trim($value); + if ('' === $value) { + return ''; + } + $i = 0; + $tag = self::parseTag($value, $i, $flags); + switch ($value[$i]) { + case '[': + $result = self::parseSequence($value, $flags, $i, $references); + ++$i; + break; + case '{': + $result = self::parseMapping($value, $flags, $i, $references); + ++$i; + break; + default: + $result = self::parseScalar($value, $flags, null, $i, \true, $references); + } + // some comments are allowed at the end + if (\preg_replace('/\\s*#.*$/A', '', \substr($value, $i))) { + throw new ParseException(\sprintf('Unexpected characters near "%s".', \substr($value, $i)), self::$parsedLineNumber + 1, $value, self::$parsedFilename); + } + if (null !== $tag && '' !== $tag) { + return new TaggedValue($tag, $result); + } + return $result; + } + /** + * Dumps a given PHP variable to a YAML string. + * + * @param mixed $value The PHP variable to convert + * @param int $flags A bit field of Yaml::DUMP_* constants to customize the dumped YAML string + * + * @throws DumpException When trying to dump PHP resource + */ + public static function dump($value, int $flags = 0) : string + { + switch (\true) { + case \is_resource($value): + if (Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE & $flags) { + throw new DumpException(\sprintf('Unable to dump PHP resources in a YAML file ("%s").', \get_resource_type($value))); + } + return self::dumpNull($flags); + case $value instanceof \DateTimeInterface: + return $value->format((function () use($value) { + switch (\true) { + case !($length = \strlen(\rtrim($value->format('u'), '0'))): + return 'c'; + case $length < 4: + return 'Y-m-d\\TH:i:s.vP'; + default: + return 'Y-m-d\\TH:i:s.uP'; + } + })()); + case $value instanceof \UnitEnum: + return \sprintf('!php/const %s::%s', \get_class($value), $value->name); + case \is_object($value): + if ($value instanceof TaggedValue) { + return '!' . $value->getTag() . ' ' . self::dump($value->getValue(), $flags); + } + if (Yaml::DUMP_OBJECT & $flags) { + return '!php/object ' . self::dump(\serialize($value)); + } + if (Yaml::DUMP_OBJECT_AS_MAP & $flags && ($value instanceof \stdClass || $value instanceof \ArrayObject)) { + return self::dumpHashArray($value, $flags); + } + if (Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE & $flags) { + throw new DumpException('Object support when dumping a YAML file has been disabled.'); + } + return self::dumpNull($flags); + case \is_array($value): + return self::dumpArray($value, $flags); + case null === $value: + return self::dumpNull($flags); + case \true === $value: + return 'true'; + case \false === $value: + return 'false'; + case \is_int($value): + return $value; + case \is_numeric($value) && \false === \strpbrk($value, "\f\n\r\t\v"): + $locale = \setlocale(\LC_NUMERIC, 0); + if (\false !== $locale) { + \setlocale(\LC_NUMERIC, 'C'); + } + if (\is_float($value)) { + $repr = (string) $value; + if (\is_infinite($value)) { + $repr = \str_ireplace('INF', '.Inf', $repr); + } elseif (\floor($value) == $value && $repr == $value) { + // Preserve float data type since storing a whole number will result in integer value. + if (\strpos($repr, 'E') === \false) { + $repr .= '.0'; + } + } + } else { + $repr = \is_string($value) ? "'{$value}'" : (string) $value; + } + if (\false !== $locale) { + \setlocale(\LC_NUMERIC, $locale); + } + return $repr; + case '' == $value: + return "''"; + case self::isBinaryString($value): + return '!!binary ' . \base64_encode($value); + case Escaper::requiresDoubleQuoting($value): + return Escaper::escapeWithDoubleQuotes($value); + case Escaper::requiresSingleQuoting($value): + $singleQuoted = Escaper::escapeWithSingleQuotes($value); + if (\strpos($value, "'") === \false) { + return $singleQuoted; + } + // Attempt double-quoting the string instead to see if it's more efficient. + $doubleQuoted = Escaper::escapeWithDoubleQuotes($value); + return \strlen($doubleQuoted) < \strlen($singleQuoted) ? $doubleQuoted : $singleQuoted; + case Parser::preg_match('{^[0-9]+[_0-9]*$}', $value): + case Parser::preg_match(self::getHexRegex(), $value): + case Parser::preg_match(self::getTimestampRegex(), $value): + return Escaper::escapeWithSingleQuotes($value); + default: + return $value; + } + } + /** + * Check if given array is hash or just normal indexed array. + * @param mixed[]|\ArrayObject|\stdClass $value + */ + public static function isHash($value) : bool + { + if ($value instanceof \stdClass || $value instanceof \ArrayObject) { + return \true; + } + $expectedKey = 0; + foreach ($value as $key => $val) { + if ($key !== $expectedKey++) { + return \true; + } + } + return \false; + } + /** + * Dumps a PHP array to a YAML string. + * + * @param array $value The PHP array to dump + * @param int $flags A bit field of Yaml::DUMP_* constants to customize the dumped YAML string + */ + private static function dumpArray(array $value, int $flags) : string + { + // array + if (($value || Yaml::DUMP_EMPTY_ARRAY_AS_SEQUENCE & $flags) && !self::isHash($value)) { + $output = []; + foreach ($value as $val) { + $output[] = self::dump($val, $flags); + } + return \sprintf('[%s]', \implode(', ', $output)); + } + return self::dumpHashArray($value, $flags); + } + /** + * Dumps hash array to a YAML string. + * + * @param array|\ArrayObject|\stdClass $value The hash array to dump + * @param int $flags A bit field of Yaml::DUMP_* constants to customize the dumped YAML string + */ + private static function dumpHashArray($value, int $flags) : string + { + $output = []; + foreach ($value as $key => $val) { + if (\is_int($key) && Yaml::DUMP_NUMERIC_KEY_AS_STRING & $flags) { + $key = (string) $key; + } + $output[] = \sprintf('%s: %s', self::dump($key, $flags), self::dump($val, $flags)); + } + return \sprintf('{ %s }', \implode(', ', $output)); + } + private static function dumpNull(int $flags) : string + { + if (Yaml::DUMP_NULL_AS_TILDE & $flags) { + return '~'; + } + return 'null'; + } + /** + * Parses a YAML scalar. + * + * @throws ParseException When malformed inline YAML string is parsed + * @return mixed + */ + public static function parseScalar(string $scalar, int $flags = 0, ?array $delimiters = null, int &$i = 0, bool $evaluate = \true, array &$references = [], ?bool &$isQuoted = null) + { + if (\in_array($scalar[$i], ['"', "'"], \true)) { + // quoted scalar + $isQuoted = \true; + $output = self::parseQuotedScalar($scalar, $i); + if (null !== $delimiters) { + $tmp = \ltrim(\substr($scalar, $i), " \n"); + if ('' === $tmp) { + throw new ParseException(\sprintf('Unexpected end of line, expected one of "%s".', \implode('', $delimiters)), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); + } + if (!\in_array($tmp[0], $delimiters)) { + throw new ParseException(\sprintf('Unexpected characters (%s).', \substr($scalar, $i)), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); + } + } + } else { + // "normal" string + $isQuoted = \false; + if (!$delimiters) { + $output = \substr($scalar, $i); + $i += \strlen($output); + // remove comments + if (Parser::preg_match('/[ \\t]+#/', $output, $match, \PREG_OFFSET_CAPTURE)) { + $output = \substr($output, 0, $match[0][1]); + } + } elseif (Parser::preg_match('/^(.*?)(' . \implode('|', $delimiters) . ')/', \substr($scalar, $i), $match)) { + $output = $match[1]; + $i += \strlen($output); + $output = \trim($output); + } else { + throw new ParseException(\sprintf('Malformed inline YAML string: "%s".', $scalar), self::$parsedLineNumber + 1, null, self::$parsedFilename); + } + // a non-quoted string cannot start with @ or ` (reserved) nor with a scalar indicator (| or >) + if ($output && ('@' === $output[0] || '`' === $output[0] || '|' === $output[0] || '>' === $output[0] || '%' === $output[0])) { + throw new ParseException(\sprintf('The reserved indicator "%s" cannot start a plain scalar; you need to quote the scalar.', $output[0]), self::$parsedLineNumber + 1, $output, self::$parsedFilename); + } + if ($evaluate) { + $output = self::evaluateScalar($output, $flags, $references, $isQuoted); + } + } + return $output; + } + /** + * Parses a YAML quoted scalar. + * + * @throws ParseException When malformed inline YAML string is parsed + */ + private static function parseQuotedScalar(string $scalar, int &$i = 0) : string + { + if (!Parser::preg_match('/' . self::REGEX_QUOTED_STRING . '/Au', \substr($scalar, $i), $match)) { + throw new ParseException(\sprintf('Malformed inline YAML string: "%s".', \substr($scalar, $i)), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); + } + $output = \substr($match[0], 1, -1); + $unescaper = new Unescaper(); + if ('"' == $scalar[$i]) { + $output = $unescaper->unescapeDoubleQuotedString($output); + } else { + $output = $unescaper->unescapeSingleQuotedString($output); + } + $i += \strlen($match[0]); + return $output; + } + /** + * Parses a YAML sequence. + * + * @throws ParseException When malformed inline YAML string is parsed + */ + private static function parseSequence(string $sequence, int $flags, int &$i = 0, array &$references = []) : array + { + $output = []; + $len = \strlen($sequence); + ++$i; + // [foo, bar, ...] + while ($i < $len) { + if (']' === $sequence[$i]) { + return $output; + } + if (',' === $sequence[$i] || ' ' === $sequence[$i]) { + ++$i; + continue; + } + $tag = self::parseTag($sequence, $i, $flags); + switch ($sequence[$i]) { + case '[': + // nested sequence + $value = self::parseSequence($sequence, $flags, $i, $references); + break; + case '{': + // nested mapping + $value = self::parseMapping($sequence, $flags, $i, $references); + break; + default: + $value = self::parseScalar($sequence, $flags, [',', ']'], $i, null === $tag, $references, $isQuoted); + // the value can be an array if a reference has been resolved to an array var + if (\is_string($value) && !$isQuoted && \strpos($value, ': ') !== \false) { + // embedded mapping? + try { + $pos = 0; + $value = self::parseMapping('{' . $value . '}', $flags, $pos, $references); + } catch (\InvalidArgumentException $exception) { + // no, it's not + } + } + if (!$isQuoted && \is_string($value) && '' !== $value && '&' === $value[0] && Parser::preg_match(Parser::REFERENCE_PATTERN, $value, $matches)) { + $references[$matches['ref']] = $matches['value']; + $value = $matches['value']; + } + --$i; + } + if (null !== $tag && '' !== $tag) { + $value = new TaggedValue($tag, $value); + } + $output[] = $value; + ++$i; + } + throw new ParseException(\sprintf('Malformed inline YAML string: "%s".', $sequence), self::$parsedLineNumber + 1, null, self::$parsedFilename); + } + /** + * Parses a YAML mapping. + * + * @throws ParseException When malformed inline YAML string is parsed + * @return mixed[]|\stdClass + */ + private static function parseMapping(string $mapping, int $flags, int &$i = 0, array &$references = []) + { + $output = []; + $len = \strlen($mapping); + ++$i; + $allowOverwrite = \false; + // {foo: bar, bar:foo, ...} + while ($i < $len) { + switch ($mapping[$i]) { + case ' ': + case ',': + case "\n": + ++$i; + continue 2; + case '}': + if (self::$objectForMap) { + return (object) $output; + } + return $output; + } + // key + $offsetBeforeKeyParsing = $i; + $isKeyQuoted = \in_array($mapping[$i], ['"', "'"], \true); + $key = self::parseScalar($mapping, $flags, [':', ' '], $i, \false); + if ($offsetBeforeKeyParsing === $i) { + throw new ParseException('Missing mapping key.', self::$parsedLineNumber + 1, $mapping); + } + if ('!php/const' === $key || '!php/enum' === $key) { + $key .= ' ' . self::parseScalar($mapping, $flags, [':'], $i, \false); + $key = self::evaluateScalar($key, $flags); + } + if (\false === ($i = \strpos($mapping, ':', $i))) { + break; + } + if (!$isKeyQuoted) { + $evaluatedKey = self::evaluateScalar($key, $flags, $references); + if ('' !== $key && $evaluatedKey !== $key && !\is_string($evaluatedKey) && !\is_int($evaluatedKey)) { + throw new ParseException('Implicit casting of incompatible mapping keys to strings is not supported. Quote your evaluable mapping keys instead.', self::$parsedLineNumber + 1, $mapping); + } + } + if (!$isKeyQuoted && (!isset($mapping[$i + 1]) || !\in_array($mapping[$i + 1], [' ', ',', '[', ']', '{', '}', "\n"], \true))) { + throw new ParseException('Colons must be followed by a space or an indication character (i.e. " ", ",", "[", "]", "{", "}").', self::$parsedLineNumber + 1, $mapping); + } + if ('<<' === $key) { + $allowOverwrite = \true; + } + while ($i < $len) { + if (':' === $mapping[$i] || ' ' === $mapping[$i] || "\n" === $mapping[$i]) { + ++$i; + continue; + } + $tag = self::parseTag($mapping, $i, $flags); + switch ($mapping[$i]) { + case '[': + // nested sequence + $value = self::parseSequence($mapping, $flags, $i, $references); + // Spec: Keys MUST be unique; first one wins. + // Parser cannot abort this mapping earlier, since lines + // are processed sequentially. + // But overwriting is allowed when a merge node is used in current block. + if ('<<' === $key) { + foreach ($value as $parsedValue) { + $output += $parsedValue; + } + } elseif ($allowOverwrite || !isset($output[$key])) { + if (null !== $tag) { + $output[$key] = new TaggedValue($tag, $value); + } else { + $output[$key] = $value; + } + } elseif (isset($output[$key])) { + throw new ParseException(\sprintf('Duplicate key "%s" detected.', $key), self::$parsedLineNumber + 1, $mapping); + } + break; + case '{': + // nested mapping + $value = self::parseMapping($mapping, $flags, $i, $references); + // Spec: Keys MUST be unique; first one wins. + // Parser cannot abort this mapping earlier, since lines + // are processed sequentially. + // But overwriting is allowed when a merge node is used in current block. + if ('<<' === $key) { + $output += $value; + } elseif ($allowOverwrite || !isset($output[$key])) { + if (null !== $tag) { + $output[$key] = new TaggedValue($tag, $value); + } else { + $output[$key] = $value; + } + } elseif (isset($output[$key])) { + throw new ParseException(\sprintf('Duplicate key "%s" detected.', $key), self::$parsedLineNumber + 1, $mapping); + } + break; + default: + $value = self::parseScalar($mapping, $flags, [',', '}', "\n"], $i, null === $tag, $references, $isValueQuoted); + // Spec: Keys MUST be unique; first one wins. + // Parser cannot abort this mapping earlier, since lines + // are processed sequentially. + // But overwriting is allowed when a merge node is used in current block. + if ('<<' === $key) { + $output += $value; + } elseif ($allowOverwrite || !isset($output[$key])) { + if (!$isValueQuoted && \is_string($value) && '' !== $value && '&' === $value[0] && !self::isBinaryString($value) && Parser::preg_match(Parser::REFERENCE_PATTERN, $value, $matches)) { + $references[$matches['ref']] = $matches['value']; + $value = $matches['value']; + } + if (null !== $tag) { + $output[$key] = new TaggedValue($tag, $value); + } else { + $output[$key] = $value; + } + } elseif (isset($output[$key])) { + throw new ParseException(\sprintf('Duplicate key "%s" detected.', $key), self::$parsedLineNumber + 1, $mapping); + } + --$i; + } + ++$i; + continue 2; + } + } + throw new ParseException(\sprintf('Malformed inline YAML string: "%s".', $mapping), self::$parsedLineNumber + 1, null, self::$parsedFilename); + } + /** + * Evaluates scalars and replaces magic values. + * + * @throws ParseException when object parsing support was disabled and the parser detected a PHP object or when a reference could not be resolved + * @return mixed + */ + private static function evaluateScalar(string $scalar, int $flags, array &$references = [], ?bool &$isQuotedString = null) + { + $isQuotedString = \false; + $scalar = \trim($scalar); + if (\strncmp($scalar, '*', \strlen('*')) === 0) { + if (\false !== ($pos = \strpos($scalar, '#'))) { + $value = \substr($scalar, 1, $pos - 2); + } else { + $value = \substr($scalar, 1); + } + // an unquoted * + if (\false === $value || '' === $value) { + throw new ParseException('A reference must contain at least one character.', self::$parsedLineNumber + 1, $value, self::$parsedFilename); + } + if (!\array_key_exists($value, $references)) { + throw new ParseException(\sprintf('Reference "%s" does not exist.', $value), self::$parsedLineNumber + 1, $value, self::$parsedFilename); + } + return $references[$value]; + } + $scalarLower = \strtolower($scalar); + switch (\true) { + case 'null' === $scalarLower: + case '' === $scalar: + case '~' === $scalar: + return null; + case 'true' === $scalarLower: + return \true; + case 'false' === $scalarLower: + return \false; + case '!' === $scalar[0]: + switch (\true) { + case \strncmp($scalar, '!!str ', \strlen('!!str ')) === 0: + $s = (string) \substr($scalar, 6); + if (\in_array($s[0] ?? '', ['"', "'"], \true)) { + $isQuotedString = \true; + $s = self::parseQuotedScalar($s); + } + return $s; + case \strncmp($scalar, '! ', \strlen('! ')) === 0: + return \substr($scalar, 2); + case \strncmp($scalar, '!php/object', \strlen('!php/object')) === 0: + if (self::$objectSupport) { + if (!isset($scalar[12])) { + throw new ParseException('Missing value for tag "!php/object".', self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); + } + return \unserialize(self::parseScalar(\substr($scalar, 12))); + } + if (self::$exceptionOnInvalidType) { + throw new ParseException('Object support when parsing a YAML file has been disabled.', self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); + } + return null; + case \strncmp($scalar, '!php/const', \strlen('!php/const')) === 0: + if (self::$constantSupport) { + if (!isset($scalar[11])) { + throw new ParseException('Missing value for tag "!php/const".', self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); + } + $i = 0; + if (\defined($const = self::parseScalar(\substr($scalar, 11), 0, null, $i, \false))) { + return \constant($const); + } + throw new ParseException(\sprintf('The constant "%s" is not defined.', $const), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); + } + if (self::$exceptionOnInvalidType) { + throw new ParseException(\sprintf('The string "%s" could not be parsed as a constant. Did you forget to pass the "Yaml::PARSE_CONSTANT" flag to the parser?', $scalar), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); + } + return null; + case \strncmp($scalar, '!php/enum', \strlen('!php/enum')) === 0: + if (self::$constantSupport) { + if (!isset($scalar[11])) { + throw new ParseException('Missing value for tag "!php/enum".', self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); + } + $i = 0; + $enum = self::parseScalar(\substr($scalar, 10), 0, null, $i, \false); + if ($useValue = \substr_compare($enum, '->value', -\strlen('->value')) === 0) { + $enum = \substr($enum, 0, -7); + } + if (!\defined($enum)) { + throw new ParseException(\sprintf('The enum "%s" is not defined.', $enum), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); + } + $value = \constant($enum); + if (!$value instanceof \UnitEnum) { + throw new ParseException(\sprintf('The string "%s" is not the name of a valid enum.', $enum), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); + } + if (!$useValue) { + return $value; + } + if (!$value instanceof \BackedEnum) { + throw new ParseException(\sprintf('The enum "%s" defines no value next to its name.', $enum), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); + } + return $value->value; + } + if (self::$exceptionOnInvalidType) { + throw new ParseException(\sprintf('The string "%s" could not be parsed as an enum. Did you forget to pass the "Yaml::PARSE_CONSTANT" flag to the parser?', $scalar), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); + } + return null; + case \strncmp($scalar, '!!float ', \strlen('!!float ')) === 0: + return (float) \substr($scalar, 8); + case \strncmp($scalar, '!!binary ', \strlen('!!binary ')) === 0: + return self::evaluateBinaryScalar(\substr($scalar, 9)); + } + throw new ParseException(\sprintf('The string "%s" could not be parsed as it uses an unsupported built-in tag.', $scalar), self::$parsedLineNumber, $scalar, self::$parsedFilename); + case \preg_match('/^(?:\\+|-)?0o(?P[0-7_]++)$/', $scalar, $matches): + $value = \str_replace('_', '', $matches['value']); + if ('-' === $scalar[0]) { + return -\octdec($value); + } + return \octdec($value); + case \in_array($scalar[0], ['+', '-', '.'], \true) || \is_numeric($scalar[0]): + if (Parser::preg_match('{^[+-]?[0-9][0-9_]*$}', $scalar)) { + $scalar = \str_replace('_', '', $scalar); + } + switch (\true) { + case \ctype_digit($scalar): + case '-' === $scalar[0] && \ctype_digit(\substr($scalar, 1)): + $cast = (int) $scalar; + return $scalar === (string) $cast ? $cast : $scalar; + case \is_numeric($scalar): + case Parser::preg_match(self::getHexRegex(), $scalar): + $scalar = \str_replace('_', '', $scalar); + return '0x' === $scalar[0] . $scalar[1] ? \hexdec($scalar) : (float) $scalar; + case '.inf' === $scalarLower: + case '.nan' === $scalarLower: + return -\log(0); + case '-.inf' === $scalarLower: + return \log(0); + case Parser::preg_match('/^(-|\\+)?[0-9][0-9_]*(\\.[0-9_]+)?$/', $scalar): + return (float) \str_replace('_', '', $scalar); + case Parser::preg_match(self::getTimestampRegex(), $scalar): + // When no timezone is provided in the parsed date, YAML spec says we must assume UTC. + $time = new \DateTimeImmutable($scalar, new \DateTimeZone('UTC')); + if (Yaml::PARSE_DATETIME & $flags) { + return $time; + } + if ('' !== \rtrim($time->format('u'), '0')) { + return (float) $time->format('U.u'); + } + try { + if (\false !== ($scalar = $time->getTimestamp())) { + return $scalar; + } + } catch (\ValueError $exception) { + // no-op + } + return $time->format('U'); + } + } + return (string) $scalar; + } + private static function parseTag(string $value, int &$i, int $flags) : ?string + { + if ('!' !== $value[$i]) { + return null; + } + $tagLength = \strcspn($value, " \t\n[]{},", $i + 1); + $tag = \substr($value, $i + 1, $tagLength); + $nextOffset = $i + $tagLength + 1; + $nextOffset += \strspn($value, ' ', $nextOffset); + if ('' === $tag && (!isset($value[$nextOffset]) || \in_array($value[$nextOffset], [']', '}', ','], \true))) { + throw new ParseException('Using the unquoted scalar value "!" is not supported. You must quote it.', self::$parsedLineNumber + 1, $value, self::$parsedFilename); + } + // Is followed by a scalar and is a built-in tag + if ('' !== $tag && (!isset($value[$nextOffset]) || !\in_array($value[$nextOffset], ['[', '{'], \true)) && ('!' === $tag[0] || \in_array($tag, ['str', 'php/const', 'php/enum', 'php/object'], \true))) { + // Manage in {@link self::evaluateScalar()} + return null; + } + $i = $nextOffset; + // Built-in tags + if ('' !== $tag && '!' === $tag[0]) { + throw new ParseException(\sprintf('The built-in tag "!%s" is not implemented.', $tag), self::$parsedLineNumber + 1, $value, self::$parsedFilename); + } + if ('' !== $tag && !isset($value[$i])) { + throw new ParseException(\sprintf('Missing value for tag "%s".', $tag), self::$parsedLineNumber + 1, $value, self::$parsedFilename); + } + if ('' === $tag || Yaml::PARSE_CUSTOM_TAGS & $flags) { + return $tag; + } + throw new ParseException(\sprintf('Tags support is not enabled. Enable the "Yaml::PARSE_CUSTOM_TAGS" flag to use "!%s".', $tag), self::$parsedLineNumber + 1, $value, self::$parsedFilename); + } + public static function evaluateBinaryScalar(string $scalar) : string + { + $parsedBinaryData = self::parseScalar(\preg_replace('/\\s/', '', $scalar)); + if (0 !== \strlen($parsedBinaryData) % 4) { + throw new ParseException(\sprintf('The normalized base64 encoded data (data without whitespace characters) length must be a multiple of four (%d bytes given).', \strlen($parsedBinaryData)), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); + } + if (!Parser::preg_match('#^[A-Z0-9+/]+={0,2}$#i', $parsedBinaryData)) { + throw new ParseException(\sprintf('The base64 encoded data (%s) contains invalid characters.', $parsedBinaryData), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); + } + return \base64_decode($parsedBinaryData, \true); + } + private static function isBinaryString(string $value) : bool + { + return !\preg_match('//u', $value) || \preg_match('/[^\\x00\\x07-\\x0d\\x1B\\x20-\\xff]/', $value); + } + /** + * Gets a regex that matches a YAML date. + * + * @see http://www.yaml.org/spec/1.2/spec.html#id2761573 + */ + private static function getTimestampRegex() : string + { + return <<[0-9][0-9][0-9][0-9]) + -(?P[0-9][0-9]?) + -(?P[0-9][0-9]?) + (?:(?:[Tt]|[ \t]+) + (?P[0-9][0-9]?) + :(?P[0-9][0-9]) + :(?P[0-9][0-9]) + (?:\\.(?P[0-9]*))? + (?:[ \t]*(?PZ|(?P[-+])(?P[0-9][0-9]?) + (?::(?P[0-9][0-9]))?))?)? + \$~x +EOF; + } + /** + * Gets a regex that matches a YAML number in hexadecimal notation. + */ + private static function getHexRegex() : string + { + return '~^0x[0-9a-f_]++$~i'; + } +} diff --git a/vendor/symfony/yaml/LICENSE b/vendor/symfony/yaml/LICENSE new file mode 100644 index 00000000000..0138f8f0713 --- /dev/null +++ b/vendor/symfony/yaml/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2004-present 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 +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. diff --git a/vendor/symfony/yaml/Parser.php b/vendor/symfony/yaml/Parser.php new file mode 100644 index 00000000000..50fa43867a0 --- /dev/null +++ b/vendor/symfony/yaml/Parser.php @@ -0,0 +1,1062 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace RectorPrefix202402\Symfony\Component\Yaml; + +use RectorPrefix202402\Symfony\Component\Yaml\Exception\ParseException; +use RectorPrefix202402\Symfony\Component\Yaml\Tag\TaggedValue; +/** + * Parser parses YAML strings to convert them to PHP arrays. + * + * @author Fabien Potencier + * + * @final + */ +class Parser +{ + public const TAG_PATTERN = '(?P![\\w!.\\/:-]+)'; + public const BLOCK_SCALAR_HEADER_PATTERN = '(?P\\||>)(?P\\+|\\-|\\d+|\\+\\d+|\\-\\d+|\\d+\\+|\\d+\\-)?(?P +#.*)?'; + public const REFERENCE_PATTERN = '#^&(?P[^ ]++) *+(?P.*)#u'; + /** + * @var string|null + */ + private $filename; + /** + * @var int + */ + private $offset = 0; + /** + * @var int + */ + private $numberOfParsedLines = 0; + /** + * @var int|null + */ + private $totalNumberOfLines; + /** + * @var mixed[] + */ + private $lines = []; + /** + * @var int + */ + private $currentLineNb = -1; + /** + * @var string + */ + private $currentLine = ''; + /** + * @var mixed[] + */ + private $refs = []; + /** + * @var mixed[] + */ + private $skippedLineNumbers = []; + /** + * @var mixed[] + */ + private $locallySkippedLineNumbers = []; + /** + * @var mixed[] + */ + private $refsBeingParsed = []; + /** + * Parses a YAML file into a PHP value. + * + * @param string $filename The path to the YAML file to be parsed + * @param int $flags A bit field of Yaml::PARSE_* constants to customize the YAML parser behavior + * + * @throws ParseException If the file could not be read or the YAML is not valid + * @return mixed + */ + public function parseFile(string $filename, int $flags = 0) + { + if (!\is_file($filename)) { + throw new ParseException(\sprintf('File "%s" does not exist.', $filename)); + } + if (!\is_readable($filename)) { + throw new ParseException(\sprintf('File "%s" cannot be read.', $filename)); + } + $this->filename = $filename; + try { + return $this->parse(\file_get_contents($filename), $flags); + } finally { + $this->filename = null; + } + } + /** + * Parses a YAML string to a PHP value. + * + * @param string $value A YAML string + * @param int $flags A bit field of Yaml::PARSE_* constants to customize the YAML parser behavior + * + * @throws ParseException If the YAML is not valid + * @return mixed + */ + public function parse(string $value, int $flags = 0) + { + if (\false === \preg_match('//u', $value)) { + throw new ParseException('The YAML value does not appear to be valid UTF-8.', -1, null, $this->filename); + } + $this->refs = []; + try { + $data = $this->doParse($value, $flags); + } finally { + $this->refsBeingParsed = []; + $this->offset = 0; + $this->lines = []; + $this->currentLine = ''; + $this->numberOfParsedLines = 0; + $this->refs = []; + $this->skippedLineNumbers = []; + $this->locallySkippedLineNumbers = []; + $this->totalNumberOfLines = null; + } + return $data; + } + /** + * @return mixed + */ + private function doParse(string $value, int $flags) + { + $this->currentLineNb = -1; + $this->currentLine = ''; + $value = $this->cleanup($value); + $this->lines = \explode("\n", $value); + $this->numberOfParsedLines = \count($this->lines); + $this->locallySkippedLineNumbers = []; + $this->totalNumberOfLines = $this->totalNumberOfLines ?? $this->numberOfParsedLines; + if (!$this->moveToNextLine()) { + return null; + } + $data = []; + $context = null; + $allowOverwrite = \false; + while ($this->isCurrentLineEmpty()) { + if (!$this->moveToNextLine()) { + return null; + } + } + // Resolves the tag and returns if end of the document + if (null !== ($tag = $this->getLineTag($this->currentLine, $flags, \false)) && !$this->moveToNextLine()) { + return new TaggedValue($tag, ''); + } + do { + if ($this->isCurrentLineEmpty()) { + continue; + } + // tab? + if ("\t" === $this->currentLine[0]) { + throw new ParseException('A YAML file cannot contain tabs as indentation.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); + } + Inline::initialize($flags, $this->getRealCurrentLineNb(), $this->filename); + $isRef = $mergeNode = \false; + if ('-' === $this->currentLine[0] && self::preg_match('#^\\-((?P\\s+)(?P.+))?$#u', \rtrim($this->currentLine), $values)) { + if ($context && 'mapping' == $context) { + throw new ParseException('You cannot define a sequence item when in a mapping.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); + } + $context = 'sequence'; + if (isset($values['value']) && '&' === $values['value'][0] && self::preg_match(self::REFERENCE_PATTERN, $values['value'], $matches)) { + $isRef = $matches['ref']; + $this->refsBeingParsed[] = $isRef; + $values['value'] = $matches['value']; + } + if (isset($values['value'][1]) && '?' === $values['value'][0] && ' ' === $values['value'][1]) { + throw new ParseException('Complex mappings are not supported.', $this->getRealCurrentLineNb() + 1, $this->currentLine); + } + // array + if (isset($values['value']) && \strncmp(\ltrim($values['value'], ' '), '-', \strlen('-')) === 0) { + // Inline first child + $currentLineNumber = $this->getRealCurrentLineNb(); + $sequenceIndentation = \strlen($values['leadspaces']) + 1; + $sequenceYaml = \substr($this->currentLine, $sequenceIndentation); + $sequenceYaml .= "\n" . $this->getNextEmbedBlock($sequenceIndentation, \true); + $data[] = $this->parseBlock($currentLineNumber, \rtrim($sequenceYaml), $flags); + } elseif (!isset($values['value']) || '' == \trim($values['value'], ' ') || \strncmp(\ltrim($values['value'], ' '), '#', \strlen('#')) === 0) { + $data[] = $this->parseBlock($this->getRealCurrentLineNb() + 1, $this->getNextEmbedBlock(null, \true) ?? '', $flags); + } elseif (null !== ($subTag = $this->getLineTag(\ltrim($values['value'], ' '), $flags))) { + $data[] = new TaggedValue($subTag, $this->parseBlock($this->getRealCurrentLineNb() + 1, $this->getNextEmbedBlock(null, \true), $flags)); + } else { + if (isset($values['leadspaces']) && ('!' === $values['value'][0] || self::preg_match('#^(?P' . Inline::REGEX_QUOTED_STRING . '|[^ \'"\\{\\[].*?) *\\:(\\s+(?P.+?))?\\s*$#u', $this->trimTag($values['value']), $matches))) { + $block = $values['value']; + if ($this->isNextLineIndented() || isset($matches['value']) && '>-' === $matches['value']) { + $block .= "\n" . $this->getNextEmbedBlock($this->getCurrentLineIndentation() + \strlen($values['leadspaces']) + 1); + } + $data[] = $this->parseBlock($this->getRealCurrentLineNb(), $block, $flags); + } else { + $data[] = $this->parseValue($values['value'], $flags, $context); + } + } + if ($isRef) { + $this->refs[$isRef] = \end($data); + \array_pop($this->refsBeingParsed); + } + } elseif (self::preg_match('#^(?P(?:![^\\s]++\\s++)?(?:' . Inline::REGEX_QUOTED_STRING . '|(?:!?!php/const:)?[^ \'"\\[\\{!].*?)) *\\:(( |\\t)++(?P.+))?$#u', \rtrim($this->currentLine), $values) && (\strpos($values['key'], ' #') === \false || \in_array($values['key'][0], ['"', "'"]))) { + if (\strncmp($values['key'], '!php/const:', \strlen('!php/const:')) === 0) { + trigger_deprecation('symfony/yaml', '6.2', 'YAML syntax for key "%s" is deprecated and replaced by "!php/const %s".', $values['key'], \substr($values['key'], 11)); + } + if ($context && 'sequence' == $context) { + throw new ParseException('You cannot define a mapping item when in a sequence.', $this->currentLineNb + 1, $this->currentLine, $this->filename); + } + $context = 'mapping'; + try { + $key = Inline::parseScalar($values['key']); + } catch (ParseException $e) { + $e->setParsedLine($this->getRealCurrentLineNb() + 1); + $e->setSnippet($this->currentLine); + throw $e; + } + if (!\is_string($key) && !\is_int($key)) { + throw new ParseException((\is_numeric($key) ? 'Numeric' : 'Non-string') . ' keys are not supported. Quote your evaluable mapping keys instead.', $this->getRealCurrentLineNb() + 1, $this->currentLine); + } + // Convert float keys to strings, to avoid being converted to integers by PHP + if (\is_float($key)) { + $key = (string) $key; + } + if ('<<' === $key && (!isset($values['value']) || '&' !== $values['value'][0] || !self::preg_match('#^&(?P[^ ]+)#u', $values['value'], $refMatches))) { + $mergeNode = \true; + $allowOverwrite = \true; + if (isset($values['value'][0]) && '*' === $values['value'][0]) { + $refName = \substr(\rtrim($values['value']), 1); + if (!\array_key_exists($refName, $this->refs)) { + if (\false !== ($pos = \array_search($refName, $this->refsBeingParsed, \true))) { + throw new ParseException(\sprintf('Circular reference [%s] detected for reference "%s".', \implode(', ', \array_merge(\array_slice($this->refsBeingParsed, $pos), [$refName])), $refName), $this->currentLineNb + 1, $this->currentLine, $this->filename); + } + throw new ParseException(\sprintf('Reference "%s" does not exist.', $refName), $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); + } + $refValue = $this->refs[$refName]; + if (Yaml::PARSE_OBJECT_FOR_MAP & $flags && $refValue instanceof \stdClass) { + $refValue = (array) $refValue; + } + if (!\is_array($refValue)) { + throw new ParseException('YAML merge keys used with a scalar value instead of an array.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); + } + $data += $refValue; + // array union + } else { + if (isset($values['value']) && '' !== $values['value']) { + $value = $values['value']; + } else { + $value = $this->getNextEmbedBlock(); + } + $parsed = $this->parseBlock($this->getRealCurrentLineNb() + 1, $value, $flags); + if (Yaml::PARSE_OBJECT_FOR_MAP & $flags && $parsed instanceof \stdClass) { + $parsed = (array) $parsed; + } + if (!\is_array($parsed)) { + throw new ParseException('YAML merge keys used with a scalar value instead of an array.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); + } + if (isset($parsed[0])) { + // If the value associated with the merge key is a sequence, then this sequence is expected to contain mapping nodes + // and each of these nodes is merged in turn according to its order in the sequence. Keys in mapping nodes earlier + // in the sequence override keys specified in later mapping nodes. + foreach ($parsed as $parsedItem) { + if (Yaml::PARSE_OBJECT_FOR_MAP & $flags && $parsedItem instanceof \stdClass) { + $parsedItem = (array) $parsedItem; + } + if (!\is_array($parsedItem)) { + throw new ParseException('Merge items must be arrays.', $this->getRealCurrentLineNb() + 1, $parsedItem, $this->filename); + } + $data += $parsedItem; + // array union + } + } else { + // If the value associated with the key is a single mapping node, each of its key/value pairs is inserted into the + // current mapping, unless the key already exists in it. + $data += $parsed; + // array union + } + } + } elseif ('<<' !== $key && isset($values['value']) && '&' === $values['value'][0] && self::preg_match(self::REFERENCE_PATTERN, $values['value'], $matches)) { + $isRef = $matches['ref']; + $this->refsBeingParsed[] = $isRef; + $values['value'] = $matches['value']; + } + $subTag = null; + if ($mergeNode) { + // Merge keys + } elseif (!isset($values['value']) || '' === $values['value'] || \strncmp($values['value'], '#', \strlen('#')) === 0 || null !== ($subTag = $this->getLineTag($values['value'], $flags)) || '<<' === $key) { + // hash + // if next line is less indented or equal, then it means that the current value is null + if (!$this->isNextLineIndented() && !$this->isNextLineUnIndentedCollection()) { + // Spec: Keys MUST be unique; first one wins. + // But overwriting is allowed when a merge node is used in current block. + if ($allowOverwrite || !isset($data[$key])) { + if (null !== $subTag) { + $data[$key] = new TaggedValue($subTag, ''); + } else { + $data[$key] = null; + } + } else { + throw new ParseException(\sprintf('Duplicate key "%s" detected.', $key), $this->getRealCurrentLineNb() + 1, $this->currentLine); + } + } else { + // remember the parsed line number here in case we need it to provide some contexts in error messages below + $realCurrentLineNbKey = $this->getRealCurrentLineNb(); + $value = $this->parseBlock($this->getRealCurrentLineNb() + 1, $this->getNextEmbedBlock(), $flags); + if ('<<' === $key) { + $this->refs[$refMatches['ref']] = $value; + if (Yaml::PARSE_OBJECT_FOR_MAP & $flags && $value instanceof \stdClass) { + $value = (array) $value; + } + $data += $value; + } elseif ($allowOverwrite || !isset($data[$key])) { + // Spec: Keys MUST be unique; first one wins. + // But overwriting is allowed when a merge node is used in current block. + if (null !== $subTag) { + $data[$key] = new TaggedValue($subTag, $value); + } else { + $data[$key] = $value; + } + } else { + throw new ParseException(\sprintf('Duplicate key "%s" detected.', $key), $realCurrentLineNbKey + 1, $this->currentLine); + } + } + } else { + $value = $this->parseValue(\rtrim($values['value']), $flags, $context); + // Spec: Keys MUST be unique; first one wins. + // But overwriting is allowed when a merge node is used in current block. + if ($allowOverwrite || !isset($data[$key])) { + $data[$key] = $value; + } else { + throw new ParseException(\sprintf('Duplicate key "%s" detected.', $key), $this->getRealCurrentLineNb() + 1, $this->currentLine); + } + } + if ($isRef) { + $this->refs[$isRef] = $data[$key]; + \array_pop($this->refsBeingParsed); + } + } elseif ('"' === $this->currentLine[0] || "'" === $this->currentLine[0]) { + if (null !== $context) { + throw new ParseException('Unable to parse.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); + } + try { + return Inline::parse($this->lexInlineQuotedString(), $flags, $this->refs); + } catch (ParseException $e) { + $e->setParsedLine($this->getRealCurrentLineNb() + 1); + $e->setSnippet($this->currentLine); + throw $e; + } + } elseif ('{' === $this->currentLine[0]) { + if (null !== $context) { + throw new ParseException('Unable to parse.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); + } + try { + $parsedMapping = Inline::parse($this->lexInlineMapping(), $flags, $this->refs); + while ($this->moveToNextLine()) { + if (!$this->isCurrentLineEmpty()) { + throw new ParseException('Unable to parse.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); + } + } + return $parsedMapping; + } catch (ParseException $e) { + $e->setParsedLine($this->getRealCurrentLineNb() + 1); + $e->setSnippet($this->currentLine); + throw $e; + } + } elseif ('[' === $this->currentLine[0]) { + if (null !== $context) { + throw new ParseException('Unable to parse.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); + } + try { + $parsedSequence = Inline::parse($this->lexInlineSequence(), $flags, $this->refs); + while ($this->moveToNextLine()) { + if (!$this->isCurrentLineEmpty()) { + throw new ParseException('Unable to parse.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); + } + } + return $parsedSequence; + } catch (ParseException $e) { + $e->setParsedLine($this->getRealCurrentLineNb() + 1); + $e->setSnippet($this->currentLine); + throw $e; + } + } else { + // multiple documents are not supported + if ('---' === $this->currentLine) { + throw new ParseException('Multiple documents are not supported.', $this->currentLineNb + 1, $this->currentLine, $this->filename); + } + if ($deprecatedUsage = isset($this->currentLine[1]) && '?' === $this->currentLine[0] && ' ' === $this->currentLine[1]) { + throw new ParseException('Complex mappings are not supported.', $this->getRealCurrentLineNb() + 1, $this->currentLine); + } + // 1-liner optionally followed by newline(s) + if (\is_string($value) && $this->lines[0] === \trim($value)) { + try { + $value = Inline::parse($this->lines[0], $flags, $this->refs); + } catch (ParseException $e) { + $e->setParsedLine($this->getRealCurrentLineNb() + 1); + $e->setSnippet($this->currentLine); + throw $e; + } + return $value; + } + // try to parse the value as a multi-line string as a last resort + if (0 === $this->currentLineNb) { + $previousLineWasNewline = \false; + $previousLineWasTerminatedWithBackslash = \false; + $value = ''; + foreach ($this->lines as $line) { + $trimmedLine = \trim($line); + if ('#' === ($trimmedLine[0] ?? '')) { + continue; + } + // If the indentation is not consistent at offset 0, it is to be considered as a ParseError + if (0 === $this->offset && !$deprecatedUsage && isset($line[0]) && ' ' === $line[0]) { + throw new ParseException('Unable to parse.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); + } + if (\strpos($line, ': ') !== \false) { + throw new ParseException('Mapping values are not allowed in multi-line blocks.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); + } + if ('' === $trimmedLine) { + $value .= "\n"; + } elseif (!$previousLineWasNewline && !$previousLineWasTerminatedWithBackslash) { + $value .= ' '; + } + if ('' !== $trimmedLine && \substr_compare($line, '\\', -\strlen('\\')) === 0) { + $value .= \ltrim(\substr($line, 0, -1)); + } elseif ('' !== $trimmedLine) { + $value .= $trimmedLine; + } + if ('' === $trimmedLine) { + $previousLineWasNewline = \true; + $previousLineWasTerminatedWithBackslash = \false; + } elseif (\substr_compare($line, '\\', -\strlen('\\')) === 0) { + $previousLineWasNewline = \false; + $previousLineWasTerminatedWithBackslash = \true; + } else { + $previousLineWasNewline = \false; + $previousLineWasTerminatedWithBackslash = \false; + } + } + try { + return Inline::parse(\trim($value)); + } catch (ParseException $exception) { + // fall-through to the ParseException thrown below + } + } + throw new ParseException('Unable to parse.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); + } + } while ($this->moveToNextLine()); + if (null !== $tag) { + $data = new TaggedValue($tag, $data); + } + if (Yaml::PARSE_OBJECT_FOR_MAP & $flags && 'mapping' === $context && !\is_object($data)) { + $object = new \stdClass(); + foreach ($data as $key => $value) { + $object->{$key} = $value; + } + $data = $object; + } + return empty($data) ? null : $data; + } + /** + * @return mixed + */ + private function parseBlock(int $offset, string $yaml, int $flags) + { + $skippedLineNumbers = $this->skippedLineNumbers; + foreach ($this->locallySkippedLineNumbers as $lineNumber) { + if ($lineNumber < $offset) { + continue; + } + $skippedLineNumbers[] = $lineNumber; + } + $parser = new self(); + $parser->offset = $offset; + $parser->totalNumberOfLines = $this->totalNumberOfLines; + $parser->skippedLineNumbers = $skippedLineNumbers; + $parser->refs =& $this->refs; + $parser->refsBeingParsed = $this->refsBeingParsed; + return $parser->doParse($yaml, $flags); + } + /** + * Returns the current line number (takes the offset into account). + * + * @internal + */ + public function getRealCurrentLineNb() : int + { + $realCurrentLineNumber = $this->currentLineNb + $this->offset; + foreach ($this->skippedLineNumbers as $skippedLineNumber) { + if ($skippedLineNumber > $realCurrentLineNumber) { + break; + } + ++$realCurrentLineNumber; + } + return $realCurrentLineNumber; + } + private function getCurrentLineIndentation() : int + { + if (' ' !== ($this->currentLine[0] ?? '')) { + return 0; + } + return \strlen($this->currentLine) - \strlen(\ltrim($this->currentLine, ' ')); + } + /** + * Returns the next embed block of YAML. + * + * @param int|null $indentation The indent level at which the block is to be read, or null for default + * @param bool $inSequence True if the enclosing data structure is a sequence + * + * @throws ParseException When indentation problem are detected + */ + private function getNextEmbedBlock(?int $indentation = null, bool $inSequence = \false) : string + { + $oldLineIndentation = $this->getCurrentLineIndentation(); + if (!$this->moveToNextLine()) { + return ''; + } + if (null === $indentation) { + $newIndent = null; + $movements = 0; + do { + $EOF = \false; + // empty and comment-like lines do not influence the indentation depth + if ($this->isCurrentLineEmpty() || $this->isCurrentLineComment()) { + $EOF = !$this->moveToNextLine(); + if (!$EOF) { + ++$movements; + } + } else { + $newIndent = $this->getCurrentLineIndentation(); + } + } while (!$EOF && null === $newIndent); + for ($i = 0; $i < $movements; ++$i) { + $this->moveToPreviousLine(); + } + $unindentedEmbedBlock = $this->isStringUnIndentedCollectionItem(); + if (!$this->isCurrentLineEmpty() && 0 === $newIndent && !$unindentedEmbedBlock) { + throw new ParseException('Indentation problem.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); + } + } else { + $newIndent = $indentation; + } + $data = []; + if ($this->getCurrentLineIndentation() >= $newIndent) { + $data[] = \substr($this->currentLine, $newIndent ?? 0); + } elseif ($this->isCurrentLineEmpty() || $this->isCurrentLineComment()) { + $data[] = $this->currentLine; + } else { + $this->moveToPreviousLine(); + return ''; + } + if ($inSequence && $oldLineIndentation === $newIndent && isset($data[0][0]) && '-' === $data[0][0]) { + // the previous line contained a dash but no item content, this line is a sequence item with the same indentation + // and therefore no nested list or mapping + $this->moveToPreviousLine(); + return ''; + } + $isItUnindentedCollection = $this->isStringUnIndentedCollectionItem(); + $isItComment = $this->isCurrentLineComment(); + while ($this->moveToNextLine()) { + if ($isItComment && !$isItUnindentedCollection) { + $isItUnindentedCollection = $this->isStringUnIndentedCollectionItem(); + $isItComment = $this->isCurrentLineComment(); + } + $indent = $this->getCurrentLineIndentation(); + if ($isItUnindentedCollection && !$this->isCurrentLineEmpty() && !$this->isStringUnIndentedCollectionItem() && $newIndent === $indent) { + $this->moveToPreviousLine(); + break; + } + if ($this->isCurrentLineBlank()) { + $data[] = \substr($this->currentLine, $newIndent); + continue; + } + if ($indent >= $newIndent) { + $data[] = \substr($this->currentLine, $newIndent); + } elseif ($this->isCurrentLineComment()) { + $data[] = $this->currentLine; + } elseif (0 == $indent) { + $this->moveToPreviousLine(); + break; + } else { + throw new ParseException('Indentation problem.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); + } + } + return \implode("\n", $data); + } + private function hasMoreLines() : bool + { + return \count($this->lines) - 1 > $this->currentLineNb; + } + /** + * Moves the parser to the next line. + */ + private function moveToNextLine() : bool + { + if ($this->currentLineNb >= $this->numberOfParsedLines - 1) { + return \false; + } + $this->currentLine = $this->lines[++$this->currentLineNb]; + return \true; + } + /** + * Moves the parser to the previous line. + */ + private function moveToPreviousLine() : bool + { + if ($this->currentLineNb < 1) { + return \false; + } + $this->currentLine = $this->lines[--$this->currentLineNb]; + return \true; + } + /** + * Parses a YAML value. + * + * @param string $value A YAML value + * @param int $flags A bit field of Yaml::PARSE_* constants to customize the YAML parser behavior + * @param string $context The parser context (either sequence or mapping) + * + * @throws ParseException When reference does not exist + * @return mixed + */ + private function parseValue(string $value, int $flags, string $context) + { + if (\strncmp($value, '*', \strlen('*')) === 0) { + if (\false !== ($pos = \strpos($value, '#'))) { + $value = \substr($value, 1, $pos - 2); + } else { + $value = \substr($value, 1); + } + if (!\array_key_exists($value, $this->refs)) { + if (\false !== ($pos = \array_search($value, $this->refsBeingParsed, \true))) { + throw new ParseException(\sprintf('Circular reference [%s] detected for reference "%s".', \implode(', ', \array_merge(\array_slice($this->refsBeingParsed, $pos), [$value])), $value), $this->currentLineNb + 1, $this->currentLine, $this->filename); + } + throw new ParseException(\sprintf('Reference "%s" does not exist.', $value), $this->currentLineNb + 1, $this->currentLine, $this->filename); + } + return $this->refs[$value]; + } + if (\in_array($value[0], ['!', '|', '>'], \true) && self::preg_match('/^(?:' . self::TAG_PATTERN . ' +)?' . self::BLOCK_SCALAR_HEADER_PATTERN . '$/', $value, $matches)) { + $modifiers = $matches['modifiers'] ?? ''; + $data = $this->parseBlockScalar($matches['separator'], \preg_replace('#\\d+#', '', $modifiers), \abs((int) $modifiers)); + if ('' !== $matches['tag'] && '!' !== $matches['tag']) { + if ('!!binary' === $matches['tag']) { + return Inline::evaluateBinaryScalar($data); + } + return new TaggedValue(\substr($matches['tag'], 1), $data); + } + return $data; + } + try { + if ('' !== $value && '{' === $value[0]) { + $cursor = \strlen(\rtrim($this->currentLine)) - \strlen(\rtrim($value)); + return Inline::parse($this->lexInlineMapping($cursor), $flags, $this->refs); + } elseif ('' !== $value && '[' === $value[0]) { + $cursor = \strlen(\rtrim($this->currentLine)) - \strlen(\rtrim($value)); + return Inline::parse($this->lexInlineSequence($cursor), $flags, $this->refs); + } + switch ($value[0] ?? '') { + case '"': + case "'": + $cursor = \strlen(\rtrim($this->currentLine)) - \strlen(\rtrim($value)); + $parsedValue = Inline::parse($this->lexInlineQuotedString($cursor), $flags, $this->refs); + if (isset($this->currentLine[$cursor]) && \preg_replace('/\\s*(#.*)?$/A', '', \substr($this->currentLine, $cursor))) { + throw new ParseException(\sprintf('Unexpected characters near "%s".', \substr($this->currentLine, $cursor))); + } + return $parsedValue; + default: + $lines = []; + while ($this->moveToNextLine()) { + // unquoted strings end before the first unindented line + if (0 === $this->getCurrentLineIndentation()) { + $this->moveToPreviousLine(); + break; + } + $lines[] = \trim($this->currentLine); + } + for ($i = 0, $linesCount = \count($lines), $previousLineBlank = \false; $i < $linesCount; ++$i) { + if ('' === $lines[$i]) { + $value .= "\n"; + $previousLineBlank = \true; + } elseif ($previousLineBlank) { + $value .= $lines[$i]; + $previousLineBlank = \false; + } else { + $value .= ' ' . $lines[$i]; + $previousLineBlank = \false; + } + } + Inline::$parsedLineNumber = $this->getRealCurrentLineNb(); + $parsedValue = Inline::parse($value, $flags, $this->refs); + if ('mapping' === $context && \is_string($parsedValue) && '"' !== $value[0] && "'" !== $value[0] && '[' !== $value[0] && '{' !== $value[0] && '!' !== $value[0] && \strpos($parsedValue, ': ') !== \false) { + throw new ParseException('A colon cannot be used in an unquoted mapping value.', $this->getRealCurrentLineNb() + 1, $value, $this->filename); + } + return $parsedValue; + } + } catch (ParseException $e) { + $e->setParsedLine($this->getRealCurrentLineNb() + 1); + $e->setSnippet($this->currentLine); + throw $e; + } + } + /** + * Parses a block scalar. + * + * @param string $style The style indicator that was used to begin this block scalar (| or >) + * @param string $chomping The chomping indicator that was used to begin this block scalar (+ or -) + * @param int $indentation The indentation indicator that was used to begin this block scalar + */ + private function parseBlockScalar(string $style, string $chomping = '', int $indentation = 0) : string + { + $notEOF = $this->moveToNextLine(); + if (!$notEOF) { + return ''; + } + $isCurrentLineBlank = $this->isCurrentLineBlank(); + $blockLines = []; + // leading blank lines are consumed before determining indentation + while ($notEOF && $isCurrentLineBlank) { + // newline only if not EOF + if ($notEOF = $this->moveToNextLine()) { + $blockLines[] = ''; + $isCurrentLineBlank = $this->isCurrentLineBlank(); + } + } + // determine indentation if not specified + if (0 === $indentation) { + $currentLineLength = \strlen($this->currentLine); + for ($i = 0; $i < $currentLineLength && ' ' === $this->currentLine[$i]; ++$i) { + ++$indentation; + } + } + if ($indentation > 0) { + $pattern = \sprintf('/^ {%d}(.*)$/', $indentation); + while ($notEOF && ($isCurrentLineBlank || self::preg_match($pattern, $this->currentLine, $matches))) { + if ($isCurrentLineBlank && \strlen($this->currentLine) > $indentation) { + $blockLines[] = \substr($this->currentLine, $indentation); + } elseif ($isCurrentLineBlank) { + $blockLines[] = ''; + } else { + $blockLines[] = $matches[1]; + } + // newline only if not EOF + if ($notEOF = $this->moveToNextLine()) { + $isCurrentLineBlank = $this->isCurrentLineBlank(); + } + } + } elseif ($notEOF) { + $blockLines[] = ''; + } + if ($notEOF) { + $blockLines[] = ''; + $this->moveToPreviousLine(); + } elseif (!$notEOF && !$this->isCurrentLineLastLineInDocument()) { + $blockLines[] = ''; + } + // folded style + if ('>' === $style) { + $text = ''; + $previousLineIndented = \false; + $previousLineBlank = \false; + for ($i = 0, $blockLinesCount = \count($blockLines); $i < $blockLinesCount; ++$i) { + if ('' === $blockLines[$i]) { + $text .= "\n"; + $previousLineIndented = \false; + $previousLineBlank = \true; + } elseif (' ' === $blockLines[$i][0]) { + $text .= "\n" . $blockLines[$i]; + $previousLineIndented = \true; + $previousLineBlank = \false; + } elseif ($previousLineIndented) { + $text .= "\n" . $blockLines[$i]; + $previousLineIndented = \false; + $previousLineBlank = \false; + } elseif ($previousLineBlank || 0 === $i) { + $text .= $blockLines[$i]; + $previousLineIndented = \false; + $previousLineBlank = \false; + } else { + $text .= ' ' . $blockLines[$i]; + $previousLineIndented = \false; + $previousLineBlank = \false; + } + } + } else { + $text = \implode("\n", $blockLines); + } + // deal with trailing newlines + if ('' === $chomping) { + $text = \preg_replace('/\\n+$/', "\n", $text); + } elseif ('-' === $chomping) { + $text = \preg_replace('/\\n+$/', '', $text); + } + return $text; + } + /** + * Returns true if the next line is indented. + */ + private function isNextLineIndented() : bool + { + $currentIndentation = $this->getCurrentLineIndentation(); + $movements = 0; + do { + $EOF = !$this->moveToNextLine(); + if (!$EOF) { + ++$movements; + } + } while (!$EOF && ($this->isCurrentLineEmpty() || $this->isCurrentLineComment())); + if ($EOF) { + for ($i = 0; $i < $movements; ++$i) { + $this->moveToPreviousLine(); + } + return \false; + } + $ret = $this->getCurrentLineIndentation() > $currentIndentation; + for ($i = 0; $i < $movements; ++$i) { + $this->moveToPreviousLine(); + } + return $ret; + } + private function isCurrentLineEmpty() : bool + { + return $this->isCurrentLineBlank() || $this->isCurrentLineComment(); + } + private function isCurrentLineBlank() : bool + { + return '' === $this->currentLine || '' === \trim($this->currentLine, ' '); + } + private function isCurrentLineComment() : bool + { + // checking explicitly the first char of the trim is faster than loops or strpos + $ltrimmedLine = '' !== $this->currentLine && ' ' === $this->currentLine[0] ? \ltrim($this->currentLine, ' ') : $this->currentLine; + return '' !== $ltrimmedLine && '#' === $ltrimmedLine[0]; + } + private function isCurrentLineLastLineInDocument() : bool + { + return $this->offset + $this->currentLineNb >= $this->totalNumberOfLines - 1; + } + private function cleanup(string $value) : string + { + $value = \str_replace(["\r\n", "\r"], "\n", $value); + // strip YAML header + $count = 0; + $value = \preg_replace('#^\\%YAML[: ][\\d\\.]+.*\\n#u', '', $value, -1, $count); + $this->offset += $count; + // remove leading comments + $trimmedValue = \preg_replace('#^(\\#.*?\\n)+#s', '', $value, -1, $count); + if (1 === $count) { + // items have been removed, update the offset + $this->offset += \substr_count($value, "\n") - \substr_count($trimmedValue, "\n"); + $value = $trimmedValue; + } + // remove start of the document marker (---) + $trimmedValue = \preg_replace('#^\\-\\-\\-.*?\\n#s', '', $value, -1, $count); + if (1 === $count) { + // items have been removed, update the offset + $this->offset += \substr_count($value, "\n") - \substr_count($trimmedValue, "\n"); + $value = $trimmedValue; + // remove end of the document marker (...) + $value = \preg_replace('#\\.\\.\\.\\s*$#', '', $value); + } + return $value; + } + private function isNextLineUnIndentedCollection() : bool + { + $currentIndentation = $this->getCurrentLineIndentation(); + $movements = 0; + do { + $EOF = !$this->moveToNextLine(); + if (!$EOF) { + ++$movements; + } + } while (!$EOF && ($this->isCurrentLineEmpty() || $this->isCurrentLineComment())); + if ($EOF) { + return \false; + } + $ret = $this->getCurrentLineIndentation() === $currentIndentation && $this->isStringUnIndentedCollectionItem(); + for ($i = 0; $i < $movements; ++$i) { + $this->moveToPreviousLine(); + } + return $ret; + } + private function isStringUnIndentedCollectionItem() : bool + { + return '-' === \rtrim($this->currentLine) || \strncmp($this->currentLine, '- ', \strlen('- ')) === 0; + } + /** + * A local wrapper for "preg_match" which will throw a ParseException if there + * is an internal error in the PCRE engine. + * + * This avoids us needing to check for "false" every time PCRE is used + * in the YAML engine + * + * @throws ParseException on a PCRE internal error + * + * @internal + */ + public static function preg_match(string $pattern, string $subject, ?array &$matches = null, int $flags = 0, int $offset = 0) : int + { + if (\false === ($ret = \preg_match($pattern, $subject, $matches, $flags, $offset))) { + throw new ParseException(\preg_last_error_msg()); + } + return $ret; + } + /** + * Trim the tag on top of the value. + * + * Prevent values such as "!foo {quz: bar}" to be considered as + * a mapping block. + */ + private function trimTag(string $value) : string + { + if ('!' === $value[0]) { + return \ltrim(\substr($value, 1, \strcspn($value, " \r\n", 1)), ' '); + } + return $value; + } + private function getLineTag(string $value, int $flags, bool $nextLineCheck = \true) : ?string + { + if ('' === $value || '!' !== $value[0] || 1 !== self::preg_match('/^' . self::TAG_PATTERN . ' *( +#.*)?$/', $value, $matches)) { + return null; + } + if ($nextLineCheck && !$this->isNextLineIndented()) { + return null; + } + $tag = \substr($matches['tag'], 1); + // Built-in tags + if ($tag && '!' === $tag[0]) { + throw new ParseException(\sprintf('The built-in tag "!%s" is not implemented.', $tag), $this->getRealCurrentLineNb() + 1, $value, $this->filename); + } + if (Yaml::PARSE_CUSTOM_TAGS & $flags) { + return $tag; + } + throw new ParseException(\sprintf('Tags support is not enabled. You must use the flag "Yaml::PARSE_CUSTOM_TAGS" to use "%s".', $matches['tag']), $this->getRealCurrentLineNb() + 1, $value, $this->filename); + } + private function lexInlineQuotedString(int &$cursor = 0) : string + { + $quotation = $this->currentLine[$cursor]; + $value = $quotation; + ++$cursor; + $previousLineWasNewline = \true; + $previousLineWasTerminatedWithBackslash = \false; + $lineNumber = 0; + do { + if (++$lineNumber > 1) { + $cursor += \strspn($this->currentLine, ' ', $cursor); + } + if ($this->isCurrentLineBlank()) { + $value .= "\n"; + } elseif (!$previousLineWasNewline && !$previousLineWasTerminatedWithBackslash) { + $value .= ' '; + } + for (; \strlen($this->currentLine) > $cursor; ++$cursor) { + switch ($this->currentLine[$cursor]) { + case '\\': + if ("'" === $quotation) { + $value .= '\\'; + } elseif (isset($this->currentLine[++$cursor])) { + $value .= '\\' . $this->currentLine[$cursor]; + } + break; + case $quotation: + ++$cursor; + if ("'" === $quotation && isset($this->currentLine[$cursor]) && "'" === $this->currentLine[$cursor]) { + $value .= "''"; + break; + } + return $value . $quotation; + default: + $value .= $this->currentLine[$cursor]; + } + } + if ($this->isCurrentLineBlank()) { + $previousLineWasNewline = \true; + $previousLineWasTerminatedWithBackslash = \false; + } elseif ('\\' === $this->currentLine[-1]) { + $previousLineWasNewline = \false; + $previousLineWasTerminatedWithBackslash = \true; + } else { + $previousLineWasNewline = \false; + $previousLineWasTerminatedWithBackslash = \false; + } + if ($this->hasMoreLines()) { + $cursor = 0; + } + } while ($this->moveToNextLine()); + throw new ParseException('Malformed inline YAML string.'); + } + private function lexUnquotedString(int &$cursor) : string + { + $offset = $cursor; + $cursor += \strcspn($this->currentLine, '[]{},: ', $cursor); + if ($cursor === $offset) { + throw new ParseException('Malformed unquoted YAML string.'); + } + return \substr($this->currentLine, $offset, $cursor - $offset); + } + private function lexInlineMapping(int &$cursor = 0) : string + { + return $this->lexInlineStructure($cursor, '}'); + } + private function lexInlineSequence(int &$cursor = 0) : string + { + return $this->lexInlineStructure($cursor, ']'); + } + private function lexInlineStructure(int &$cursor, string $closingTag) : string + { + $value = $this->currentLine[$cursor]; + ++$cursor; + do { + $this->consumeWhitespaces($cursor); + while (isset($this->currentLine[$cursor])) { + switch ($this->currentLine[$cursor]) { + case '"': + case "'": + $value .= $this->lexInlineQuotedString($cursor); + break; + case ':': + case ',': + $value .= $this->currentLine[$cursor]; + ++$cursor; + break; + case '{': + $value .= $this->lexInlineMapping($cursor); + break; + case '[': + $value .= $this->lexInlineSequence($cursor); + break; + case $closingTag: + $value .= $this->currentLine[$cursor]; + ++$cursor; + return $value; + case '#': + break 2; + default: + $value .= $this->lexUnquotedString($cursor); + } + if ($this->consumeWhitespaces($cursor)) { + $value .= ' '; + } + } + if ($this->hasMoreLines()) { + $cursor = 0; + } + } while ($this->moveToNextLine()); + throw new ParseException('Malformed inline YAML string.'); + } + private function consumeWhitespaces(int &$cursor) : bool + { + $whitespacesConsumed = 0; + do { + $whitespaceOnlyTokenLength = \strspn($this->currentLine, ' ', $cursor); + $whitespacesConsumed += $whitespaceOnlyTokenLength; + $cursor += $whitespaceOnlyTokenLength; + if (isset($this->currentLine[$cursor])) { + return 0 < $whitespacesConsumed; + } + if ($this->hasMoreLines()) { + $cursor = 0; + } + } while ($this->moveToNextLine()); + return 0 < $whitespacesConsumed; + } +} diff --git a/vendor/symfony/yaml/README.md b/vendor/symfony/yaml/README.md new file mode 100644 index 00000000000..ac25024b634 --- /dev/null +++ b/vendor/symfony/yaml/README.md @@ -0,0 +1,13 @@ +Yaml Component +============== + +The Yaml component loads and dumps YAML files. + +Resources +--------- + + * [Documentation](https://symfony.com/doc/current/components/yaml.html) + * [Contributing](https://symfony.com/doc/current/contributing/index.html) + * [Report issues](https://github.com/symfony/symfony/issues) and + [send Pull Requests](https://github.com/symfony/symfony/pulls) + in the [main Symfony repository](https://github.com/symfony/symfony) diff --git a/vendor/symfony/yaml/Resources/bin/yaml-lint b/vendor/symfony/yaml/Resources/bin/yaml-lint new file mode 100755 index 00000000000..52f1d399791 --- /dev/null +++ b/vendor/symfony/yaml/Resources/bin/yaml-lint @@ -0,0 +1,35 @@ +#!/usr/bin/env php + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +if ('cli' !== \PHP_SAPI) { + throw new \Exception('This script must be run from the command line.'); +} +/** + * Runs the Yaml lint command. + * + * @author Jan Schädlich + */ +use RectorPrefix202402\Symfony\Component\Console\Application; +use RectorPrefix202402\Symfony\Component\Yaml\Command\LintCommand; +function includeIfExists(string $file) : bool +{ + return \file_exists($file) && (include $file); +} +if (!includeIfExists(__DIR__ . '/../../../../autoload.php') && !includeIfExists(__DIR__ . '/../../vendor/autoload.php') && !includeIfExists(__DIR__ . '/../../../../../../vendor/autoload.php')) { + \fwrite(\STDERR, 'Install dependencies using Composer.' . \PHP_EOL); + exit(1); +} +if (!\class_exists(Application::class)) { + \fwrite(\STDERR, 'You need the "symfony/console" component in order to run the Yaml linter.' . \PHP_EOL); + exit(1); +} +(new Application())->add($command = new LintCommand())->getApplication()->setDefaultCommand($command->getName(), \true)->run(); diff --git a/vendor/symfony/yaml/Tag/TaggedValue.php b/vendor/symfony/yaml/Tag/TaggedValue.php new file mode 100644 index 00000000000..d8578eda804 --- /dev/null +++ b/vendor/symfony/yaml/Tag/TaggedValue.php @@ -0,0 +1,46 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace RectorPrefix202402\Symfony\Component\Yaml\Tag; + +/** + * @author Nicolas Grekas + * @author Guilhem N. + */ +final class TaggedValue +{ + /** + * @var string + */ + private $tag; + /** + * @var mixed + */ + private $value; + /** + * @param mixed $value + */ + public function __construct(string $tag, $value) + { + $this->tag = $tag; + $this->value = $value; + } + public function getTag() : string + { + return $this->tag; + } + /** + * @return mixed + */ + public function getValue() + { + return $this->value; + } +} diff --git a/vendor/symfony/yaml/Unescaper.php b/vendor/symfony/yaml/Unescaper.php new file mode 100644 index 00000000000..0ada1137bef --- /dev/null +++ b/vendor/symfony/yaml/Unescaper.php @@ -0,0 +1,120 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace RectorPrefix202402\Symfony\Component\Yaml; + +use RectorPrefix202402\Symfony\Component\Yaml\Exception\ParseException; +/** + * Unescaper encapsulates unescaping rules for single and double-quoted + * YAML strings. + * + * @author Matthew Lewinski + * + * @internal + */ +class Unescaper +{ + /** + * Regex fragment that matches an escaped character in a double quoted string. + */ + public const REGEX_ESCAPED_CHARACTER = '\\\\(x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8}|.)'; + /** + * Unescapes a single quoted string. + * + * @param string $value A single quoted string + */ + public function unescapeSingleQuotedString(string $value) : string + { + return \str_replace('\'\'', '\'', $value); + } + /** + * Unescapes a double quoted string. + * + * @param string $value A double quoted string + */ + public function unescapeDoubleQuotedString(string $value) : string + { + $callback = function ($match) { + return $this->unescapeCharacter($match[0]); + }; + // evaluate the string + return \preg_replace_callback('/' . self::REGEX_ESCAPED_CHARACTER . '/u', $callback, $value); + } + /** + * Unescapes a character that was found in a double-quoted string. + * + * @param string $value An escaped character + */ + private function unescapeCharacter(string $value) : string + { + switch ($value[1]) { + case '0': + return "\x00"; + case 'a': + return "\x07"; + case 'b': + return "\x08"; + case 't': + return "\t"; + case "\t": + return "\t"; + case 'n': + return "\n"; + case 'v': + return "\v"; + case 'f': + return "\f"; + case 'r': + return "\r"; + case 'e': + return "\x1b"; + case ' ': + return ' '; + case '"': + return '"'; + case '/': + return '/'; + case '\\': + return '\\'; + case 'N': + return "…"; + case '_': + return " "; + case 'L': + return "
"; + case 'P': + return "
"; + case 'x': + return self::utf8chr(\hexdec(\substr($value, 2, 2))); + case 'u': + return self::utf8chr(\hexdec(\substr($value, 2, 4))); + case 'U': + return self::utf8chr(\hexdec(\substr($value, 2, 8))); + default: + throw new ParseException(\sprintf('Found unknown escape character "%s".', $value)); + } + } + /** + * Get the UTF-8 character for the given code point. + */ + private static function utf8chr(int $c) : string + { + if (0x80 > ($c %= 0x200000)) { + return \chr($c); + } + if (0x800 > $c) { + return \chr(0xc0 | $c >> 6) . \chr(0x80 | $c & 0x3f); + } + if (0x10000 > $c) { + return \chr(0xe0 | $c >> 12) . \chr(0x80 | $c >> 6 & 0x3f) . \chr(0x80 | $c & 0x3f); + } + return \chr(0xf0 | $c >> 18) . \chr(0x80 | $c >> 12 & 0x3f) . \chr(0x80 | $c >> 6 & 0x3f) . \chr(0x80 | $c & 0x3f); + } +} diff --git a/vendor/symfony/yaml/Yaml.php b/vendor/symfony/yaml/Yaml.php new file mode 100644 index 00000000000..855571a48dc --- /dev/null +++ b/vendor/symfony/yaml/Yaml.php @@ -0,0 +1,91 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace RectorPrefix202402\Symfony\Component\Yaml; + +use RectorPrefix202402\Symfony\Component\Yaml\Exception\ParseException; +/** + * Yaml offers convenience methods to load and dump YAML. + * + * @author Fabien Potencier + * + * @final + */ +class Yaml +{ + public const DUMP_OBJECT = 1; + public const PARSE_EXCEPTION_ON_INVALID_TYPE = 2; + public const PARSE_OBJECT = 4; + public const PARSE_OBJECT_FOR_MAP = 8; + public const DUMP_EXCEPTION_ON_INVALID_TYPE = 16; + public const PARSE_DATETIME = 32; + public const DUMP_OBJECT_AS_MAP = 64; + public const DUMP_MULTI_LINE_LITERAL_BLOCK = 128; + public const PARSE_CONSTANT = 256; + public const PARSE_CUSTOM_TAGS = 512; + public const DUMP_EMPTY_ARRAY_AS_SEQUENCE = 1024; + public const DUMP_NULL_AS_TILDE = 2048; + public const DUMP_NUMERIC_KEY_AS_STRING = 4096; + /** + * Parses a YAML file into a PHP value. + * + * Usage: + * + * $array = Yaml::parseFile('config.yml'); + * print_r($array); + * + * @param string $filename The path to the YAML file to be parsed + * @param int $flags A bit field of PARSE_* constants to customize the YAML parser behavior + * + * @throws ParseException If the file could not be read or the YAML is not valid + * @return mixed + */ + public static function parseFile(string $filename, int $flags = 0) + { + $yaml = new Parser(); + return $yaml->parseFile($filename, $flags); + } + /** + * Parses YAML into a PHP value. + * + * Usage: + * + * $array = Yaml::parse(file_get_contents('config.yml')); + * print_r($array); + * + * + * @param string $input A string containing YAML + * @param int $flags A bit field of PARSE_* constants to customize the YAML parser behavior + * + * @throws ParseException If the YAML is not valid + * @return mixed + */ + public static function parse(string $input, int $flags = 0) + { + $yaml = new Parser(); + return $yaml->parse($input, $flags); + } + /** + * Dumps a PHP value to a YAML string. + * + * The dump method, when supplied with an array, will do its best + * to convert the array into friendly YAML. + * + * @param mixed $input The PHP value + * @param int $inline The level where you switch to inline YAML + * @param int $indent The amount of spaces to use for indentation of nested nodes + * @param int $flags A bit field of DUMP_* constants to customize the dumped YAML string + */ + public static function dump($input, int $inline = 2, int $indent = 4, int $flags = 0) : string + { + $yaml = new Dumper($indent); + return $yaml->dump($input, $inline, 0, $flags); + } +} diff --git a/vendor/symfony/yaml/composer.json b/vendor/symfony/yaml/composer.json new file mode 100644 index 00000000000..996304788dc --- /dev/null +++ b/vendor/symfony/yaml/composer.json @@ -0,0 +1,41 @@ +{ + "name": "symfony\/yaml", + "type": "library", + "description": "Loads and dumps YAML files", + "keywords": [], + "homepage": "https:\/\/symfony.com", + "license": "MIT", + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https:\/\/symfony.com\/contributors" + } + ], + "require": { + "php": ">=8.1", + "symfony\/deprecation-contracts": "^2.5|^3", + "symfony\/polyfill-ctype": "^1.8" + }, + "require-dev": { + "symfony\/console": "^5.4|^6.0|^7.0" + }, + "conflict": { + "symfony\/console": "<5.4" + }, + "autoload": { + "psr-4": { + "RectorPrefix202402\\Symfony\\Component\\Yaml\\": "" + }, + "exclude-from-classmap": [ + "\/Tests\/" + ] + }, + "bin": [ + "Resources\/bin\/yaml-lint" + ], + "minimum-stability": "dev" +} \ No newline at end of file