From ef23d5d5e0309c34d2a1d664f6eed9d7a6ed6fbc Mon Sep 17 00:00:00 2001 From: Dominik Grothaus <104563186+dgrothaus-mc@users.noreply.github.com> Date: Tue, 13 Jun 2023 11:47:49 +0200 Subject: [PATCH 1/3] Assign key instead of unused comparison (#5693) --- .../src/addons/structure/plugins/content/lib/api_template.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/redaxo/src/addons/structure/plugins/content/lib/api_template.php b/redaxo/src/addons/structure/plugins/content/lib/api_template.php index adc10d2432..16e2c82032 100644 --- a/redaxo/src/addons/structure/plugins/content/lib/api_template.php +++ b/redaxo/src/addons/structure/plugins/content/lib/api_template.php @@ -33,7 +33,7 @@ public static function forKey(string $templateKey): ?self if (false !== $id = array_search($templateKey, $mapping, true)) { $template = new self($id); - $template->key == $templateKey; + $template->key = $templateKey; return $template; } From 796993347a3025d03ef7823ee0218c7bf778aa35 Mon Sep 17 00:00:00 2001 From: Gregor Harlan Date: Sat, 1 Jul 2023 12:10:52 +0200 Subject: [PATCH 2/3] Vendor-Updates (#5730) --- .github/workflows/unit-tests.yml | 1 - .github/workflows/visual-tests.yml | 2 +- .tools/phpstan/baseline.neon | 46 ++- .tools/psalm/baseline-taint.xml | 2 +- .tools/psalm/baseline.xml | 85 +----- composer.json | 23 +- redaxo/src/core/composer.json | 8 +- redaxo/src/core/composer.lock | 204 ++++++++----- .../src/core/vendor/composer/ClassLoader.php | 96 +++---- .../vendor/composer/autoload_classmap.php | 4 + .../core/vendor/composer/autoload_files.php | 1 + .../core/vendor/composer/autoload_psr4.php | 1 + .../core/vendor/composer/autoload_static.php | 10 + .../src/core/vendor/composer/installed.json | 219 +++++++++----- redaxo/src/core/vendor/composer/installed.php | 55 ++-- .../vendor/symfony/console/Application.php | 107 ++++--- .../symfony/console/Command/Command.php | 18 +- .../console/Command/CompleteCommand.php | 12 +- .../console/Command/DumpCompletionCommand.php | 8 +- .../symfony/console/Command/HelpCommand.php | 14 +- .../symfony/console/Command/ListCommand.php | 11 +- .../symfony/console/Command/LockableTrait.php | 4 +- .../Command/SignalableCommandInterface.php | 6 +- .../console/Completion/CompletionInput.php | 2 +- .../AddConsoleCommandPass.php | 3 + .../Descriptor/ApplicationDescription.php | 2 +- .../symfony/console/Descriptor/Descriptor.php | 22 +- .../Descriptor/DescriptorInterface.php | 3 + .../console/Descriptor/JsonDescriptor.php | 12 +- .../console/Descriptor/MarkdownDescriptor.php | 38 +-- .../Descriptor/ReStructuredTextDescriptor.php | 272 ++++++++++++++++++ .../console/Descriptor/TextDescriptor.php | 20 +- .../console/Descriptor/XmlDescriptor.php | 14 +- .../console/Event/ConsoleSignalEvent.php | 23 +- .../console/EventListener/ErrorListener.php | 6 + .../console/Formatter/OutputFormatter.php | 9 + .../Formatter/OutputFormatterInterface.php | 4 + .../Formatter/OutputFormatterStyle.php | 15 + .../OutputFormatterStyleInterface.php | 10 + .../Formatter/OutputFormatterStyleStack.php | 4 + .../console/Helper/DescriptorHelper.php | 4 + .../vendor/symfony/console/Helper/Dumper.php | 14 +- .../vendor/symfony/console/Helper/Helper.php | 14 +- .../console/Helper/HelperInterface.php | 2 + .../symfony/console/Helper/HelperSet.php | 3 + .../console/Helper/InputAwareHelper.php | 3 + .../symfony/console/Helper/ProgressBar.php | 79 ++--- .../console/Helper/ProgressIndicator.php | 30 +- .../symfony/console/Helper/QuestionHelper.php | 33 ++- .../console/Helper/SymfonyQuestionHelper.php | 6 + .../vendor/symfony/console/Helper/Table.php | 16 +- .../symfony/console/Helper/TableCellStyle.php | 4 +- .../symfony/console/Input/ArgvInput.php | 18 +- .../symfony/console/Input/ArrayInput.php | 9 +- .../vendor/symfony/console/Input/Input.php | 29 +- .../symfony/console/Input/InputArgument.php | 4 +- .../console/Input/InputAwareInterface.php | 2 + .../symfony/console/Input/InputDefinition.php | 14 + .../symfony/console/Input/InputInterface.php | 10 + .../symfony/console/Input/InputOption.php | 3 + .../Input/StreamableInputInterface.php | 2 + .../symfony/console/Output/AnsiColorMode.php | 22 +- .../symfony/console/Output/BufferedOutput.php | 3 + .../symfony/console/Output/ConsoleOutput.php | 12 + .../console/Output/ConsoleOutputInterface.php | 3 + .../console/Output/ConsoleSectionOutput.php | 9 +- .../symfony/console/Output/NullOutput.php | 15 + .../vendor/symfony/console/Output/Output.php | 17 ++ .../console/Output/OutputInterface.php | 11 + .../symfony/console/Output/StreamOutput.php | 3 + .../console/Output/TrimmedBufferOutput.php | 3 + .../symfony/console/Question/Question.php | 12 +- .../symfony/console/Resources/completion.bash | 10 + .../symfony/console/Style/OutputStyle.php | 21 ++ .../symfony/console/Style/StyleInterface.php | 28 ++ .../symfony/console/Style/SymfonyStyle.php | 64 ++++- .../core/vendor/symfony/console/Terminal.php | 12 +- .../symfony/console/Tester/TesterTrait.php | 2 +- .../core/vendor/symfony/console/composer.json | 10 +- .../deprecation-contracts/composer.json | 2 +- .../symfony/http-foundation/AcceptHeader.php | 9 +- .../http-foundation/BinaryFileResponse.php | 4 +- .../ExpressionRequestMatcher.php | 5 +- .../symfony/http-foundation/FileBag.php | 11 +- .../symfony/http-foundation/HeaderBag.php | 17 +- .../symfony/http-foundation/InputBag.php | 52 +++- .../symfony/http-foundation/IpUtils.php | 79 +++-- .../symfony/http-foundation/ParameterBag.php | 84 +++++- .../symfony/http-foundation/Request.php | 72 ++++- .../http-foundation/RequestMatcher.php | 20 +- .../RequestMatcher/IpsRequestMatcher.php | 4 +- .../RequestMatcher/IsJsonRequestMatcher.php | 8 +- .../RequestMatcher/MethodRequestMatcher.php | 4 +- .../RequestMatcher/SchemeRequestMatcher.php | 4 +- .../symfony/http-foundation/RequestStack.php | 2 + .../symfony/http-foundation/Response.php | 54 +++- .../http-foundation/ResponseHeaderBag.php | 21 ++ .../Session/Attribute/AttributeBag.php | 12 + .../Attribute/AttributeBagInterface.php | 5 + .../Session/Flash/AutoExpireFlashBag.php | 15 + .../Session/Flash/FlashBag.php | 15 + .../Session/Flash/FlashBagInterface.php | 6 + .../http-foundation/Session/Session.php | 21 ++ .../Session/SessionBagInterface.php | 2 + .../Session/SessionInterface.php | 14 + .../http-foundation/Session/SessionUtils.php | 2 +- .../Handler/AbstractSessionHandler.php | 14 +- .../Handler/MarshallingSessionHandler.php | 10 +- .../Handler/MemcachedSessionHandler.php | 8 +- .../Handler/MigratingSessionHandler.php | 21 +- .../Storage/Handler/MongoDbSessionHandler.php | 8 +- .../Storage/Handler/NullSessionHandler.php | 10 +- .../Storage/Handler/PdoSessionHandler.php | 85 +++++- .../Storage/Handler/RedisSessionHandler.php | 11 +- .../Storage/Handler/SessionHandlerFactory.php | 19 +- .../Storage/Handler/StrictSessionHandler.php | 10 +- .../Session/Storage/MetadataBag.php | 7 + .../Storage/MockArraySessionStorage.php | 24 ++ .../Storage/MockFileSessionStorage.php | 3 + .../Session/Storage/NativeSessionStorage.php | 24 ++ .../Storage/PhpBridgeSessionStorage.php | 3 + .../Session/Storage/Proxy/AbstractProxy.php | 4 + .../Storage/Proxy/SessionHandlerProxy.php | 10 +- .../Storage/SessionStorageInterface.php | 10 + .../http-foundation/StreamedJsonResponse.php | 143 +++++++++ .../http-foundation/StreamedResponse.php | 11 +- .../symfony/http-foundation/UrlHelper.php | 39 +-- .../symfony/http-foundation/composer.json | 11 +- .../vendor/symfony/polyfill-php83/LICENSE | 19 ++ .../vendor/symfony/polyfill-php83/Php83.php | 41 +++ .../symfony/polyfill-php83/bootstrap.php | 20 ++ .../symfony/polyfill-php83/composer.json | 36 +++ .../symfony/service-contracts/composer.json | 5 +- .../symfony/string/AbstractUnicodeString.php | 12 +- .../core/vendor/symfony/string/LazyString.php | 4 +- .../symfony/string/Slugger/AsciiSlugger.php | 7 +- .../core/vendor/symfony/string/composer.json | 4 +- .../symfony/var-dumper/Caster/AmqpCaster.php | 15 + .../symfony/var-dumper/Caster/Caster.php | 2 + .../symfony/var-dumper/Caster/ClassStub.php | 7 +- .../symfony/var-dumper/Caster/DOMCaster.php | 45 +++ .../symfony/var-dumper/Caster/DateCaster.php | 14 +- .../var-dumper/Caster/DoctrineCaster.php | 9 + .../var-dumper/Caster/ExceptionCaster.php | 41 ++- .../symfony/var-dumper/Caster/FiberCaster.php | 3 + .../symfony/var-dumper/Caster/IntlCaster.php | 15 + .../symfony/var-dumper/Caster/LinkStub.php | 2 +- .../var-dumper/Caster/MemcachedCaster.php | 3 + .../symfony/var-dumper/Caster/PdoCaster.php | 6 + .../symfony/var-dumper/Caster/PgSqlCaster.php | 9 + .../var-dumper/Caster/ProxyManagerCaster.php | 3 + .../var-dumper/Caster/RdKafkaCaster.php | 36 +++ .../symfony/var-dumper/Caster/RedisCaster.php | 32 ++- .../var-dumper/Caster/ReflectionCaster.php | 51 +++- .../var-dumper/Caster/ResourceCaster.php | 17 +- .../symfony/var-dumper/Caster/ScalarStub.php | 27 ++ .../symfony/var-dumper/Caster/SplCaster.php | 52 +++- .../symfony/var-dumper/Caster/StubCaster.php | 23 ++ .../var-dumper/Caster/SymfonyCaster.php | 18 ++ .../var-dumper/Caster/XmlReaderCaster.php | 3 + .../var-dumper/Caster/XmlResourceCaster.php | 3 + .../var-dumper/Cloner/AbstractCloner.php | 12 + .../vendor/symfony/var-dumper/Cloner/Data.php | 29 +- .../var-dumper/Cloner/DumperInterface.php | 8 + .../vendor/symfony/var-dumper/Cloner/Stub.php | 1 + .../symfony/var-dumper/Cloner/VarCloner.php | 2 - .../var-dumper/Command/ServerDumpCommand.php | 2 +- .../var-dumper/Dumper/AbstractDumper.php | 4 + .../symfony/var-dumper/Dumper/CliDumper.php | 57 +++- .../Dumper/ContextualizedDumper.php | 7 +- .../var-dumper/Dumper/DataDumperInterface.php | 3 + .../symfony/var-dumper/Dumper/HtmlDumper.php | 77 +++-- .../var-dumper/Dumper/ServerDumper.php | 7 +- .../var-dumper/Resources/functions/dump.php | 38 ++- .../symfony/var-dumper/Server/Connection.php | 14 +- .../vendor/symfony/var-dumper/VarDumper.php | 20 +- .../vendor/symfony/var-dumper/composer.json | 6 - .../symfony/yaml/Command/LintCommand.php | 34 +-- .../src/core/vendor/symfony/yaml/Dumper.php | 4 + .../symfony/yaml/Exception/ParseException.php | 8 +- .../src/core/vendor/symfony/yaml/Inline.php | 16 +- .../src/core/vendor/symfony/yaml/Parser.php | 8 +- .../vendor/symfony/yaml/Tag/TaggedValue.php | 2 +- .../core/vendor/symfony/yaml/Unescaper.php | 4 +- redaxo/src/core/vendor/symfony/yaml/Yaml.php | 1 + .../core/vendor/symfony/yaml/composer.json | 3 - 186 files changed, 3012 insertions(+), 920 deletions(-) create mode 100644 redaxo/src/core/vendor/symfony/console/Descriptor/ReStructuredTextDescriptor.php create mode 100644 redaxo/src/core/vendor/symfony/http-foundation/StreamedJsonResponse.php create mode 100644 redaxo/src/core/vendor/symfony/polyfill-php83/LICENSE create mode 100644 redaxo/src/core/vendor/symfony/polyfill-php83/Php83.php create mode 100644 redaxo/src/core/vendor/symfony/polyfill-php83/bootstrap.php create mode 100644 redaxo/src/core/vendor/symfony/polyfill-php83/composer.json create mode 100644 redaxo/src/core/vendor/symfony/var-dumper/Caster/ScalarStub.php diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 94662b79bf..bfcf970029 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -43,7 +43,6 @@ jobs: MYSQL_ROOT_PASSWORD: root ports: - 3306:3306 - options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 steps: - name: Checkout diff --git a/.github/workflows/visual-tests.yml b/.github/workflows/visual-tests.yml index 33a9ba465b..e67f18b7e9 100644 --- a/.github/workflows/visual-tests.yml +++ b/.github/workflows/visual-tests.yml @@ -23,7 +23,7 @@ jobs: steps: - name: Add action run link to trigger comment - uses: peter-evans/create-or-update-comment@v2 + uses: peter-evans/create-or-update-comment@v3 if: github.event_name == 'repository_dispatch' with: token: ${{ secrets.BOT_TOKEN }} diff --git a/.tools/phpstan/baseline.neon b/.tools/phpstan/baseline.neon index 121f518aba..0d327960d0 100644 --- a/.tools/phpstan/baseline.neon +++ b/.tools/phpstan/baseline.neon @@ -1,15 +1,5 @@ parameters: ignoreErrors: - - - message: "#^Result of && is always false\\.$#" - count: 1 - path: ../../redaxo/src/addons/backup/lib/backup.php - - - - message: "#^Unreachable statement \\- code above always terminates\\.$#" - count: 1 - path: ../../redaxo/src/addons/backup/lib/backup.php - - message: "#^Method rex_cronjob_export\\:\\:getParamFields\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 @@ -506,12 +496,12 @@ parameters: path: ../../redaxo/src/addons/mediapool/lib/media.php - - message: "#^Parameter \\#2 \\$createCallback of static method rex_media\\:\\:getInstance\\(\\) expects \\(callable\\(\\.\\.\\.mixed\\)\\: static\\(rex_media\\)\\|null\\)\\|null, Closure\\(mixed\\)\\: static\\(rex_media\\)\\|null given\\.$#" + message: "#^Parameter \\#2 \\$createCallback of static method rex_media\\:\\:getInstance\\(\\) expects \\(callable\\(mixed \\.\\.\\.\\)\\: \\(static\\|null\\)\\)\\|null, Closure\\(mixed\\)\\: \\(static\\|null\\) given\\.$#" count: 1 path: ../../redaxo/src/addons/mediapool/lib/media.php - - message: "#^Parameter \\#2 \\$getInstanceCallback of static method rex_media\\:\\:getInstanceList\\(\\) expects callable\\(\\.\\.\\.mixed\\)\\: static\\(rex_media\\)\\|null, callable\\(string\\)\\: static\\(rex_media\\) given\\.$#" + message: "#^Parameter \\#2 \\$getInstanceCallback of static method rex_media\\:\\:getInstanceList\\(\\) expects callable\\(mixed \\.\\.\\.\\)\\: \\(static\\|null\\), callable\\(string\\)\\: static given\\.$#" count: 1 path: ../../redaxo/src/addons/mediapool/lib/media.php @@ -531,22 +521,22 @@ parameters: path: ../../redaxo/src/addons/mediapool/lib/media_category.php - - message: "#^Parameter \\#2 \\$createCallback of static method rex_media_category\\:\\:getInstance\\(\\) expects \\(callable\\(\\.\\.\\.mixed\\)\\: static\\(rex_media_category\\)\\|null\\)\\|null, Closure\\(mixed\\)\\: static\\(rex_media_category\\)\\|null given\\.$#" + message: "#^Parameter \\#2 \\$createCallback of static method rex_media_category\\:\\:getInstance\\(\\) expects \\(callable\\(mixed \\.\\.\\.\\)\\: \\(static\\|null\\)\\)\\|null, Closure\\(mixed\\)\\: \\(static\\|null\\) given\\.$#" count: 1 path: ../../redaxo/src/addons/mediapool/lib/media_category.php - - message: "#^Parameter \\#2 \\$getInstanceCallback of static method rex_media_category\\:\\:getInstanceList\\(\\) expects callable\\(\\.\\.\\.mixed\\)\\: rex_media\\|null, Closure\\(string\\)\\: rex_media\\|null given\\.$#" + message: "#^Parameter \\#2 \\$getInstanceCallback of static method rex_media_category\\:\\:getInstanceList\\(\\) expects callable\\(mixed \\.\\.\\.\\)\\: \\(rex_media\\|null\\), Closure\\(string\\)\\: \\(rex_media\\|null\\) given\\.$#" count: 1 path: ../../redaxo/src/addons/mediapool/lib/media_category.php - - message: "#^Parameter \\#2 \\$getInstanceCallback of static method rex_media_category\\:\\:getInstanceList\\(\\) expects callable\\(\\.\\.\\.mixed\\)\\: static\\(rex_media_category\\)\\|null, Closure\\(int\\)\\: static\\(rex_media_category\\)\\|null given\\.$#" + message: "#^Parameter \\#2 \\$getInstanceCallback of static method rex_media_category\\:\\:getInstanceList\\(\\) expects callable\\(mixed \\.\\.\\.\\)\\: \\(static\\|null\\), Closure\\(int\\)\\: \\(static\\|null\\) given\\.$#" count: 1 path: ../../redaxo/src/addons/mediapool/lib/media_category.php - - message: "#^Parameter \\#3 \\$createListCallback of static method rex_media_category\\:\\:getInstanceList\\(\\) expects \\(callable\\(\\.\\.\\.mixed\\)\\: array\\)\\|null, Closure\\(mixed\\)\\: array given\\.$#" + message: "#^Parameter \\#3 \\$createListCallback of static method rex_media_category\\:\\:getInstanceList\\(\\) expects \\(callable\\(mixed \\.\\.\\.\\)\\: array\\)\\|null, Closure\\(mixed\\)\\: array given\\.$#" count: 2 path: ../../redaxo/src/addons/mediapool/lib/media_category.php @@ -1161,17 +1151,17 @@ parameters: path: ../../redaxo/src/addons/structure/lib/structure_element.php - - message: "#^Parameter \\#2 \\$createCallback of static method rex_structure_element\\:\\:getInstance\\(\\) expects \\(callable\\(\\.\\.\\.mixed\\)\\: static\\(rex_structure_element\\)\\|null\\)\\|null, Closure\\(mixed, mixed\\)\\: static\\(rex_structure_element\\)\\|null given\\.$#" + message: "#^Parameter \\#2 \\$createCallback of static method rex_structure_element\\:\\:getInstance\\(\\) expects \\(callable\\(mixed \\.\\.\\.\\)\\: \\(static\\|null\\)\\)\\|null, Closure\\(mixed, mixed\\)\\: \\(static\\|null\\) given\\.$#" count: 1 path: ../../redaxo/src/addons/structure/lib/structure_element.php - - message: "#^Parameter \\#2 \\$getInstanceCallback of static method rex_structure_element\\:\\:getInstanceList\\(\\) expects callable\\(\\.\\.\\.mixed\\)\\: static\\(rex_structure_element\\)\\|null, Closure\\(mixed\\)\\: static\\(rex_structure_element\\)\\|null given\\.$#" + message: "#^Parameter \\#2 \\$getInstanceCallback of static method rex_structure_element\\:\\:getInstanceList\\(\\) expects callable\\(mixed \\.\\.\\.\\)\\: \\(static\\|null\\), Closure\\(mixed\\)\\: \\(static\\|null\\) given\\.$#" count: 1 path: ../../redaxo/src/addons/structure/lib/structure_element.php - - message: "#^Parameter \\#3 \\$createListCallback of static method rex_structure_element\\:\\:getInstanceList\\(\\) expects \\(callable\\(\\.\\.\\.mixed\\)\\: array\\)\\|null, Closure\\(mixed, mixed\\)\\: array given\\.$#" + message: "#^Parameter \\#3 \\$createListCallback of static method rex_structure_element\\:\\:getInstanceList\\(\\) expects \\(callable\\(mixed \\.\\.\\.\\)\\: array\\)\\|null, Closure\\(mixed, mixed\\)\\: array given\\.$#" count: 1 path: ../../redaxo/src/addons/structure/lib/structure_element.php @@ -2076,7 +2066,7 @@ parameters: path: ../../redaxo/src/core/lib/login/user.php - - message: "#^Parameter \\#2 \\$createCallback of static method rex_user\\:\\:getInstance\\(\\) expects \\(callable\\(\\.\\.\\.mixed\\)\\: static\\(rex_user\\)\\|null\\)\\|null, Closure\\(int\\)\\: static\\(rex_user\\)\\|null given\\.$#" + message: "#^Parameter \\#2 \\$createCallback of static method rex_user\\:\\:getInstance\\(\\) expects \\(callable\\(mixed \\.\\.\\.\\)\\: \\(static\\|null\\)\\)\\|null, Closure\\(int\\)\\: \\(static\\|null\\) given\\.$#" count: 1 path: ../../redaxo/src/core/lib/login/user.php @@ -2521,7 +2511,7 @@ parameters: path: ../../redaxo/src/core/lib/sql/table.php - - message: "#^Parameter \\#2 \\$createCallback of static method rex_sql_table\\:\\:getInstance\\(\\) expects \\(callable\\(\\.\\.\\.mixed\\)\\: static\\(rex_sql_table\\)\\|null\\)\\|null, Closure\\(int, string\\)\\: static\\(rex_sql_table\\) given\\.$#" + message: "#^Parameter \\#2 \\$createCallback of static method rex_sql_table\\:\\:getInstance\\(\\) expects \\(callable\\(mixed \\.\\.\\.\\)\\: \\(static\\|null\\)\\)\\|null, Closure\\(int, string\\)\\: static given\\.$#" count: 1 path: ../../redaxo/src/core/lib/sql/table.php @@ -2801,22 +2791,22 @@ parameters: path: ../../redaxo/src/core/tests/base/instance_list_pool_trait_test.php - - message: "#^Parameter \\#2 \\$getInstanceCallback of static method rex_test_instance_list_pool\\:\\:getInstanceList\\(\\) expects callable\\(\\.\\.\\.mixed\\)\\: object\\|null, Closure\\(mixed, mixed\\)\\: void given\\.$#" + message: "#^Parameter \\#2 \\$getInstanceCallback of static method rex_test_instance_list_pool\\:\\:getInstanceList\\(\\) expects callable\\(mixed \\.\\.\\.\\)\\: \\(object\\|null\\), Closure\\(mixed, mixed\\)\\: void given\\.$#" count: 1 path: ../../redaxo/src/core/tests/base/instance_list_pool_trait_test.php - - message: "#^Parameter \\#2 \\$getInstanceCallback of static method rex_test_instance_list_pool\\:\\:getInstanceList\\(\\) expects callable\\(\\.\\.\\.mixed\\)\\: rex_test_instance_list_pool\\|null, Closure\\(int\\)\\: rex_test_instance_list_pool given\\.$#" + message: "#^Parameter \\#2 \\$getInstanceCallback of static method rex_test_instance_list_pool\\:\\:getInstanceList\\(\\) expects callable\\(mixed \\.\\.\\.\\)\\: \\(rex_test_instance_list_pool\\|null\\), Closure\\(int\\)\\: rex_test_instance_list_pool given\\.$#" count: 4 path: ../../redaxo/src/core/tests/base/instance_list_pool_trait_test.php - - message: "#^Parameter \\#3 \\$createListCallback of static method rex_test_instance_list_pool\\:\\:getInstanceList\\(\\) expects \\(callable\\(\\.\\.\\.mixed\\)\\: array\\)\\|null, Closure\\(mixed\\)\\: array\\{1, 2\\} given\\.$#" + message: "#^Parameter \\#3 \\$createListCallback of static method rex_test_instance_list_pool\\:\\:getInstanceList\\(\\) expects \\(callable\\(mixed \\.\\.\\.\\)\\: array\\)\\|null, Closure\\(mixed\\)\\: array\\{1, 2\\} given\\.$#" count: 1 path: ../../redaxo/src/core/tests/base/instance_list_pool_trait_test.php - - message: "#^Parameter \\#3 \\$createListCallback of static method rex_test_instance_list_pool\\:\\:getInstanceList\\(\\) expects \\(callable\\(\\.\\.\\.mixed\\)\\: array\\)\\|null, Closure\\(mixed, mixed\\)\\: array\\{\\} given\\.$#" + message: "#^Parameter \\#3 \\$createListCallback of static method rex_test_instance_list_pool\\:\\:getInstanceList\\(\\) expects \\(callable\\(mixed \\.\\.\\.\\)\\: array\\)\\|null, Closure\\(mixed, mixed\\)\\: array\\{\\} given\\.$#" count: 1 path: ../../redaxo/src/core/tests/base/instance_list_pool_trait_test.php @@ -2831,17 +2821,17 @@ parameters: path: ../../redaxo/src/core/tests/base/instance_list_pool_trait_test.php - - message: "#^Parameter \\#2 \\$createCallback of static method rex_test_instance_pool_base\\:\\:getInstance\\(\\) expects \\(callable\\(\\.\\.\\.mixed\\)\\: rex_test_instance_pool_1\\|null\\)\\|null, Closure\\(mixed\\)\\: rex_test_instance_pool_1 given\\.$#" + message: "#^Parameter \\#2 \\$createCallback of static method rex_test_instance_pool_base\\:\\:getInstance\\(\\) expects \\(callable\\(mixed \\.\\.\\.\\)\\: \\(rex_test_instance_pool_1\\|null\\)\\)\\|null, Closure\\(mixed\\)\\: rex_test_instance_pool_1 given\\.$#" count: 1 path: ../../redaxo/src/core/tests/base/instance_pool_trait_test.php - - message: "#^Parameter \\#2 \\$createCallback of static method rex_test_instance_pool_base\\:\\:getInstance\\(\\) expects \\(callable\\(\\.\\.\\.mixed\\)\\: rex_test_instance_pool_1\\|null\\)\\|null, Closure\\(mixed, mixed\\)\\: void given\\.$#" + message: "#^Parameter \\#2 \\$createCallback of static method rex_test_instance_pool_base\\:\\:getInstance\\(\\) expects \\(callable\\(mixed \\.\\.\\.\\)\\: \\(rex_test_instance_pool_1\\|null\\)\\)\\|null, Closure\\(mixed, mixed\\)\\: void given\\.$#" count: 1 path: ../../redaxo/src/core/tests/base/instance_pool_trait_test.php - - message: "#^Parameter \\#2 \\$createCallback of static method rex_test_instance_pool_base\\:\\:getInstance\\(\\) expects \\(callable\\(\\.\\.\\.mixed\\)\\: rex_test_instance_pool_2\\|null\\)\\|null, Closure\\(mixed\\)\\: rex_test_instance_pool_2 given\\.$#" + message: "#^Parameter \\#2 \\$createCallback of static method rex_test_instance_pool_base\\:\\:getInstance\\(\\) expects \\(callable\\(mixed \\.\\.\\.\\)\\: \\(rex_test_instance_pool_2\\|null\\)\\)\\|null, Closure\\(mixed\\)\\: rex_test_instance_pool_2 given\\.$#" count: 1 path: ../../redaxo/src/core/tests/base/instance_pool_trait_test.php diff --git a/.tools/psalm/baseline-taint.xml b/.tools/psalm/baseline-taint.xml index 85defd08b6..2174be79c4 100644 --- a/.tools/psalm/baseline-taint.xml +++ b/.tools/psalm/baseline-taint.xml @@ -1,5 +1,5 @@ - + $filename diff --git a/.tools/psalm/baseline.xml b/.tools/psalm/baseline.xml index 4520d645e5..7ee4a13a7b 100644 --- a/.tools/psalm/baseline.xml +++ b/.tools/psalm/baseline.xml @@ -1,5 +1,5 @@ - + $column @@ -70,10 +70,6 @@ - - $filec - $filec - @@ -107,10 +103,6 @@ - - - - rex_file::get($filename) rex_file::get($filename) @@ -494,6 +486,11 @@ addDatabaseQuery addDatabaseQuery + + + + + @@ -858,6 +855,12 @@ params['rotate']]]> + + + (int) $size[0] + (int) $size[1] + + @@ -942,9 +945,6 @@ - - AllowDynamicProperties - $filename $name @@ -1032,23 +1032,10 @@ - - - - - $size[0] - $size[1] - $allowedExtensions rex_mediapool::getBlockedExtensions() - - - - - - @@ -1215,10 +1202,6 @@ $data - - $size[0] - $size[1] - @@ -1955,9 +1938,6 @@ - - AllowDynamicProperties - $clang $id @@ -3498,9 +3478,6 @@ - - AllowDynamicProperties - @@ -4120,9 +4097,6 @@ $password - - SensitiveParameter - @@ -4154,11 +4128,6 @@ $previousPasswords - - SensitiveParameter - SensitiveParameter - SensitiveParameter - $previousPasswords @@ -4175,15 +4144,6 @@ - - SensitiveParameter - SensitiveParameter - SensitiveParameter - SensitiveParameter - SensitiveParameter - SensitiveParameter - SensitiveParameter - systemId]]]> $sessionConfig[$key] @@ -4222,10 +4182,6 @@ - - SensitiveParameter - SensitiveParameter - getDescription()]]> @@ -4252,9 +4208,6 @@ $role - - SensitiveParameter - sql->getValue($key)]]> sql->getValue('email')]]> @@ -4673,16 +4626,6 @@ getValue($column)]]> $value - - SensitiveParameter - SensitiveParameter - SensitiveParameter - SensitiveParameter - SensitiveParameter - SensitiveParameter - SensitiveParameter - SensitiveParameter - getValue('Create Table')]]> @@ -5024,10 +4967,6 @@ } }]]> - - SensitiveParameter - SensitiveParameter - diff --git a/composer.json b/composer.json index ed236a6a8e..20fdc283f7 100644 --- a/composer.json +++ b/composer.json @@ -14,10 +14,10 @@ "friendsofphp/php-cs-fixer": "v3.16.0", "friendsofredaxo/linter": "1.4.0", "jetbrains/phpstorm-attributes": "^1.0", - "phpstan/extension-installer": "1.3.0", - "phpstan/phpstan": "1.10.15", + "phpstan/extension-installer": "1.3.1", + "phpstan/phpstan": "1.10.22", "phpstan/phpstan-deprecation-rules": "1.1.3", - "phpstan/phpstan-phpunit": "1.3.11", + "phpstan/phpstan-phpunit": "1.3.13", "phpstan/phpstan-symfony": "1.3.2", "phpunit/phpunit": "^10.0.7", "psalm/plugin-phpunit": "0.18.4", @@ -25,7 +25,7 @@ "rector/rector": "0.16.0", "redaxo/php-cs-fixer-config": "2.1.2", "redaxo/psalm-plugin": "2.0.0", - "vimeo/psalm": "5.11.0" + "vimeo/psalm": "5.13.1" }, "replace": { "erusev/parsedown": "1.7.4", @@ -41,16 +41,17 @@ "ramsey/http-range": "1.1.0", "scssphp/scssphp": "v1.11.0", "splitbrain/php-archive": "1.3.1", - "symfony/console": "v6.2.10", - "symfony/deprecation-contracts": "v3.2.1", - "symfony/http-foundation": "v6.2.10", + "symfony/console": "v6.3.0", + "symfony/deprecation-contracts": "v3.3.0", + "symfony/http-foundation": "v6.3.1", "symfony/polyfill-ctype": "*", "symfony/polyfill-php80": "*", "symfony/polyfill-php81": "*", - "symfony/service-contracts": "v3.2.1", - "symfony/string": "v6.2.8", - "symfony/var-dumper": "v6.2.10", - "symfony/yaml": "v6.2.10", + "symfony/polyfill-php83": "v1.27.0", + "symfony/service-contracts": "v3.3.0", + "symfony/string": "v6.3.0", + "symfony/var-dumper": "v6.3.1", + "symfony/yaml": "v6.3.0", "voku/anti-xss": "4.1.41", "voku/portable-ascii": "2.0.1", "voku/portable-utf8": "6.0.13" diff --git a/redaxo/src/core/composer.json b/redaxo/src/core/composer.json index 7261a09537..2fbc16dd24 100644 --- a/redaxo/src/core/composer.json +++ b/redaxo/src/core/composer.json @@ -6,10 +6,10 @@ "lbuchs/webauthn": "^1.1.3", "psr/log": "^1.1.4", "ramsey/http-range": "^1.1", - "symfony/console": "^6.2.10", - "symfony/http-foundation": "^6.2.10", - "symfony/var-dumper": "^6.2.10", - "symfony/yaml": "^6.2.10", + "symfony/console": "^6.3.0", + "symfony/http-foundation": "^6.3.1", + "symfony/var-dumper": "^6.3.1", + "symfony/yaml": "^6.3.0", "voku/anti-xss": "^4.1.41" }, diff --git a/redaxo/src/core/composer.lock b/redaxo/src/core/composer.lock index 8ed3424225..18661d6f07 100644 --- a/redaxo/src/core/composer.lock +++ b/redaxo/src/core/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "c276959a3f28e65a9a9fa6b8a6d2fee7", + "content-hash": "d74b4552703ede5df0bcbf79e642652e", "packages": [ { "name": "erusev/parsedown", @@ -543,23 +543,23 @@ }, { "name": "symfony/console", - "version": "v6.2.10", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "12288d9f4500f84a4d02254d4aa968b15488476f" + "reference": "8788808b07cf0bdd6e4b7fdd23d8ddb1470c83b7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/12288d9f4500f84a4d02254d4aa968b15488476f", - "reference": "12288d9f4500f84a4d02254d4aa968b15488476f", + "url": "https://api.github.com/repos/symfony/console/zipball/8788808b07cf0bdd6e4b7fdd23d8ddb1470c83b7", + "reference": "8788808b07cf0bdd6e4b7fdd23d8ddb1470c83b7", "shasum": "" }, "require": { "php": ">=8.1", - "symfony/deprecation-contracts": "^2.1|^3", + "symfony/deprecation-contracts": "^2.5|^3", "symfony/polyfill-mbstring": "~1.0", - "symfony/service-contracts": "^1.1|^2|^3", + "symfony/service-contracts": "^2.5|^3", "symfony/string": "^5.4|^6.0" }, "conflict": { @@ -581,12 +581,6 @@ "symfony/process": "^5.4|^6.0", "symfony/var-dumper": "^5.4|^6.0" }, - "suggest": { - "psr/log": "For using the console logger", - "symfony/event-dispatcher": "", - "symfony/lock": "", - "symfony/process": "" - }, "type": "library", "autoload": { "psr-4": { @@ -619,7 +613,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v6.2.10" + "source": "https://github.com/symfony/console/tree/v6.3.0" }, "funding": [ { @@ -635,20 +629,20 @@ "type": "tidelift" } ], - "time": "2023-04-28T13:37:43+00:00" + "time": "2023-05-29T12:49:39+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v3.2.1", + "version": "v3.3.0", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "e2d1534420bd723d0ef5aec58a22c5fe60ce6f5e" + "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/e2d1534420bd723d0ef5aec58a22c5fe60ce6f5e", - "reference": "e2d1534420bd723d0ef5aec58a22c5fe60ce6f5e", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/7c3aff79d10325257a001fcf92d991f24fc967cf", + "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf", "shasum": "" }, "require": { @@ -657,7 +651,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "3.3-dev" + "dev-main": "3.4-dev" }, "thanks": { "name": "symfony/contracts", @@ -686,7 +680,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.2.1" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.3.0" }, "funding": [ { @@ -702,32 +696,34 @@ "type": "tidelift" } ], - "time": "2023-03-01T10:25:55+00:00" + "time": "2023-05-23T14:45:45+00:00" }, { "name": "symfony/http-foundation", - "version": "v6.2.10", + "version": "v6.3.1", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "49adbb92bcb4e3c2943719d2756271e8b9602acc" + "reference": "e0ad0d153e1c20069250986cd9e9dd1ccebb0d66" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/49adbb92bcb4e3c2943719d2756271e8b9602acc", - "reference": "49adbb92bcb4e3c2943719d2756271e8b9602acc", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/e0ad0d153e1c20069250986cd9e9dd1ccebb0d66", + "reference": "e0ad0d153e1c20069250986cd9e9dd1ccebb0d66", "shasum": "" }, "require": { "php": ">=8.1", - "symfony/deprecation-contracts": "^2.1|^3", - "symfony/polyfill-mbstring": "~1.1" + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/polyfill-mbstring": "~1.1", + "symfony/polyfill-php83": "^1.27" }, "conflict": { "symfony/cache": "<6.2" }, "require-dev": { - "predis/predis": "~1.0", + "doctrine/dbal": "^2.13.1|^3.0", + "predis/predis": "^1.1|^2.0", "symfony/cache": "^5.4|^6.0", "symfony/dependency-injection": "^5.4|^6.0", "symfony/expression-language": "^5.4|^6.0", @@ -735,9 +731,6 @@ "symfony/mime": "^5.4|^6.0", "symfony/rate-limiter": "^5.2|^6.0" }, - "suggest": { - "symfony/mime": "To use the file extension guesser" - }, "type": "library", "autoload": { "psr-4": { @@ -764,7 +757,84 @@ "description": "Defines an object-oriented layer for the HTTP specification", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-foundation/tree/v6.2.10" + "source": "https://github.com/symfony/http-foundation/tree/v6.3.1" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-06-24T11:51:27+00:00" + }, + { + "name": "symfony/polyfill-php83", + "version": "v1.27.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php83.git", + "reference": "508c652ba3ccf69f8c97f251534f229791b52a57" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php83/zipball/508c652ba3ccf69f8c97f251534f229791b52a57", + "reference": "508c652ba3ccf69f8c97f251534f229791b52a57", + "shasum": "" + }, + "require": { + "php": ">=7.1", + "symfony/polyfill-php80": "^1.14" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.27-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php83\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.3+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php83/tree/v1.27.0" }, "funding": [ { @@ -780,20 +850,20 @@ "type": "tidelift" } ], - "time": "2023-04-18T13:46:08+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/service-contracts", - "version": "v3.2.1", + "version": "v3.3.0", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "a8c9cedf55f314f3a186041d19537303766df09a" + "reference": "40da9cc13ec349d9e4966ce18b5fbcd724ab10a4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/a8c9cedf55f314f3a186041d19537303766df09a", - "reference": "a8c9cedf55f314f3a186041d19537303766df09a", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/40da9cc13ec349d9e4966ce18b5fbcd724ab10a4", + "reference": "40da9cc13ec349d9e4966ce18b5fbcd724ab10a4", "shasum": "" }, "require": { @@ -803,13 +873,10 @@ "conflict": { "ext-psr": "<1.1|>=2" }, - "suggest": { - "symfony/service-implementation": "" - }, "type": "library", "extra": { "branch-alias": { - "dev-main": "3.3-dev" + "dev-main": "3.4-dev" }, "thanks": { "name": "symfony/contracts", @@ -849,7 +916,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v3.2.1" + "source": "https://github.com/symfony/service-contracts/tree/v3.3.0" }, "funding": [ { @@ -865,20 +932,20 @@ "type": "tidelift" } ], - "time": "2023-03-01T10:32:47+00:00" + "time": "2023-05-23T14:45:45+00:00" }, { "name": "symfony/string", - "version": "v6.2.8", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "193e83bbd6617d6b2151c37fff10fa7168ebddef" + "reference": "f2e190ee75ff0f5eced645ec0be5c66fac81f51f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/193e83bbd6617d6b2151c37fff10fa7168ebddef", - "reference": "193e83bbd6617d6b2151c37fff10fa7168ebddef", + "url": "https://api.github.com/repos/symfony/string/zipball/f2e190ee75ff0f5eced645ec0be5c66fac81f51f", + "reference": "f2e190ee75ff0f5eced645ec0be5c66fac81f51f", "shasum": "" }, "require": { @@ -889,13 +956,13 @@ "symfony/polyfill-mbstring": "~1.0" }, "conflict": { - "symfony/translation-contracts": "<2.0" + "symfony/translation-contracts": "<2.5" }, "require-dev": { "symfony/error-handler": "^5.4|^6.0", "symfony/http-client": "^5.4|^6.0", "symfony/intl": "^6.2", - "symfony/translation-contracts": "^2.0|^3.0", + "symfony/translation-contracts": "^2.5|^3.0", "symfony/var-exporter": "^5.4|^6.0" }, "type": "library", @@ -935,7 +1002,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v6.2.8" + "source": "https://github.com/symfony/string/tree/v6.3.0" }, "funding": [ { @@ -951,20 +1018,20 @@ "type": "tidelift" } ], - "time": "2023-03-20T16:06:02+00:00" + "time": "2023-03-21T21:06:29+00:00" }, { "name": "symfony/var-dumper", - "version": "v6.2.10", + "version": "v6.3.1", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "41a750a23412ca76fdbbf5096943b4134272c1ab" + "reference": "c81268d6960ddb47af17391a27d222bd58cf0515" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/41a750a23412ca76fdbbf5096943b4134272c1ab", - "reference": "41a750a23412ca76fdbbf5096943b4134272c1ab", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/c81268d6960ddb47af17391a27d222bd58cf0515", + "reference": "c81268d6960ddb47af17391a27d222bd58cf0515", "shasum": "" }, "require": { @@ -972,7 +1039,6 @@ "symfony/polyfill-mbstring": "~1.0" }, "conflict": { - "phpunit/phpunit": "<5.4.3", "symfony/console": "<5.4" }, "require-dev": { @@ -982,11 +1048,6 @@ "symfony/uid": "^5.4|^6.0", "twig/twig": "^2.13|^3.0.4" }, - "suggest": { - "ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).", - "ext-intl": "To show region name in time zone dump", - "symfony/console": "To use the ServerDumpCommand and/or the bin/var-dump-server script" - }, "bin": [ "Resources/bin/var-dump-server" ], @@ -1023,7 +1084,7 @@ "dump" ], "support": { - "source": "https://github.com/symfony/var-dumper/tree/v6.2.10" + "source": "https://github.com/symfony/var-dumper/tree/v6.3.1" }, "funding": [ { @@ -1039,20 +1100,20 @@ "type": "tidelift" } ], - "time": "2023-04-18T13:46:08+00:00" + "time": "2023-06-21T12:08:28+00:00" }, { "name": "symfony/yaml", - "version": "v6.2.10", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "61916f3861b1e9705b18cfde723921a71dd1559d" + "reference": "a9a8337aa641ef2aa39c3e028f9107ec391e5927" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/61916f3861b1e9705b18cfde723921a71dd1559d", - "reference": "61916f3861b1e9705b18cfde723921a71dd1559d", + "url": "https://api.github.com/repos/symfony/yaml/zipball/a9a8337aa641ef2aa39c3e028f9107ec391e5927", + "reference": "a9a8337aa641ef2aa39c3e028f9107ec391e5927", "shasum": "" }, "require": { @@ -1065,9 +1126,6 @@ "require-dev": { "symfony/console": "^5.4|^6.0" }, - "suggest": { - "symfony/console": "For validating YAML files using the lint command" - }, "bin": [ "Resources/bin/yaml-lint" ], @@ -1097,7 +1155,7 @@ "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/yaml/tree/v6.2.10" + "source": "https://github.com/symfony/yaml/tree/v6.3.0" }, "funding": [ { @@ -1113,7 +1171,7 @@ "type": "tidelift" } ], - "time": "2023-04-28T13:25:36+00:00" + "time": "2023-04-28T13:28:14+00:00" }, { "name": "voku/anti-xss", diff --git a/redaxo/src/core/vendor/composer/ClassLoader.php b/redaxo/src/core/vendor/composer/ClassLoader.php index a72151c77c..7824d8f7ea 100644 --- a/redaxo/src/core/vendor/composer/ClassLoader.php +++ b/redaxo/src/core/vendor/composer/ClassLoader.php @@ -45,35 +45,34 @@ class ClassLoader /** @var \Closure(string):void */ private static $includeFile; - /** @var ?string */ + /** @var string|null */ private $vendorDir; // PSR-4 /** - * @var array[] - * @psalm-var array> + * @var array> */ private $prefixLengthsPsr4 = array(); /** - * @var array[] - * @psalm-var array> + * @var array> */ private $prefixDirsPsr4 = array(); /** - * @var array[] - * @psalm-var array + * @var list */ private $fallbackDirsPsr4 = array(); // PSR-0 /** - * @var array[] - * @psalm-var array> + * List of PSR-0 prefixes + * + * Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2'))) + * + * @var array>> */ private $prefixesPsr0 = array(); /** - * @var array[] - * @psalm-var array + * @var list */ private $fallbackDirsPsr0 = array(); @@ -81,8 +80,7 @@ class ClassLoader private $useIncludePath = false; /** - * @var string[] - * @psalm-var array + * @var array */ private $classMap = array(); @@ -90,21 +88,20 @@ class ClassLoader private $classMapAuthoritative = false; /** - * @var bool[] - * @psalm-var array + * @var array */ private $missingClasses = array(); - /** @var ?string */ + /** @var string|null */ private $apcuPrefix; /** - * @var self[] + * @var array */ private static $registeredLoaders = array(); /** - * @param ?string $vendorDir + * @param string|null $vendorDir */ public function __construct($vendorDir = null) { @@ -113,7 +110,7 @@ public function __construct($vendorDir = null) } /** - * @return string[] + * @return array> */ public function getPrefixes() { @@ -125,8 +122,7 @@ public function getPrefixes() } /** - * @return array[] - * @psalm-return array> + * @return array> */ public function getPrefixesPsr4() { @@ -134,8 +130,7 @@ public function getPrefixesPsr4() } /** - * @return array[] - * @psalm-return array + * @return list */ public function getFallbackDirs() { @@ -143,8 +138,7 @@ public function getFallbackDirs() } /** - * @return array[] - * @psalm-return array + * @return list */ public function getFallbackDirsPsr4() { @@ -152,8 +146,7 @@ public function getFallbackDirsPsr4() } /** - * @return string[] Array of classname => path - * @psalm-return array + * @return array Array of classname => path */ public function getClassMap() { @@ -161,8 +154,7 @@ public function getClassMap() } /** - * @param string[] $classMap Class to filename map - * @psalm-param array $classMap + * @param array $classMap Class to filename map * * @return void */ @@ -179,24 +171,25 @@ public function addClassMap(array $classMap) * Registers a set of PSR-0 directories for a given prefix, either * appending or prepending to the ones previously set for this prefix. * - * @param string $prefix The prefix - * @param string[]|string $paths The PSR-0 root directories - * @param bool $prepend Whether to prepend the directories + * @param string $prefix The prefix + * @param list|string $paths The PSR-0 root directories + * @param bool $prepend Whether to prepend the directories * * @return void */ public function add($prefix, $paths, $prepend = false) { + $paths = (array) $paths; if (!$prefix) { if ($prepend) { $this->fallbackDirsPsr0 = array_merge( - (array) $paths, + $paths, $this->fallbackDirsPsr0 ); } else { $this->fallbackDirsPsr0 = array_merge( $this->fallbackDirsPsr0, - (array) $paths + $paths ); } @@ -205,19 +198,19 @@ public function add($prefix, $paths, $prepend = false) $first = $prefix[0]; if (!isset($this->prefixesPsr0[$first][$prefix])) { - $this->prefixesPsr0[$first][$prefix] = (array) $paths; + $this->prefixesPsr0[$first][$prefix] = $paths; return; } if ($prepend) { $this->prefixesPsr0[$first][$prefix] = array_merge( - (array) $paths, + $paths, $this->prefixesPsr0[$first][$prefix] ); } else { $this->prefixesPsr0[$first][$prefix] = array_merge( $this->prefixesPsr0[$first][$prefix], - (array) $paths + $paths ); } } @@ -226,9 +219,9 @@ public function add($prefix, $paths, $prepend = false) * Registers a set of PSR-4 directories for a given namespace, either * appending or prepending to the ones previously set for this namespace. * - * @param string $prefix The prefix/namespace, with trailing '\\' - * @param string[]|string $paths The PSR-4 base directories - * @param bool $prepend Whether to prepend the directories + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param list|string $paths The PSR-4 base directories + * @param bool $prepend Whether to prepend the directories * * @throws \InvalidArgumentException * @@ -236,17 +229,18 @@ public function add($prefix, $paths, $prepend = false) */ public function addPsr4($prefix, $paths, $prepend = false) { + $paths = (array) $paths; if (!$prefix) { // Register directories for the root namespace. if ($prepend) { $this->fallbackDirsPsr4 = array_merge( - (array) $paths, + $paths, $this->fallbackDirsPsr4 ); } else { $this->fallbackDirsPsr4 = array_merge( $this->fallbackDirsPsr4, - (array) $paths + $paths ); } } elseif (!isset($this->prefixDirsPsr4[$prefix])) { @@ -256,18 +250,18 @@ public function addPsr4($prefix, $paths, $prepend = false) throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); } $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; - $this->prefixDirsPsr4[$prefix] = (array) $paths; + $this->prefixDirsPsr4[$prefix] = $paths; } elseif ($prepend) { // Prepend directories for an already registered namespace. $this->prefixDirsPsr4[$prefix] = array_merge( - (array) $paths, + $paths, $this->prefixDirsPsr4[$prefix] ); } else { // Append directories for an already registered namespace. $this->prefixDirsPsr4[$prefix] = array_merge( $this->prefixDirsPsr4[$prefix], - (array) $paths + $paths ); } } @@ -276,8 +270,8 @@ public function addPsr4($prefix, $paths, $prepend = false) * Registers a set of PSR-0 directories for a given prefix, * replacing any others previously set for this prefix. * - * @param string $prefix The prefix - * @param string[]|string $paths The PSR-0 base directories + * @param string $prefix The prefix + * @param list|string $paths The PSR-0 base directories * * @return void */ @@ -294,8 +288,8 @@ public function set($prefix, $paths) * Registers a set of PSR-4 directories for a given namespace, * replacing any others previously set for this namespace. * - * @param string $prefix The prefix/namespace, with trailing '\\' - * @param string[]|string $paths The PSR-4 base directories + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param list|string $paths The PSR-4 base directories * * @throws \InvalidArgumentException * @@ -481,9 +475,9 @@ public function findFile($class) } /** - * Returns the currently registered loaders indexed by their corresponding vendor directories. + * Returns the currently registered loaders keyed by their corresponding vendor directories. * - * @return self[] + * @return array */ public static function getRegisteredLoaders() { diff --git a/redaxo/src/core/vendor/composer/autoload_classmap.php b/redaxo/src/core/vendor/composer/autoload_classmap.php index ad6c75025c..4d1e4f0b57 100644 --- a/redaxo/src/core/vendor/composer/autoload_classmap.php +++ b/redaxo/src/core/vendor/composer/autoload_classmap.php @@ -105,6 +105,7 @@ 'Symfony\\Component\\Console\\Descriptor\\DescriptorInterface' => $vendorDir . '/symfony/console/Descriptor/DescriptorInterface.php', 'Symfony\\Component\\Console\\Descriptor\\JsonDescriptor' => $vendorDir . '/symfony/console/Descriptor/JsonDescriptor.php', 'Symfony\\Component\\Console\\Descriptor\\MarkdownDescriptor' => $vendorDir . '/symfony/console/Descriptor/MarkdownDescriptor.php', + 'Symfony\\Component\\Console\\Descriptor\\ReStructuredTextDescriptor' => $vendorDir . '/symfony/console/Descriptor/ReStructuredTextDescriptor.php', 'Symfony\\Component\\Console\\Descriptor\\TextDescriptor' => $vendorDir . '/symfony/console/Descriptor/TextDescriptor.php', 'Symfony\\Component\\Console\\Descriptor\\XmlDescriptor' => $vendorDir . '/symfony/console/Descriptor/XmlDescriptor.php', 'Symfony\\Component\\Console\\EventListener\\ErrorListener' => $vendorDir . '/symfony/console/EventListener/ErrorListener.php', @@ -275,6 +276,7 @@ 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Proxy\\SessionHandlerProxy' => $vendorDir . '/symfony/http-foundation/Session/Storage/Proxy/SessionHandlerProxy.php', 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\SessionStorageFactoryInterface' => $vendorDir . '/symfony/http-foundation/Session/Storage/SessionStorageFactoryInterface.php', 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\SessionStorageInterface' => $vendorDir . '/symfony/http-foundation/Session/Storage/SessionStorageInterface.php', + 'Symfony\\Component\\HttpFoundation\\StreamedJsonResponse' => $vendorDir . '/symfony/http-foundation/StreamedJsonResponse.php', 'Symfony\\Component\\HttpFoundation\\StreamedResponse' => $vendorDir . '/symfony/http-foundation/StreamedResponse.php', 'Symfony\\Component\\HttpFoundation\\UrlHelper' => $vendorDir . '/symfony/http-foundation/UrlHelper.php', 'Symfony\\Component\\String\\AbstractString' => $vendorDir . '/symfony/string/AbstractString.php', @@ -322,6 +324,7 @@ 'Symfony\\Component\\VarDumper\\Caster\\RedisCaster' => $vendorDir . '/symfony/var-dumper/Caster/RedisCaster.php', 'Symfony\\Component\\VarDumper\\Caster\\ReflectionCaster' => $vendorDir . '/symfony/var-dumper/Caster/ReflectionCaster.php', 'Symfony\\Component\\VarDumper\\Caster\\ResourceCaster' => $vendorDir . '/symfony/var-dumper/Caster/ResourceCaster.php', + 'Symfony\\Component\\VarDumper\\Caster\\ScalarStub' => $vendorDir . '/symfony/var-dumper/Caster/ScalarStub.php', 'Symfony\\Component\\VarDumper\\Caster\\SplCaster' => $vendorDir . '/symfony/var-dumper/Caster/SplCaster.php', 'Symfony\\Component\\VarDumper\\Caster\\StubCaster' => $vendorDir . '/symfony/var-dumper/Caster/StubCaster.php', 'Symfony\\Component\\VarDumper\\Caster\\SymfonyCaster' => $vendorDir . '/symfony/var-dumper/Caster/SymfonyCaster.php', @@ -373,6 +376,7 @@ 'Symfony\\Contracts\\Service\\ServiceProviderInterface' => $vendorDir . '/symfony/service-contracts/ServiceProviderInterface.php', 'Symfony\\Contracts\\Service\\ServiceSubscriberInterface' => $vendorDir . '/symfony/service-contracts/ServiceSubscriberInterface.php', 'Symfony\\Contracts\\Service\\ServiceSubscriberTrait' => $vendorDir . '/symfony/service-contracts/ServiceSubscriberTrait.php', + 'Symfony\\Polyfill\\Php83\\Php83' => $vendorDir . '/symfony/polyfill-php83/Php83.php', 'Whoops\\Exception\\ErrorException' => $vendorDir . '/filp/whoops/src/Whoops/Exception/ErrorException.php', 'Whoops\\Exception\\Formatter' => $vendorDir . '/filp/whoops/src/Whoops/Exception/Formatter.php', 'Whoops\\Exception\\Frame' => $vendorDir . '/filp/whoops/src/Whoops/Exception/Frame.php', diff --git a/redaxo/src/core/vendor/composer/autoload_files.php b/redaxo/src/core/vendor/composer/autoload_files.php index 2383a247dd..bdc0fa6c55 100644 --- a/redaxo/src/core/vendor/composer/autoload_files.php +++ b/redaxo/src/core/vendor/composer/autoload_files.php @@ -7,6 +7,7 @@ return array( '6e3fae29631ef280660b3cdad06f25a8' => $vendorDir . '/symfony/deprecation-contracts/function.php', + '662a729f963d39afe703c9d9b7ab4a8c' => $vendorDir . '/symfony/polyfill-php83/bootstrap.php', 'b6b991a57620e2fb6b2f66f03fe9ddc2' => $vendorDir . '/symfony/string/Resources/functions.php', 'b46ad4fe52f4d1899a2951c7e6ea56b0' => $vendorDir . '/voku/portable-utf8/bootstrap.php', '667aeda72477189d0494fecd327c3641' => $vendorDir . '/symfony/var-dumper/Resources/functions/dump.php', diff --git a/redaxo/src/core/vendor/composer/autoload_psr4.php b/redaxo/src/core/vendor/composer/autoload_psr4.php index 77c295b842..6d8ba3e334 100644 --- a/redaxo/src/core/vendor/composer/autoload_psr4.php +++ b/redaxo/src/core/vendor/composer/autoload_psr4.php @@ -10,6 +10,7 @@ 'voku\\' => array($vendorDir . '/voku/portable-ascii/src/voku', $vendorDir . '/voku/portable-utf8/src/voku'), 'lbuchs\\WebAuthn\\' => array($vendorDir . '/lbuchs/webauthn/src'), 'Whoops\\' => array($vendorDir . '/filp/whoops/src/Whoops'), + 'Symfony\\Polyfill\\Php83\\' => array($vendorDir . '/symfony/polyfill-php83'), 'Symfony\\Contracts\\Service\\' => array($vendorDir . '/symfony/service-contracts'), 'Symfony\\Component\\Yaml\\' => array($vendorDir . '/symfony/yaml'), 'Symfony\\Component\\VarDumper\\' => array($vendorDir . '/symfony/var-dumper'), diff --git a/redaxo/src/core/vendor/composer/autoload_static.php b/redaxo/src/core/vendor/composer/autoload_static.php index 3385d3bfd4..ee09d28b2e 100644 --- a/redaxo/src/core/vendor/composer/autoload_static.php +++ b/redaxo/src/core/vendor/composer/autoload_static.php @@ -8,6 +8,7 @@ class ComposerStaticInitRedaxoCore { public static $files = array ( '6e3fae29631ef280660b3cdad06f25a8' => __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php', + '662a729f963d39afe703c9d9b7ab4a8c' => __DIR__ . '/..' . '/symfony/polyfill-php83/bootstrap.php', 'b6b991a57620e2fb6b2f66f03fe9ddc2' => __DIR__ . '/..' . '/symfony/string/Resources/functions.php', 'b46ad4fe52f4d1899a2951c7e6ea56b0' => __DIR__ . '/..' . '/voku/portable-utf8/bootstrap.php', '667aeda72477189d0494fecd327c3641' => __DIR__ . '/..' . '/symfony/var-dumper/Resources/functions/dump.php', @@ -29,6 +30,7 @@ class ComposerStaticInitRedaxoCore ), 'S' => array ( + 'Symfony\\Polyfill\\Php83\\' => 23, 'Symfony\\Contracts\\Service\\' => 26, 'Symfony\\Component\\Yaml\\' => 23, 'Symfony\\Component\\VarDumper\\' => 28, @@ -67,6 +69,10 @@ class ComposerStaticInitRedaxoCore array ( 0 => __DIR__ . '/..' . '/filp/whoops/src/Whoops', ), + 'Symfony\\Polyfill\\Php83\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/polyfill-php83', + ), 'Symfony\\Contracts\\Service\\' => array ( 0 => __DIR__ . '/..' . '/symfony/service-contracts', @@ -227,6 +233,7 @@ class ComposerStaticInitRedaxoCore 'Symfony\\Component\\Console\\Descriptor\\DescriptorInterface' => __DIR__ . '/..' . '/symfony/console/Descriptor/DescriptorInterface.php', 'Symfony\\Component\\Console\\Descriptor\\JsonDescriptor' => __DIR__ . '/..' . '/symfony/console/Descriptor/JsonDescriptor.php', 'Symfony\\Component\\Console\\Descriptor\\MarkdownDescriptor' => __DIR__ . '/..' . '/symfony/console/Descriptor/MarkdownDescriptor.php', + 'Symfony\\Component\\Console\\Descriptor\\ReStructuredTextDescriptor' => __DIR__ . '/..' . '/symfony/console/Descriptor/ReStructuredTextDescriptor.php', 'Symfony\\Component\\Console\\Descriptor\\TextDescriptor' => __DIR__ . '/..' . '/symfony/console/Descriptor/TextDescriptor.php', 'Symfony\\Component\\Console\\Descriptor\\XmlDescriptor' => __DIR__ . '/..' . '/symfony/console/Descriptor/XmlDescriptor.php', 'Symfony\\Component\\Console\\EventListener\\ErrorListener' => __DIR__ . '/..' . '/symfony/console/EventListener/ErrorListener.php', @@ -397,6 +404,7 @@ class ComposerStaticInitRedaxoCore 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Proxy\\SessionHandlerProxy' => __DIR__ . '/..' . '/symfony/http-foundation/Session/Storage/Proxy/SessionHandlerProxy.php', 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\SessionStorageFactoryInterface' => __DIR__ . '/..' . '/symfony/http-foundation/Session/Storage/SessionStorageFactoryInterface.php', 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\SessionStorageInterface' => __DIR__ . '/..' . '/symfony/http-foundation/Session/Storage/SessionStorageInterface.php', + 'Symfony\\Component\\HttpFoundation\\StreamedJsonResponse' => __DIR__ . '/..' . '/symfony/http-foundation/StreamedJsonResponse.php', 'Symfony\\Component\\HttpFoundation\\StreamedResponse' => __DIR__ . '/..' . '/symfony/http-foundation/StreamedResponse.php', 'Symfony\\Component\\HttpFoundation\\UrlHelper' => __DIR__ . '/..' . '/symfony/http-foundation/UrlHelper.php', 'Symfony\\Component\\String\\AbstractString' => __DIR__ . '/..' . '/symfony/string/AbstractString.php', @@ -444,6 +452,7 @@ class ComposerStaticInitRedaxoCore 'Symfony\\Component\\VarDumper\\Caster\\RedisCaster' => __DIR__ . '/..' . '/symfony/var-dumper/Caster/RedisCaster.php', 'Symfony\\Component\\VarDumper\\Caster\\ReflectionCaster' => __DIR__ . '/..' . '/symfony/var-dumper/Caster/ReflectionCaster.php', 'Symfony\\Component\\VarDumper\\Caster\\ResourceCaster' => __DIR__ . '/..' . '/symfony/var-dumper/Caster/ResourceCaster.php', + 'Symfony\\Component\\VarDumper\\Caster\\ScalarStub' => __DIR__ . '/..' . '/symfony/var-dumper/Caster/ScalarStub.php', 'Symfony\\Component\\VarDumper\\Caster\\SplCaster' => __DIR__ . '/..' . '/symfony/var-dumper/Caster/SplCaster.php', 'Symfony\\Component\\VarDumper\\Caster\\StubCaster' => __DIR__ . '/..' . '/symfony/var-dumper/Caster/StubCaster.php', 'Symfony\\Component\\VarDumper\\Caster\\SymfonyCaster' => __DIR__ . '/..' . '/symfony/var-dumper/Caster/SymfonyCaster.php', @@ -495,6 +504,7 @@ class ComposerStaticInitRedaxoCore 'Symfony\\Contracts\\Service\\ServiceProviderInterface' => __DIR__ . '/..' . '/symfony/service-contracts/ServiceProviderInterface.php', 'Symfony\\Contracts\\Service\\ServiceSubscriberInterface' => __DIR__ . '/..' . '/symfony/service-contracts/ServiceSubscriberInterface.php', 'Symfony\\Contracts\\Service\\ServiceSubscriberTrait' => __DIR__ . '/..' . '/symfony/service-contracts/ServiceSubscriberTrait.php', + 'Symfony\\Polyfill\\Php83\\Php83' => __DIR__ . '/..' . '/symfony/polyfill-php83/Php83.php', 'Whoops\\Exception\\ErrorException' => __DIR__ . '/..' . '/filp/whoops/src/Whoops/Exception/ErrorException.php', 'Whoops\\Exception\\Formatter' => __DIR__ . '/..' . '/filp/whoops/src/Whoops/Exception/Formatter.php', 'Whoops\\Exception\\Frame' => __DIR__ . '/..' . '/filp/whoops/src/Whoops/Exception/Frame.php', diff --git a/redaxo/src/core/vendor/composer/installed.json b/redaxo/src/core/vendor/composer/installed.json index db03902c7e..fe946ca045 100644 --- a/redaxo/src/core/vendor/composer/installed.json +++ b/redaxo/src/core/vendor/composer/installed.json @@ -564,24 +564,24 @@ }, { "name": "symfony/console", - "version": "v6.2.10", - "version_normalized": "6.2.10.0", + "version": "v6.3.0", + "version_normalized": "6.3.0.0", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "12288d9f4500f84a4d02254d4aa968b15488476f" + "reference": "8788808b07cf0bdd6e4b7fdd23d8ddb1470c83b7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/12288d9f4500f84a4d02254d4aa968b15488476f", - "reference": "12288d9f4500f84a4d02254d4aa968b15488476f", + "url": "https://api.github.com/repos/symfony/console/zipball/8788808b07cf0bdd6e4b7fdd23d8ddb1470c83b7", + "reference": "8788808b07cf0bdd6e4b7fdd23d8ddb1470c83b7", "shasum": "" }, "require": { "php": ">=8.1", - "symfony/deprecation-contracts": "^2.1|^3", + "symfony/deprecation-contracts": "^2.5|^3", "symfony/polyfill-mbstring": "~1.0", - "symfony/service-contracts": "^1.1|^2|^3", + "symfony/service-contracts": "^2.5|^3", "symfony/string": "^5.4|^6.0" }, "conflict": { @@ -603,13 +603,7 @@ "symfony/process": "^5.4|^6.0", "symfony/var-dumper": "^5.4|^6.0" }, - "suggest": { - "psr/log": "For using the console logger", - "symfony/event-dispatcher": "", - "symfony/lock": "", - "symfony/process": "" - }, - "time": "2023-04-28T13:37:43+00:00", + "time": "2023-05-29T12:49:39+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -643,7 +637,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v6.2.10" + "source": "https://github.com/symfony/console/tree/v6.3.0" }, "funding": [ { @@ -663,27 +657,27 @@ }, { "name": "symfony/deprecation-contracts", - "version": "v3.2.1", - "version_normalized": "3.2.1.0", + "version": "v3.3.0", + "version_normalized": "3.3.0.0", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "e2d1534420bd723d0ef5aec58a22c5fe60ce6f5e" + "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/e2d1534420bd723d0ef5aec58a22c5fe60ce6f5e", - "reference": "e2d1534420bd723d0ef5aec58a22c5fe60ce6f5e", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/7c3aff79d10325257a001fcf92d991f24fc967cf", + "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf", "shasum": "" }, "require": { "php": ">=8.1" }, - "time": "2023-03-01T10:25:55+00:00", + "time": "2023-05-23T14:45:45+00:00", "type": "library", "extra": { "branch-alias": { - "dev-main": "3.3-dev" + "dev-main": "3.4-dev" }, "thanks": { "name": "symfony/contracts", @@ -713,7 +707,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.2.1" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.3.0" }, "funding": [ { @@ -733,29 +727,31 @@ }, { "name": "symfony/http-foundation", - "version": "v6.2.10", - "version_normalized": "6.2.10.0", + "version": "v6.3.1", + "version_normalized": "6.3.1.0", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "49adbb92bcb4e3c2943719d2756271e8b9602acc" + "reference": "e0ad0d153e1c20069250986cd9e9dd1ccebb0d66" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/49adbb92bcb4e3c2943719d2756271e8b9602acc", - "reference": "49adbb92bcb4e3c2943719d2756271e8b9602acc", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/e0ad0d153e1c20069250986cd9e9dd1ccebb0d66", + "reference": "e0ad0d153e1c20069250986cd9e9dd1ccebb0d66", "shasum": "" }, "require": { "php": ">=8.1", - "symfony/deprecation-contracts": "^2.1|^3", - "symfony/polyfill-mbstring": "~1.1" + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/polyfill-mbstring": "~1.1", + "symfony/polyfill-php83": "^1.27" }, "conflict": { "symfony/cache": "<6.2" }, "require-dev": { - "predis/predis": "~1.0", + "doctrine/dbal": "^2.13.1|^3.0", + "predis/predis": "^1.1|^2.0", "symfony/cache": "^5.4|^6.0", "symfony/dependency-injection": "^5.4|^6.0", "symfony/expression-language": "^5.4|^6.0", @@ -763,10 +759,7 @@ "symfony/mime": "^5.4|^6.0", "symfony/rate-limiter": "^5.2|^6.0" }, - "suggest": { - "symfony/mime": "To use the file extension guesser" - }, - "time": "2023-04-18T13:46:08+00:00", + "time": "2023-06-24T11:51:27+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -794,7 +787,7 @@ "description": "Defines an object-oriented layer for the HTTP specification", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-foundation/tree/v6.2.10" + "source": "https://github.com/symfony/http-foundation/tree/v6.3.1" }, "funding": [ { @@ -812,19 +805,99 @@ ], "install-path": "../symfony/http-foundation" }, + { + "name": "symfony/polyfill-php83", + "version": "v1.27.0", + "version_normalized": "1.27.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php83.git", + "reference": "508c652ba3ccf69f8c97f251534f229791b52a57" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php83/zipball/508c652ba3ccf69f8c97f251534f229791b52a57", + "reference": "508c652ba3ccf69f8c97f251534f229791b52a57", + "shasum": "" + }, + "require": { + "php": ">=7.1", + "symfony/polyfill-php80": "^1.14" + }, + "time": "2022-11-03T14:55:06+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.27-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php83\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.3+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php83/tree/v1.27.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/polyfill-php83" + }, { "name": "symfony/service-contracts", - "version": "v3.2.1", - "version_normalized": "3.2.1.0", + "version": "v3.3.0", + "version_normalized": "3.3.0.0", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "a8c9cedf55f314f3a186041d19537303766df09a" + "reference": "40da9cc13ec349d9e4966ce18b5fbcd724ab10a4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/a8c9cedf55f314f3a186041d19537303766df09a", - "reference": "a8c9cedf55f314f3a186041d19537303766df09a", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/40da9cc13ec349d9e4966ce18b5fbcd724ab10a4", + "reference": "40da9cc13ec349d9e4966ce18b5fbcd724ab10a4", "shasum": "" }, "require": { @@ -834,14 +907,11 @@ "conflict": { "ext-psr": "<1.1|>=2" }, - "suggest": { - "symfony/service-implementation": "" - }, - "time": "2023-03-01T10:32:47+00:00", + "time": "2023-05-23T14:45:45+00:00", "type": "library", "extra": { "branch-alias": { - "dev-main": "3.3-dev" + "dev-main": "3.4-dev" }, "thanks": { "name": "symfony/contracts", @@ -882,7 +952,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v3.2.1" + "source": "https://github.com/symfony/service-contracts/tree/v3.3.0" }, "funding": [ { @@ -902,17 +972,17 @@ }, { "name": "symfony/string", - "version": "v6.2.8", - "version_normalized": "6.2.8.0", + "version": "v6.3.0", + "version_normalized": "6.3.0.0", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "193e83bbd6617d6b2151c37fff10fa7168ebddef" + "reference": "f2e190ee75ff0f5eced645ec0be5c66fac81f51f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/193e83bbd6617d6b2151c37fff10fa7168ebddef", - "reference": "193e83bbd6617d6b2151c37fff10fa7168ebddef", + "url": "https://api.github.com/repos/symfony/string/zipball/f2e190ee75ff0f5eced645ec0be5c66fac81f51f", + "reference": "f2e190ee75ff0f5eced645ec0be5c66fac81f51f", "shasum": "" }, "require": { @@ -923,16 +993,16 @@ "symfony/polyfill-mbstring": "~1.0" }, "conflict": { - "symfony/translation-contracts": "<2.0" + "symfony/translation-contracts": "<2.5" }, "require-dev": { "symfony/error-handler": "^5.4|^6.0", "symfony/http-client": "^5.4|^6.0", "symfony/intl": "^6.2", - "symfony/translation-contracts": "^2.0|^3.0", + "symfony/translation-contracts": "^2.5|^3.0", "symfony/var-exporter": "^5.4|^6.0" }, - "time": "2023-03-20T16:06:02+00:00", + "time": "2023-03-21T21:06:29+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -971,7 +1041,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v6.2.8" + "source": "https://github.com/symfony/string/tree/v6.3.0" }, "funding": [ { @@ -991,17 +1061,17 @@ }, { "name": "symfony/var-dumper", - "version": "v6.2.10", - "version_normalized": "6.2.10.0", + "version": "v6.3.1", + "version_normalized": "6.3.1.0", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "41a750a23412ca76fdbbf5096943b4134272c1ab" + "reference": "c81268d6960ddb47af17391a27d222bd58cf0515" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/41a750a23412ca76fdbbf5096943b4134272c1ab", - "reference": "41a750a23412ca76fdbbf5096943b4134272c1ab", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/c81268d6960ddb47af17391a27d222bd58cf0515", + "reference": "c81268d6960ddb47af17391a27d222bd58cf0515", "shasum": "" }, "require": { @@ -1009,7 +1079,6 @@ "symfony/polyfill-mbstring": "~1.0" }, "conflict": { - "phpunit/phpunit": "<5.4.3", "symfony/console": "<5.4" }, "require-dev": { @@ -1019,12 +1088,7 @@ "symfony/uid": "^5.4|^6.0", "twig/twig": "^2.13|^3.0.4" }, - "suggest": { - "ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).", - "ext-intl": "To show region name in time zone dump", - "symfony/console": "To use the ServerDumpCommand and/or the bin/var-dump-server script" - }, - "time": "2023-04-18T13:46:08+00:00", + "time": "2023-06-21T12:08:28+00:00", "bin": [ "Resources/bin/var-dump-server" ], @@ -1062,7 +1126,7 @@ "dump" ], "support": { - "source": "https://github.com/symfony/var-dumper/tree/v6.2.10" + "source": "https://github.com/symfony/var-dumper/tree/v6.3.1" }, "funding": [ { @@ -1082,17 +1146,17 @@ }, { "name": "symfony/yaml", - "version": "v6.2.10", - "version_normalized": "6.2.10.0", + "version": "v6.3.0", + "version_normalized": "6.3.0.0", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "61916f3861b1e9705b18cfde723921a71dd1559d" + "reference": "a9a8337aa641ef2aa39c3e028f9107ec391e5927" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/61916f3861b1e9705b18cfde723921a71dd1559d", - "reference": "61916f3861b1e9705b18cfde723921a71dd1559d", + "url": "https://api.github.com/repos/symfony/yaml/zipball/a9a8337aa641ef2aa39c3e028f9107ec391e5927", + "reference": "a9a8337aa641ef2aa39c3e028f9107ec391e5927", "shasum": "" }, "require": { @@ -1105,10 +1169,7 @@ "require-dev": { "symfony/console": "^5.4|^6.0" }, - "suggest": { - "symfony/console": "For validating YAML files using the lint command" - }, - "time": "2023-04-28T13:25:36+00:00", + "time": "2023-04-28T13:28:14+00:00", "bin": [ "Resources/bin/yaml-lint" ], @@ -1139,7 +1200,7 @@ "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/yaml/tree/v6.2.10" + "source": "https://github.com/symfony/yaml/tree/v6.3.0" }, "funding": [ { diff --git a/redaxo/src/core/vendor/composer/installed.php b/redaxo/src/core/vendor/composer/installed.php index f827fd4e49..4de5c8f9ef 100644 --- a/redaxo/src/core/vendor/composer/installed.php +++ b/redaxo/src/core/vendor/composer/installed.php @@ -3,7 +3,7 @@ 'name' => '__root__', 'pretty_version' => 'dev-main', 'version' => 'dev-main', - 'reference' => 'cd835e3af245c272bc2be01cc14874b1a82b91e4', + 'reference' => '1282c3ef4621a3e8b4df6c937ce6ce6ced53fc9a', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -13,7 +13,7 @@ '__root__' => array( 'pretty_version' => 'dev-main', 'version' => 'dev-main', - 'reference' => 'cd835e3af245c272bc2be01cc14874b1a82b91e4', + 'reference' => '1282c3ef4621a3e8b4df6c937ce6ce6ced53fc9a', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -107,27 +107,27 @@ 'dev_requirement' => false, ), 'symfony/console' => array( - 'pretty_version' => 'v6.2.10', - 'version' => '6.2.10.0', - 'reference' => '12288d9f4500f84a4d02254d4aa968b15488476f', + 'pretty_version' => 'v6.3.0', + 'version' => '6.3.0.0', + 'reference' => '8788808b07cf0bdd6e4b7fdd23d8ddb1470c83b7', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/console', 'aliases' => array(), 'dev_requirement' => false, ), 'symfony/deprecation-contracts' => array( - 'pretty_version' => 'v3.2.1', - 'version' => '3.2.1.0', - 'reference' => 'e2d1534420bd723d0ef5aec58a22c5fe60ce6f5e', + 'pretty_version' => 'v3.3.0', + 'version' => '3.3.0.0', + 'reference' => '7c3aff79d10325257a001fcf92d991f24fc967cf', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/deprecation-contracts', 'aliases' => array(), 'dev_requirement' => false, ), 'symfony/http-foundation' => array( - 'pretty_version' => 'v6.2.10', - 'version' => '6.2.10.0', - 'reference' => '49adbb92bcb4e3c2943719d2756271e8b9602acc', + 'pretty_version' => 'v6.3.1', + 'version' => '6.3.1.0', + 'reference' => 'e0ad0d153e1c20069250986cd9e9dd1ccebb0d66', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/http-foundation', 'aliases' => array(), @@ -193,37 +193,46 @@ 0 => '*', ), ), + 'symfony/polyfill-php83' => array( + 'pretty_version' => 'v1.27.0', + 'version' => '1.27.0.0', + 'reference' => '508c652ba3ccf69f8c97f251534f229791b52a57', + 'type' => 'library', + 'install_path' => __DIR__ . '/../symfony/polyfill-php83', + 'aliases' => array(), + 'dev_requirement' => false, + ), 'symfony/service-contracts' => array( - 'pretty_version' => 'v3.2.1', - 'version' => '3.2.1.0', - 'reference' => 'a8c9cedf55f314f3a186041d19537303766df09a', + 'pretty_version' => 'v3.3.0', + 'version' => '3.3.0.0', + 'reference' => '40da9cc13ec349d9e4966ce18b5fbcd724ab10a4', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/service-contracts', 'aliases' => array(), 'dev_requirement' => false, ), 'symfony/string' => array( - 'pretty_version' => 'v6.2.8', - 'version' => '6.2.8.0', - 'reference' => '193e83bbd6617d6b2151c37fff10fa7168ebddef', + 'pretty_version' => 'v6.3.0', + 'version' => '6.3.0.0', + 'reference' => 'f2e190ee75ff0f5eced645ec0be5c66fac81f51f', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/string', 'aliases' => array(), 'dev_requirement' => false, ), 'symfony/var-dumper' => array( - 'pretty_version' => 'v6.2.10', - 'version' => '6.2.10.0', - 'reference' => '41a750a23412ca76fdbbf5096943b4134272c1ab', + 'pretty_version' => 'v6.3.1', + 'version' => '6.3.1.0', + 'reference' => 'c81268d6960ddb47af17391a27d222bd58cf0515', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/var-dumper', 'aliases' => array(), 'dev_requirement' => false, ), 'symfony/yaml' => array( - 'pretty_version' => 'v6.2.10', - 'version' => '6.2.10.0', - 'reference' => '61916f3861b1e9705b18cfde723921a71dd1559d', + 'pretty_version' => 'v6.3.0', + 'version' => '6.3.0.0', + 'reference' => 'a9a8337aa641ef2aa39c3e028f9107ec391e5927', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/yaml', 'aliases' => array(), diff --git a/redaxo/src/core/vendor/symfony/console/Application.php b/redaxo/src/core/vendor/symfony/console/Application.php index 41548a3e9d..b7aaa6a29e 100644 --- a/redaxo/src/core/vendor/symfony/console/Application.php +++ b/redaxo/src/core/vendor/symfony/console/Application.php @@ -105,11 +105,14 @@ public function __construct(string $name = 'UNKNOWN', string $version = 'UNKNOWN /** * @final */ - public function setDispatcher(EventDispatcherInterface $dispatcher) + public function setDispatcher(EventDispatcherInterface $dispatcher): void { $this->dispatcher = $dispatcher; } + /** + * @return void + */ public function setCommandLoader(CommandLoaderInterface $commandLoader) { $this->commandLoader = $commandLoader; @@ -118,12 +121,15 @@ public function setCommandLoader(CommandLoaderInterface $commandLoader) public function getSignalRegistry(): SignalRegistry { if (!$this->signalRegistry) { - throw new RuntimeException('Signals are not supported. Make sure that the `pcntl` extension is installed and that "pcntl_*" functions are not disabled by your php.ini\'s "disable_functions" directive.'); + throw new RuntimeException('Signals are not supported. Make sure that the "pcntl" extension is installed and that "pcntl_*" functions are not disabled by your php.ini\'s "disable_functions" directive.'); } return $this->signalRegistry; } + /** + * @return void + */ public function setSignalsToDispatchEvent(int ...$signalsToDispatchEvent) { $this->signalsToDispatchEvent = $signalsToDispatchEvent; @@ -317,10 +323,16 @@ public function doRun(InputInterface $input, OutputInterface $output) return $exitCode; } + /** + * @return void + */ public function reset() { } + /** + * @return void + */ public function setHelperSet(HelperSet $helperSet) { $this->helperSet = $helperSet; @@ -334,6 +346,9 @@ public function getHelperSet(): HelperSet return $this->helperSet ??= $this->getDefaultHelperSet(); } + /** + * @return void + */ public function setDefinition(InputDefinition $definition) { $this->definition = $definition; @@ -404,6 +419,8 @@ public function areExceptionsCaught(): bool /** * Sets whether to catch exceptions or not during commands execution. + * + * @return void */ public function setCatchExceptions(bool $boolean) { @@ -420,6 +437,8 @@ public function isAutoExitEnabled(): bool /** * Sets whether to automatically exit after a command execution or not. + * + * @return void */ public function setAutoExit(bool $boolean) { @@ -436,7 +455,9 @@ public function getName(): string /** * Sets the application name. - **/ + * + * @return void + */ public function setName(string $name) { $this->name = $name; @@ -452,6 +473,8 @@ public function getVersion(): string /** * Sets the application version. + * + * @return void */ public function setVersion(string $version) { @@ -490,6 +513,8 @@ public function register(string $name): Command * If a Command is not enabled it will not be added. * * @param Command[] $commands An array of commands + * + * @return void */ public function addCommands(array $commands) { @@ -687,9 +712,7 @@ public function find(string $name) if ($alternatives = $this->findAlternatives($name, $allCommands)) { // remove hidden commands - $alternatives = array_filter($alternatives, function ($name) { - return !$this->get($name)->isHidden(); - }); + $alternatives = array_filter($alternatives, fn ($name) => !$this->get($name)->isHidden()); if (1 == \count($alternatives)) { $message .= "\n\nDid you mean this?\n "; @@ -840,9 +863,7 @@ protected function doRenderThrowable(\Throwable $e, OutputInterface $output): vo } if (str_contains($message, "@anonymous\0")) { - $message = preg_replace_callback('/[a-zA-Z_\x7f-\xff][\\\\a-zA-Z0-9_\x7f-\xff]*+@anonymous\x00.*?\.php(?:0x?|:[0-9]++\$)[0-9a-fA-F]++/', function ($m) { - return class_exists($m[0], false) ? (get_parent_class($m[0]) ?: key(class_implements($m[0])) ?: 'class').'@anonymous' : $m[0]; - }, $message); + $message = preg_replace_callback('/[a-zA-Z_\x7f-\xff][\\\\a-zA-Z0-9_\x7f-\xff]*+@anonymous\x00.*?\.php(?:0x?|:[0-9]++\$)[0-9a-fA-F]++/', fn ($m) => class_exists($m[0], false) ? (get_parent_class($m[0]) ?: key(class_implements($m[0])) ?: 'class').'@anonymous' : $m[0], $message); } $width = $this->terminal->getWidth() ? $this->terminal->getWidth() - 1 : \PHP_INT_MAX; @@ -903,6 +924,8 @@ protected function doRenderThrowable(\Throwable $e, OutputInterface $output): vo /** * Configures the input and output instances based on the user arguments and options. + * + * @return void */ protected function configureIO(InputInterface $input, OutputInterface $output) { @@ -977,44 +1000,62 @@ protected function doRunCommand(Command $command, InputInterface $input, OutputI } } - if ($this->signalsToDispatchEvent) { - $commandSignals = $command instanceof SignalableCommandInterface ? $command->getSubscribedSignals() : []; - - if ($commandSignals || null !== $this->dispatcher) { - if (!$this->signalRegistry) { - throw new RuntimeException('Unable to subscribe to signal events. Make sure that the `pcntl` extension is installed and that "pcntl_*" functions are not disabled by your php.ini\'s "disable_functions" directive.'); - } + $commandSignals = $command instanceof SignalableCommandInterface ? $command->getSubscribedSignals() : []; + if ($commandSignals || $this->dispatcher && $this->signalsToDispatchEvent) { + if (!$this->signalRegistry) { + throw new RuntimeException('Unable to subscribe to signal events. Make sure that the "pcntl" extension is installed and that "pcntl_*" functions are not disabled by your php.ini\'s "disable_functions" directive.'); + } - if (Terminal::hasSttyAvailable()) { - $sttyMode = shell_exec('stty -g'); + if (Terminal::hasSttyAvailable()) { + $sttyMode = shell_exec('stty -g'); - foreach ([\SIGINT, \SIGTERM] as $signal) { - $this->signalRegistry->register($signal, static function () use ($sttyMode) { - shell_exec('stty '.$sttyMode); - }); - } + foreach ([\SIGINT, \SIGTERM] as $signal) { + $this->signalRegistry->register($signal, static fn () => shell_exec('stty '.$sttyMode)); } } - if (null !== $this->dispatcher) { + if ($this->dispatcher) { + // We register application signals, so that we can dispatch the event foreach ($this->signalsToDispatchEvent as $signal) { $event = new ConsoleSignalEvent($command, $input, $output, $signal); - $this->signalRegistry->register($signal, function ($signal, $hasNext) use ($event) { + $this->signalRegistry->register($signal, function ($signal) use ($event, $command, $commandSignals) { $this->dispatcher->dispatch($event, ConsoleEvents::SIGNAL); - - // No more handlers, we try to simulate PHP default behavior - if (!$hasNext) { - if (!\in_array($signal, [\SIGUSR1, \SIGUSR2], true)) { - exit(0); + $exitCode = $event->getExitCode(); + + // If the command is signalable, we call the handleSignal() method + if (\in_array($signal, $commandSignals, true)) { + $exitCode = $command->handleSignal($signal, $exitCode); + // BC layer for Symfony <= 5 + if (null === $exitCode) { + trigger_deprecation('symfony/console', '6.3', 'Not returning an exit code from "%s::handleSignal()" is deprecated, return "false" to keep the command running or "0" to exit successfully.', get_debug_type($command)); + $exitCode = 0; } } + + if (false !== $exitCode) { + exit($exitCode); + } }); } + + // then we register command signals, but not if already handled after the dispatcher + $commandSignals = array_diff($commandSignals, $this->signalsToDispatchEvent); } foreach ($commandSignals as $signal) { - $this->signalRegistry->register($signal, [$command, 'handleSignal']); + $this->signalRegistry->register($signal, function (int $signal) use ($command): void { + $exitCode = $command->handleSignal($signal); + // BC layer for Symfony <= 5 + if (null === $exitCode) { + trigger_deprecation('symfony/console', '6.3', 'Not returning an exit code from "%s::handleSignal()" is deprecated, return "false" to keep the command running or "0" to exit successfully.', get_debug_type($command)); + $exitCode = 0; + } + + if (false !== $exitCode) { + exit($exitCode); + } + }); } } @@ -1170,7 +1211,7 @@ private function findAlternatives(string $name, iterable $collection): array } } - $alternatives = array_filter($alternatives, function ($lev) use ($threshold) { return $lev < 2 * $threshold; }); + $alternatives = array_filter($alternatives, fn ($lev) => $lev < 2 * $threshold); ksort($alternatives, \SORT_NATURAL | \SORT_FLAG_CASE); return array_keys($alternatives); @@ -1261,7 +1302,7 @@ private function extractAllNamespaces(string $name): array return $namespaces; } - private function init() + private function init(): void { if ($this->initialized) { return; diff --git a/redaxo/src/core/vendor/symfony/console/Command/Command.php b/redaxo/src/core/vendor/symfony/console/Command/Command.php index 1e3c1a5a2b..704b112d1a 100644 --- a/redaxo/src/core/vendor/symfony/console/Command/Command.php +++ b/redaxo/src/core/vendor/symfony/console/Command/Command.php @@ -141,12 +141,17 @@ public function __construct(string $name = null) * Ignores validation errors. * * This is mainly useful for the help command. + * + * @return void */ public function ignoreValidationErrors() { $this->ignoreValidationErrors = true; } + /** + * @return void + */ public function setApplication(Application $application = null) { if (1 > \func_num_args()) { @@ -162,6 +167,9 @@ public function setApplication(Application $application = null) $this->fullDefinition = null; } + /** + * @return void + */ public function setHelperSet(HelperSet $helperSet) { $this->helperSet = $helperSet; @@ -198,6 +206,8 @@ public function isEnabled() /** * Configures the current command. + * + * @return void */ protected function configure() { @@ -228,6 +238,8 @@ protected function execute(InputInterface $input, OutputInterface $output) * This method is executed before the InputDefinition is validated. * This means that this is the only place where the command can * interactively ask for values of missing required arguments. + * + * @return void */ protected function interact(InputInterface $input, OutputInterface $output) { @@ -242,6 +254,8 @@ protected function interact(InputInterface $input, OutputInterface $output) * * @see InputInterface::bind() * @see InputInterface::validate() + * + * @return void */ protected function initialize(InputInterface $input, OutputInterface $output) { @@ -378,7 +392,7 @@ public function setCode(callable $code): static * * @internal */ - public function mergeApplicationDefinition(bool $mergeArgs = true) + public function mergeApplicationDefinition(bool $mergeArgs = true): void { if (null === $this->application) { return; @@ -702,7 +716,7 @@ public function getHelper(string $name): mixed * * @throws InvalidArgumentException When the name is invalid */ - private function validateName(string $name) + private function validateName(string $name): void { if (!preg_match('/^[^\:]++(\:[^\:]++)*$/', $name)) { throw new InvalidArgumentException(sprintf('Command name "%s" is invalid.', $name)); diff --git a/redaxo/src/core/vendor/symfony/console/Command/CompleteCommand.php b/redaxo/src/core/vendor/symfony/console/Command/CompleteCommand.php index e65b334ce8..058578d8b4 100644 --- a/redaxo/src/core/vendor/symfony/console/Command/CompleteCommand.php +++ b/redaxo/src/core/vendor/symfony/console/Command/CompleteCommand.php @@ -74,7 +74,7 @@ protected function configure(): void ; } - protected function initialize(InputInterface $input, OutputInterface $output) + protected function initialize(InputInterface $input, OutputInterface $output): void { $this->isDebug = filter_var(getenv('SYMFONY_COMPLETION_DEBUG'), \FILTER_VALIDATE_BOOL); } @@ -134,12 +134,12 @@ protected function execute(InputInterface $input, OutputInterface $output): int $completionInput->bind($command->getDefinition()); if (CompletionInput::TYPE_OPTION_NAME === $completionInput->getCompletionType()) { - $this->log(' Completing option names for the '.\get_class($command instanceof LazyCommand ? $command->getCommand() : $command).' command.'); + $this->log(' Completing option names for the '.($command instanceof LazyCommand ? $command->getCommand() : $command)::class.' command.'); $suggestions->suggestOptions($command->getDefinition()->getOptions()); } else { $this->log([ - ' Completing using the '.\get_class($command instanceof LazyCommand ? $command->getCommand() : $command).' class.', + ' Completing using the '.($command instanceof LazyCommand ? $command->getCommand() : $command)::class.' class.', ' Completing '.$completionInput->getCompletionType().' for '.$completionInput->getCompletionName().'', ]); if (null !== $compval = $completionInput->getCompletionValue()) { @@ -155,7 +155,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $this->log('Suggestions:'); if ($options = $suggestions->getOptionSuggestions()) { - $this->log(' --'.implode(' --', array_map(function ($o) { return $o->getName(); }, $options))); + $this->log(' --'.implode(' --', array_map(fn ($o) => $o->getName(), $options))); } elseif ($values = $suggestions->getValueSuggestions()) { $this->log(' '.implode(' ', $values)); } else { @@ -173,10 +173,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int throw $e; } - return self::FAILURE; + return 2; } - return self::SUCCESS; + return 0; } private function createCompletionInput(InputInterface $input): CompletionInput diff --git a/redaxo/src/core/vendor/symfony/console/Command/DumpCompletionCommand.php b/redaxo/src/core/vendor/symfony/console/Command/DumpCompletionCommand.php index 10280f73ab..51b613a140 100644 --- a/redaxo/src/core/vendor/symfony/console/Command/DumpCompletionCommand.php +++ b/redaxo/src/core/vendor/symfony/console/Command/DumpCompletionCommand.php @@ -39,7 +39,7 @@ final class DumpCompletionCommand extends Command private array $supportedShells; - protected function configure() + protected function configure(): void { $fullCommand = $_SERVER['PHP_SELF']; $commandName = basename($fullCommand); @@ -96,7 +96,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int if ($input->getOption('debug')) { $this->tailDebugLog($commandName, $output); - return self::SUCCESS; + return 0; } $shell = $input->getArgument('shell') ?? self::guessShell(); @@ -113,12 +113,12 @@ protected function execute(InputInterface $input, OutputInterface $output): int $output->writeln(sprintf('Shell not detected, Symfony shell completion only supports "%s").', implode('", "', $supportedShells))); } - return self::INVALID; + return 2; } $output->write(str_replace(['{{ COMMAND_NAME }}', '{{ VERSION }}'], [$commandName, CompleteCommand::COMPLETION_API_VERSION], file_get_contents($completionFile))); - return self::SUCCESS; + return 0; } private static function guessShell(): string diff --git a/redaxo/src/core/vendor/symfony/console/Command/HelpCommand.php b/redaxo/src/core/vendor/symfony/console/Command/HelpCommand.php index d4134e170b..e6447b0506 100644 --- a/redaxo/src/core/vendor/symfony/console/Command/HelpCommand.php +++ b/redaxo/src/core/vendor/symfony/console/Command/HelpCommand.php @@ -27,6 +27,9 @@ class HelpCommand extends Command { private Command $command; + /** + * @return void + */ protected function configure() { $this->ignoreValidationErrors(); @@ -34,12 +37,8 @@ protected function configure() $this ->setName('help') ->setDefinition([ - new InputArgument('command_name', InputArgument::OPTIONAL, 'The command name', 'help', function () { - return array_keys((new ApplicationDescription($this->getApplication()))->getCommands()); - }), - new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt', function () { - return (new DescriptorHelper())->getFormats(); - }), + new InputArgument('command_name', InputArgument::OPTIONAL, 'The command name', 'help', fn () => array_keys((new ApplicationDescription($this->getApplication()))->getCommands())), + new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt', fn () => (new DescriptorHelper())->getFormats()), new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command help'), ]) ->setDescription('Display help for a command') @@ -58,6 +57,9 @@ protected function configure() ; } + /** + * @return void + */ public function setCommand(Command $command) { $this->command = $command; diff --git a/redaxo/src/core/vendor/symfony/console/Command/ListCommand.php b/redaxo/src/core/vendor/symfony/console/Command/ListCommand.php index cab88b4392..5850c3d7b8 100644 --- a/redaxo/src/core/vendor/symfony/console/Command/ListCommand.php +++ b/redaxo/src/core/vendor/symfony/console/Command/ListCommand.php @@ -25,18 +25,17 @@ */ class ListCommand extends Command { + /** + * @return void + */ protected function configure() { $this ->setName('list') ->setDefinition([ - new InputArgument('namespace', InputArgument::OPTIONAL, 'The namespace name', null, function () { - return array_keys((new ApplicationDescription($this->getApplication()))->getNamespaces()); - }), + new InputArgument('namespace', InputArgument::OPTIONAL, 'The namespace name', null, fn () => array_keys((new ApplicationDescription($this->getApplication()))->getNamespaces())), new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command list'), - new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt', function () { - return (new DescriptorHelper())->getFormats(); - }), + new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt', fn () => (new DescriptorHelper())->getFormats()), new InputOption('short', null, InputOption::VALUE_NONE, 'To skip describing commands\' arguments'), ]) ->setDescription('List commands') diff --git a/redaxo/src/core/vendor/symfony/console/Command/LockableTrait.php b/redaxo/src/core/vendor/symfony/console/Command/LockableTrait.php index 67923a9e81..c1006a65c0 100644 --- a/redaxo/src/core/vendor/symfony/console/Command/LockableTrait.php +++ b/redaxo/src/core/vendor/symfony/console/Command/LockableTrait.php @@ -32,7 +32,7 @@ trait LockableTrait private function lock(string $name = null, bool $blocking = false): bool { if (!class_exists(SemaphoreStore::class)) { - throw new LogicException('To enable the locking feature you must install the symfony/lock component.'); + throw new LogicException('To enable the locking feature you must install the symfony/lock component. Try running "composer require symfony/lock".'); } if (null !== $this->lock) { @@ -58,7 +58,7 @@ private function lock(string $name = null, bool $blocking = false): bool /** * Releases the command lock if there is one. */ - private function release() + private function release(): void { if ($this->lock) { $this->lock->release(); diff --git a/redaxo/src/core/vendor/symfony/console/Command/SignalableCommandInterface.php b/redaxo/src/core/vendor/symfony/console/Command/SignalableCommandInterface.php index d439728b65..4d0876003d 100644 --- a/redaxo/src/core/vendor/symfony/console/Command/SignalableCommandInterface.php +++ b/redaxo/src/core/vendor/symfony/console/Command/SignalableCommandInterface.php @@ -25,6 +25,10 @@ public function getSubscribedSignals(): array; /** * The method will be called when the application is signaled. + * + * @param int|false $previousExitCode + + * @return int|false The exit code to return or false to continue the normal execution */ - public function handleSignal(int $signal): void; + public function handleSignal(int $signal, /* int|false $previousExitCode = 0 */); } diff --git a/redaxo/src/core/vendor/symfony/console/Completion/CompletionInput.php b/redaxo/src/core/vendor/symfony/console/Completion/CompletionInput.php index 3ef8db5d1e..800b7235a9 100644 --- a/redaxo/src/core/vendor/symfony/console/Completion/CompletionInput.php +++ b/redaxo/src/core/vendor/symfony/console/Completion/CompletionInput.php @@ -34,7 +34,7 @@ final class CompletionInput extends ArgvInput private $tokens; private $currentIndex; private $completionType; - private $completionName = null; + private $completionName; private $completionValue = ''; /** diff --git a/redaxo/src/core/vendor/symfony/console/DependencyInjection/AddConsoleCommandPass.php b/redaxo/src/core/vendor/symfony/console/DependencyInjection/AddConsoleCommandPass.php index 62c80c3b06..27705ddb63 100644 --- a/redaxo/src/core/vendor/symfony/console/DependencyInjection/AddConsoleCommandPass.php +++ b/redaxo/src/core/vendor/symfony/console/DependencyInjection/AddConsoleCommandPass.php @@ -29,6 +29,9 @@ */ class AddConsoleCommandPass implements CompilerPassInterface { + /** + * @return void + */ public function process(ContainerBuilder $container) { $commandServices = $container->findTaggedServiceIds('console.command', true); diff --git a/redaxo/src/core/vendor/symfony/console/Descriptor/ApplicationDescription.php b/redaxo/src/core/vendor/symfony/console/Descriptor/ApplicationDescription.php index 2158339ec4..f8ed180451 100644 --- a/redaxo/src/core/vendor/symfony/console/Descriptor/ApplicationDescription.php +++ b/redaxo/src/core/vendor/symfony/console/Descriptor/ApplicationDescription.php @@ -79,7 +79,7 @@ public function getCommand(string $name): Command return $this->commands[$name] ?? $this->aliases[$name]; } - private function inspectApplication() + private function inspectApplication(): void { $this->commands = []; $this->namespaces = []; diff --git a/redaxo/src/core/vendor/symfony/console/Descriptor/Descriptor.php b/redaxo/src/core/vendor/symfony/console/Descriptor/Descriptor.php index 1476f57557..7b2509c601 100644 --- a/redaxo/src/core/vendor/symfony/console/Descriptor/Descriptor.php +++ b/redaxo/src/core/vendor/symfony/console/Descriptor/Descriptor.php @@ -26,12 +26,9 @@ */ abstract class Descriptor implements DescriptorInterface { - /** - * @var OutputInterface - */ - protected $output; + protected OutputInterface $output; - public function describe(OutputInterface $output, object $object, array $options = []) + public function describe(OutputInterface $output, object $object, array $options = []): void { $this->output = $output; @@ -45,10 +42,7 @@ public function describe(OutputInterface $output, object $object, array $options }; } - /** - * Writes content to output. - */ - protected function write(string $content, bool $decorated = false) + protected function write(string $content, bool $decorated = false): void { $this->output->write($content, false, $decorated ? OutputInterface::OUTPUT_NORMAL : OutputInterface::OUTPUT_RAW); } @@ -56,25 +50,25 @@ protected function write(string $content, bool $decorated = false) /** * Describes an InputArgument instance. */ - abstract protected function describeInputArgument(InputArgument $argument, array $options = []); + abstract protected function describeInputArgument(InputArgument $argument, array $options = []): void; /** * Describes an InputOption instance. */ - abstract protected function describeInputOption(InputOption $option, array $options = []); + abstract protected function describeInputOption(InputOption $option, array $options = []): void; /** * Describes an InputDefinition instance. */ - abstract protected function describeInputDefinition(InputDefinition $definition, array $options = []); + abstract protected function describeInputDefinition(InputDefinition $definition, array $options = []): void; /** * Describes a Command instance. */ - abstract protected function describeCommand(Command $command, array $options = []); + abstract protected function describeCommand(Command $command, array $options = []): void; /** * Describes an Application instance. */ - abstract protected function describeApplication(Application $application, array $options = []); + abstract protected function describeApplication(Application $application, array $options = []): void; } diff --git a/redaxo/src/core/vendor/symfony/console/Descriptor/DescriptorInterface.php b/redaxo/src/core/vendor/symfony/console/Descriptor/DescriptorInterface.php index ebea30367e..ab468a2562 100644 --- a/redaxo/src/core/vendor/symfony/console/Descriptor/DescriptorInterface.php +++ b/redaxo/src/core/vendor/symfony/console/Descriptor/DescriptorInterface.php @@ -20,5 +20,8 @@ */ interface DescriptorInterface { + /** + * @return void + */ public function describe(OutputInterface $output, object $object, array $options = []); } diff --git a/redaxo/src/core/vendor/symfony/console/Descriptor/JsonDescriptor.php b/redaxo/src/core/vendor/symfony/console/Descriptor/JsonDescriptor.php index 6f79a17a9d..9563037096 100644 --- a/redaxo/src/core/vendor/symfony/console/Descriptor/JsonDescriptor.php +++ b/redaxo/src/core/vendor/symfony/console/Descriptor/JsonDescriptor.php @@ -26,12 +26,12 @@ */ class JsonDescriptor extends Descriptor { - protected function describeInputArgument(InputArgument $argument, array $options = []) + protected function describeInputArgument(InputArgument $argument, array $options = []): void { $this->writeData($this->getInputArgumentData($argument), $options); } - protected function describeInputOption(InputOption $option, array $options = []) + protected function describeInputOption(InputOption $option, array $options = []): void { $this->writeData($this->getInputOptionData($option), $options); if ($option->isNegatable()) { @@ -39,17 +39,17 @@ protected function describeInputOption(InputOption $option, array $options = []) } } - protected function describeInputDefinition(InputDefinition $definition, array $options = []) + protected function describeInputDefinition(InputDefinition $definition, array $options = []): void { $this->writeData($this->getInputDefinitionData($definition), $options); } - protected function describeCommand(Command $command, array $options = []) + protected function describeCommand(Command $command, array $options = []): void { $this->writeData($this->getCommandData($command, $options['short'] ?? false), $options); } - protected function describeApplication(Application $application, array $options = []) + protected function describeApplication(Application $application, array $options = []): void { $describedNamespace = $options['namespace'] ?? null; $description = new ApplicationDescription($application, $describedNamespace, true); @@ -81,7 +81,7 @@ protected function describeApplication(Application $application, array $options /** * Writes data as json. */ - private function writeData(array $data, array $options) + private function writeData(array $data, array $options): void { $flags = $options['json_encoding'] ?? 0; diff --git a/redaxo/src/core/vendor/symfony/console/Descriptor/MarkdownDescriptor.php b/redaxo/src/core/vendor/symfony/console/Descriptor/MarkdownDescriptor.php index fbd9c53461..b3f16ee904 100644 --- a/redaxo/src/core/vendor/symfony/console/Descriptor/MarkdownDescriptor.php +++ b/redaxo/src/core/vendor/symfony/console/Descriptor/MarkdownDescriptor.php @@ -28,7 +28,7 @@ */ class MarkdownDescriptor extends Descriptor { - public function describe(OutputInterface $output, object $object, array $options = []) + public function describe(OutputInterface $output, object $object, array $options = []): void { $decorated = $output->isDecorated(); $output->setDecorated(false); @@ -38,12 +38,12 @@ public function describe(OutputInterface $output, object $object, array $options $output->setDecorated($decorated); } - protected function write(string $content, bool $decorated = true) + protected function write(string $content, bool $decorated = true): void { parent::write($content, $decorated); } - protected function describeInputArgument(InputArgument $argument, array $options = []) + protected function describeInputArgument(InputArgument $argument, array $options = []): void { $this->write( '#### `'.($argument->getName() ?: '')."`\n\n" @@ -54,7 +54,7 @@ protected function describeInputArgument(InputArgument $argument, array $options ); } - protected function describeInputOption(InputOption $option, array $options = []) + protected function describeInputOption(InputOption $option, array $options = []): void { $name = '--'.$option->getName(); if ($option->isNegatable()) { @@ -75,15 +75,13 @@ protected function describeInputOption(InputOption $option, array $options = []) ); } - protected function describeInputDefinition(InputDefinition $definition, array $options = []) + protected function describeInputDefinition(InputDefinition $definition, array $options = []): void { if ($showArguments = \count($definition->getArguments()) > 0) { $this->write('### Arguments'); foreach ($definition->getArguments() as $argument) { $this->write("\n\n"); - if (null !== $describeInputArgument = $this->describeInputArgument($argument)) { - $this->write($describeInputArgument); - } + $this->describeInputArgument($argument); } } @@ -95,14 +93,12 @@ protected function describeInputDefinition(InputDefinition $definition, array $o $this->write('### Options'); foreach ($definition->getOptions() as $option) { $this->write("\n\n"); - if (null !== $describeInputOption = $this->describeInputOption($option)) { - $this->write($describeInputOption); - } + $this->describeInputOption($option); } } } - protected function describeCommand(Command $command, array $options = []) + protected function describeCommand(Command $command, array $options = []): void { if ($options['short'] ?? false) { $this->write( @@ -110,9 +106,7 @@ protected function describeCommand(Command $command, array $options = []) .str_repeat('-', Helper::width($command->getName()) + 2)."\n\n" .($command->getDescription() ? $command->getDescription()."\n\n" : '') .'### Usage'."\n\n" - .array_reduce($command->getAliases(), function ($carry, $usage) { - return $carry.'* `'.$usage.'`'."\n"; - }) + .array_reduce($command->getAliases(), fn ($carry, $usage) => $carry.'* `'.$usage.'`'."\n") ); return; @@ -125,9 +119,7 @@ protected function describeCommand(Command $command, array $options = []) .str_repeat('-', Helper::width($command->getName()) + 2)."\n\n" .($command->getDescription() ? $command->getDescription()."\n\n" : '') .'### Usage'."\n\n" - .array_reduce(array_merge([$command->getSynopsis()], $command->getAliases(), $command->getUsages()), function ($carry, $usage) { - return $carry.'* `'.$usage.'`'."\n"; - }) + .array_reduce(array_merge([$command->getSynopsis()], $command->getAliases(), $command->getUsages()), fn ($carry, $usage) => $carry.'* `'.$usage.'`'."\n") ); if ($help = $command->getProcessedHelp()) { @@ -142,7 +134,7 @@ protected function describeCommand(Command $command, array $options = []) } } - protected function describeApplication(Application $application, array $options = []) + protected function describeApplication(Application $application, array $options = []): void { $describedNamespace = $options['namespace'] ?? null; $description = new ApplicationDescription($application, $describedNamespace); @@ -157,16 +149,12 @@ protected function describeApplication(Application $application, array $options } $this->write("\n\n"); - $this->write(implode("\n", array_map(function ($commandName) use ($description) { - return sprintf('* [`%s`](#%s)', $commandName, str_replace(':', '', $description->getCommand($commandName)->getName())); - }, $namespace['commands']))); + $this->write(implode("\n", array_map(fn ($commandName) => sprintf('* [`%s`](#%s)', $commandName, str_replace(':', '', $description->getCommand($commandName)->getName())), $namespace['commands']))); } foreach ($description->getCommands() as $command) { $this->write("\n\n"); - if (null !== $describeCommand = $this->describeCommand($command, $options)) { - $this->write($describeCommand); - } + $this->describeCommand($command, $options); } } diff --git a/redaxo/src/core/vendor/symfony/console/Descriptor/ReStructuredTextDescriptor.php b/redaxo/src/core/vendor/symfony/console/Descriptor/ReStructuredTextDescriptor.php new file mode 100644 index 0000000000..d4423fd348 --- /dev/null +++ b/redaxo/src/core/vendor/symfony/console/Descriptor/ReStructuredTextDescriptor.php @@ -0,0 +1,272 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Console\Descriptor; + +use Symfony\Component\Console\Application; +use Symfony\Component\Console\Command\Command; +use Symfony\Component\Console\Helper\Helper; +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputDefinition; +use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\String\UnicodeString; + +class ReStructuredTextDescriptor extends Descriptor +{ + //

+ private string $partChar = '='; + //

+ private string $chapterChar = '-'; + //

+ private string $sectionChar = '~'; + //

+ private string $subsectionChar = '.'; + //

+ private string $subsubsectionChar = '^'; + //
+ private string $paragraphsChar = '"'; + + private array $visibleNamespaces = []; + + public function describe(OutputInterface $output, object $object, array $options = []): void + { + $decorated = $output->isDecorated(); + $output->setDecorated(false); + + parent::describe($output, $object, $options); + + $output->setDecorated($decorated); + } + + /** + * Override parent method to set $decorated = true. + */ + protected function write(string $content, bool $decorated = true): void + { + parent::write($content, $decorated); + } + + protected function describeInputArgument(InputArgument $argument, array $options = []): void + { + $this->write( + $argument->getName() ?: ''."\n".str_repeat($this->paragraphsChar, Helper::width($argument->getName()))."\n\n" + .($argument->getDescription() ? preg_replace('/\s*[\r\n]\s*/', "\n", $argument->getDescription())."\n\n" : '') + .'- **Is required**: '.($argument->isRequired() ? 'yes' : 'no')."\n" + .'- **Is array**: '.($argument->isArray() ? 'yes' : 'no')."\n" + .'- **Default**: ``'.str_replace("\n", '', var_export($argument->getDefault(), true)).'``' + ); + } + + protected function describeInputOption(InputOption $option, array $options = []): void + { + $name = '\-\-'.$option->getName(); + if ($option->isNegatable()) { + $name .= '|\-\-no-'.$option->getName(); + } + if ($option->getShortcut()) { + $name .= '|-'.str_replace('|', '|-', $option->getShortcut()); + } + + $optionDescription = $option->getDescription() ? preg_replace('/\s*[\r\n]\s*/', "\n\n", $option->getDescription())."\n\n" : ''; + $optionDescription = (new UnicodeString($optionDescription))->ascii(); + $this->write( + $name."\n".str_repeat($this->paragraphsChar, Helper::width($name))."\n\n" + .$optionDescription + .'- **Accept value**: '.($option->acceptValue() ? 'yes' : 'no')."\n" + .'- **Is value required**: '.($option->isValueRequired() ? 'yes' : 'no')."\n" + .'- **Is multiple**: '.($option->isArray() ? 'yes' : 'no')."\n" + .'- **Is negatable**: '.($option->isNegatable() ? 'yes' : 'no')."\n" + .'- **Default**: ``'.str_replace("\n", '', var_export($option->getDefault(), true)).'``'."\n" + ); + } + + protected function describeInputDefinition(InputDefinition $definition, array $options = []): void + { + if ($showArguments = ((bool) $definition->getArguments())) { + $this->write("Arguments\n".str_repeat($this->subsubsectionChar, 9))."\n\n"; + foreach ($definition->getArguments() as $argument) { + $this->write("\n\n"); + $this->describeInputArgument($argument); + } + } + + if ($nonDefaultOptions = $this->getNonDefaultOptions($definition)) { + if ($showArguments) { + $this->write("\n\n"); + } + + $this->write("Options\n".str_repeat($this->subsubsectionChar, 7)."\n\n"); + foreach ($nonDefaultOptions as $option) { + $this->describeInputOption($option); + $this->write("\n"); + } + } + } + + protected function describeCommand(Command $command, array $options = []): void + { + if ($options['short'] ?? false) { + $this->write( + '``'.$command->getName()."``\n" + .str_repeat($this->subsectionChar, Helper::width($command->getName()))."\n\n" + .($command->getDescription() ? $command->getDescription()."\n\n" : '') + ."Usage\n".str_repeat($this->paragraphsChar, 5)."\n\n" + .array_reduce($command->getAliases(), static fn ($carry, $usage) => $carry.'- ``'.$usage.'``'."\n") + ); + + return; + } + + $command->mergeApplicationDefinition(false); + + foreach ($command->getAliases() as $alias) { + $this->write('.. _'.$alias.":\n\n"); + } + $this->write( + $command->getName()."\n" + .str_repeat($this->subsectionChar, Helper::width($command->getName()))."\n\n" + .($command->getDescription() ? $command->getDescription()."\n\n" : '') + ."Usage\n".str_repeat($this->subsubsectionChar, 5)."\n\n" + .array_reduce(array_merge([$command->getSynopsis()], $command->getAliases(), $command->getUsages()), static fn ($carry, $usage) => $carry.'- ``'.$usage.'``'."\n") + ); + + if ($help = $command->getProcessedHelp()) { + $this->write("\n"); + $this->write($help); + } + + $definition = $command->getDefinition(); + if ($definition->getOptions() || $definition->getArguments()) { + $this->write("\n\n"); + $this->describeInputDefinition($definition); + } + } + + protected function describeApplication(Application $application, array $options = []): void + { + $description = new ApplicationDescription($application, $options['namespace'] ?? null); + $title = $this->getApplicationTitle($application); + + $this->write($title."\n".str_repeat($this->partChar, Helper::width($title))); + $this->createTableOfContents($description, $application); + $this->describeCommands($application, $options); + } + + private function getApplicationTitle(Application $application): string + { + if ('UNKNOWN' === $application->getName()) { + return 'Console Tool'; + } + if ('UNKNOWN' !== $application->getVersion()) { + return sprintf('%s %s', $application->getName(), $application->getVersion()); + } + + return $application->getName(); + } + + private function describeCommands($application, array $options): void + { + $title = 'Commands'; + $this->write("\n\n$title\n".str_repeat($this->chapterChar, Helper::width($title))."\n\n"); + foreach ($this->visibleNamespaces as $namespace) { + if ('_global' === $namespace) { + $commands = $application->all(''); + $this->write('Global'."\n".str_repeat($this->sectionChar, Helper::width('Global'))."\n\n"); + } else { + $commands = $application->all($namespace); + $this->write($namespace."\n".str_repeat($this->sectionChar, Helper::width($namespace))."\n\n"); + } + + foreach ($this->removeAliasesAndHiddenCommands($commands) as $command) { + $this->describeCommand($command, $options); + $this->write("\n\n"); + } + } + } + + private function createTableOfContents(ApplicationDescription $description, Application $application): void + { + $this->setVisibleNamespaces($description); + $chapterTitle = 'Table of Contents'; + $this->write("\n\n$chapterTitle\n".str_repeat($this->chapterChar, Helper::width($chapterTitle))."\n\n"); + foreach ($this->visibleNamespaces as $namespace) { + if ('_global' === $namespace) { + $commands = $application->all(''); + } else { + $commands = $application->all($namespace); + $this->write("\n\n"); + $this->write($namespace."\n".str_repeat($this->sectionChar, Helper::width($namespace))."\n\n"); + } + $commands = $this->removeAliasesAndHiddenCommands($commands); + + $this->write("\n\n"); + $this->write(implode("\n", array_map(static fn ($commandName) => sprintf('- `%s`_', $commandName), array_keys($commands)))); + } + } + + private function getNonDefaultOptions(InputDefinition $definition): array + { + $globalOptions = [ + 'help', + 'quiet', + 'verbose', + 'version', + 'ansi', + 'no-interaction', + ]; + $nonDefaultOptions = []; + foreach ($definition->getOptions() as $option) { + // Skip global options. + if (!\in_array($option->getName(), $globalOptions)) { + $nonDefaultOptions[] = $option; + } + } + + return $nonDefaultOptions; + } + + private function setVisibleNamespaces(ApplicationDescription $description): void + { + $commands = $description->getCommands(); + foreach ($description->getNamespaces() as $namespace) { + try { + $namespaceCommands = $namespace['commands']; + foreach ($namespaceCommands as $key => $commandName) { + if (!\array_key_exists($commandName, $commands)) { + // If the array key does not exist, then this is an alias. + unset($namespaceCommands[$key]); + } elseif ($commands[$commandName]->isHidden()) { + unset($namespaceCommands[$key]); + } + } + if (!$namespaceCommands) { + // If the namespace contained only aliases or hidden commands, skip the namespace. + continue; + } + } catch (\Exception) { + } + $this->visibleNamespaces[] = $namespace['id']; + } + } + + private function removeAliasesAndHiddenCommands(array $commands): array + { + foreach ($commands as $key => $command) { + if ($command->isHidden() || \in_array($key, $command->getAliases(), true)) { + unset($commands[$key]); + } + } + unset($commands['completion']); + + return $commands; + } +} diff --git a/redaxo/src/core/vendor/symfony/console/Descriptor/TextDescriptor.php b/redaxo/src/core/vendor/symfony/console/Descriptor/TextDescriptor.php index 48a0b42af9..d04d10238b 100644 --- a/redaxo/src/core/vendor/symfony/console/Descriptor/TextDescriptor.php +++ b/redaxo/src/core/vendor/symfony/console/Descriptor/TextDescriptor.php @@ -28,7 +28,7 @@ */ class TextDescriptor extends Descriptor { - protected function describeInputArgument(InputArgument $argument, array $options = []) + protected function describeInputArgument(InputArgument $argument, array $options = []): void { if (null !== $argument->getDefault() && (!\is_array($argument->getDefault()) || \count($argument->getDefault()))) { $default = sprintf(' [default: %s]', $this->formatDefaultValue($argument->getDefault())); @@ -48,7 +48,7 @@ protected function describeInputArgument(InputArgument $argument, array $options ), $options); } - protected function describeInputOption(InputOption $option, array $options = []) + protected function describeInputOption(InputOption $option, array $options = []): void { if ($option->acceptValue() && null !== $option->getDefault() && (!\is_array($option->getDefault()) || \count($option->getDefault()))) { $default = sprintf(' [default: %s]', $this->formatDefaultValue($option->getDefault())); @@ -83,7 +83,7 @@ protected function describeInputOption(InputOption $option, array $options = []) ), $options); } - protected function describeInputDefinition(InputDefinition $definition, array $options = []) + protected function describeInputDefinition(InputDefinition $definition, array $options = []): void { $totalWidth = $this->calculateTotalWidthForOptions($definition->getOptions()); foreach ($definition->getArguments() as $argument) { @@ -122,7 +122,7 @@ protected function describeInputDefinition(InputDefinition $definition, array $o } } - protected function describeCommand(Command $command, array $options = []) + protected function describeCommand(Command $command, array $options = []): void { $command->mergeApplicationDefinition(false); @@ -157,7 +157,7 @@ protected function describeCommand(Command $command, array $options = []) } } - protected function describeApplication(Application $application, array $options = []) + protected function describeApplication(Application $application, array $options = []): void { $describedNamespace = $options['namespace'] ?? null; $description = new ApplicationDescription($application, $describedNamespace); @@ -193,9 +193,7 @@ protected function describeApplication(Application $application, array $options } // calculate max. width based on available commands per namespace - $width = $this->getColumnWidth(array_merge(...array_values(array_map(function ($namespace) use ($commands) { - return array_intersect($namespace['commands'], array_keys($commands)); - }, array_values($namespaces))))); + $width = $this->getColumnWidth(array_merge(...array_values(array_map(fn ($namespace) => array_intersect($namespace['commands'], array_keys($commands)), array_values($namespaces))))); if ($describedNamespace) { $this->writeText(sprintf('Available commands for the "%s" namespace:', $describedNamespace), $options); @@ -204,9 +202,7 @@ protected function describeApplication(Application $application, array $options } foreach ($namespaces as $namespace) { - $namespace['commands'] = array_filter($namespace['commands'], function ($name) use ($commands) { - return isset($commands[$name]); - }); + $namespace['commands'] = array_filter($namespace['commands'], fn ($name) => isset($commands[$name])); if (!$namespace['commands']) { continue; @@ -230,7 +226,7 @@ protected function describeApplication(Application $application, array $options } } - private function writeText(string $content, array $options = []) + private function writeText(string $content, array $options = []): void { $this->write( isset($options['raw_text']) && $options['raw_text'] ? strip_tags($content) : $content, diff --git a/redaxo/src/core/vendor/symfony/console/Descriptor/XmlDescriptor.php b/redaxo/src/core/vendor/symfony/console/Descriptor/XmlDescriptor.php index f4643a9ac7..72580fd985 100644 --- a/redaxo/src/core/vendor/symfony/console/Descriptor/XmlDescriptor.php +++ b/redaxo/src/core/vendor/symfony/console/Descriptor/XmlDescriptor.php @@ -120,27 +120,27 @@ public function getApplicationDocument(Application $application, string $namespa return $dom; } - protected function describeInputArgument(InputArgument $argument, array $options = []) + protected function describeInputArgument(InputArgument $argument, array $options = []): void { $this->writeDocument($this->getInputArgumentDocument($argument)); } - protected function describeInputOption(InputOption $option, array $options = []) + protected function describeInputOption(InputOption $option, array $options = []): void { $this->writeDocument($this->getInputOptionDocument($option)); } - protected function describeInputDefinition(InputDefinition $definition, array $options = []) + protected function describeInputDefinition(InputDefinition $definition, array $options = []): void { $this->writeDocument($this->getInputDefinitionDocument($definition)); } - protected function describeCommand(Command $command, array $options = []) + protected function describeCommand(Command $command, array $options = []): void { $this->writeDocument($this->getCommandDocument($command, $options['short'] ?? false)); } - protected function describeApplication(Application $application, array $options = []) + protected function describeApplication(Application $application, array $options = []): void { $this->writeDocument($this->getApplicationDocument($application, $options['namespace'] ?? null, $options['short'] ?? false)); } @@ -148,7 +148,7 @@ protected function describeApplication(Application $application, array $options /** * Appends document children to parent node. */ - private function appendDocument(\DOMNode $parentNode, \DOMNode $importedParent) + private function appendDocument(\DOMNode $parentNode, \DOMNode $importedParent): void { foreach ($importedParent->childNodes as $childNode) { $parentNode->appendChild($parentNode->ownerDocument->importNode($childNode, true)); @@ -158,7 +158,7 @@ private function appendDocument(\DOMNode $parentNode, \DOMNode $importedParent) /** * Writes DOM document. */ - private function writeDocument(\DOMDocument $dom) + private function writeDocument(\DOMDocument $dom): void { $dom->formatOutput = true; $this->write($dom->saveXML()); diff --git a/redaxo/src/core/vendor/symfony/console/Event/ConsoleSignalEvent.php b/redaxo/src/core/vendor/symfony/console/Event/ConsoleSignalEvent.php index 766af691aa..95af1f915d 100644 --- a/redaxo/src/core/vendor/symfony/console/Event/ConsoleSignalEvent.php +++ b/redaxo/src/core/vendor/symfony/console/Event/ConsoleSignalEvent.php @@ -21,15 +21,36 @@ final class ConsoleSignalEvent extends ConsoleEvent { private int $handlingSignal; + private int|false $exitCode; - public function __construct(Command $command, InputInterface $input, OutputInterface $output, int $handlingSignal) + public function __construct(Command $command, InputInterface $input, OutputInterface $output, int $handlingSignal, int|false $exitCode = 0) { parent::__construct($command, $input, $output); $this->handlingSignal = $handlingSignal; + $this->exitCode = $exitCode; } public function getHandlingSignal(): int { return $this->handlingSignal; } + + public function setExitCode(int $exitCode): void + { + if ($exitCode < 0 || $exitCode > 255) { + throw new \InvalidArgumentException('Exit code must be between 0 and 255.'); + } + + $this->exitCode = $exitCode; + } + + public function abortExit(): void + { + $this->exitCode = false; + } + + public function getExitCode(): int|false + { + return $this->exitCode; + } } diff --git a/redaxo/src/core/vendor/symfony/console/EventListener/ErrorListener.php b/redaxo/src/core/vendor/symfony/console/EventListener/ErrorListener.php index 773a13a1c0..9925a5f746 100644 --- a/redaxo/src/core/vendor/symfony/console/EventListener/ErrorListener.php +++ b/redaxo/src/core/vendor/symfony/console/EventListener/ErrorListener.php @@ -31,6 +31,9 @@ public function __construct(LoggerInterface $logger = null) $this->logger = $logger; } + /** + * @return void + */ public function onConsoleError(ConsoleErrorEvent $event) { if (null === $this->logger) { @@ -48,6 +51,9 @@ public function onConsoleError(ConsoleErrorEvent $event) $this->logger->critical('Error thrown while running command "{command}". Message: "{message}"', ['exception' => $error, 'command' => $inputString, 'message' => $error->getMessage()]); } + /** + * @return void + */ public function onConsoleTerminate(ConsoleTerminateEvent $event) { if (null === $this->logger) { diff --git a/redaxo/src/core/vendor/symfony/console/Formatter/OutputFormatter.php b/redaxo/src/core/vendor/symfony/console/Formatter/OutputFormatter.php index 38e75c3178..9cb6310484 100644 --- a/redaxo/src/core/vendor/symfony/console/Formatter/OutputFormatter.php +++ b/redaxo/src/core/vendor/symfony/console/Formatter/OutputFormatter.php @@ -81,6 +81,9 @@ public function __construct(bool $decorated = false, array $styles = []) $this->styleStack = new OutputFormatterStyleStack(); } + /** + * @return void + */ public function setDecorated(bool $decorated) { $this->decorated = $decorated; @@ -91,6 +94,9 @@ public function isDecorated(): bool return $this->decorated; } + /** + * @return void + */ public function setStyle(string $name, OutputFormatterStyleInterface $style) { $this->styles[strtolower($name)] = $style; @@ -115,6 +121,9 @@ public function format(?string $message): ?string return $this->formatAndWrap($message, 0); } + /** + * @return string + */ public function formatAndWrap(?string $message, int $width) { if (null === $message) { diff --git a/redaxo/src/core/vendor/symfony/console/Formatter/OutputFormatterInterface.php b/redaxo/src/core/vendor/symfony/console/Formatter/OutputFormatterInterface.php index b94e51dedb..433cd41978 100644 --- a/redaxo/src/core/vendor/symfony/console/Formatter/OutputFormatterInterface.php +++ b/redaxo/src/core/vendor/symfony/console/Formatter/OutputFormatterInterface.php @@ -20,6 +20,8 @@ interface OutputFormatterInterface { /** * Sets the decorated flag. + * + * @return void */ public function setDecorated(bool $decorated); @@ -30,6 +32,8 @@ public function isDecorated(): bool; /** * Sets a new style. + * + * @return void */ public function setStyle(string $name, OutputFormatterStyleInterface $style); diff --git a/redaxo/src/core/vendor/symfony/console/Formatter/OutputFormatterStyle.php b/redaxo/src/core/vendor/symfony/console/Formatter/OutputFormatterStyle.php index 3394c9ada9..346a474c61 100644 --- a/redaxo/src/core/vendor/symfony/console/Formatter/OutputFormatterStyle.php +++ b/redaxo/src/core/vendor/symfony/console/Formatter/OutputFormatterStyle.php @@ -38,6 +38,9 @@ public function __construct(string $foreground = null, string $background = null $this->color = new Color($this->foreground = $foreground ?: '', $this->background = $background ?: '', $this->options = $options); } + /** + * @return void + */ public function setForeground(string $color = null) { if (1 > \func_num_args()) { @@ -46,6 +49,9 @@ public function setForeground(string $color = null) $this->color = new Color($this->foreground = $color ?: '', $this->background, $this->options); } + /** + * @return void + */ public function setBackground(string $color = null) { if (1 > \func_num_args()) { @@ -59,12 +65,18 @@ public function setHref(string $url): void $this->href = $url; } + /** + * @return void + */ public function setOption(string $option) { $this->options[] = $option; $this->color = new Color($this->foreground, $this->background, $this->options); } + /** + * @return void + */ public function unsetOption(string $option) { $pos = array_search($option, $this->options); @@ -75,6 +87,9 @@ public function unsetOption(string $option) $this->color = new Color($this->foreground, $this->background, $this->options); } + /** + * @return void + */ public function setOptions(array $options) { $this->color = new Color($this->foreground, $this->background, $this->options = $options); diff --git a/redaxo/src/core/vendor/symfony/console/Formatter/OutputFormatterStyleInterface.php b/redaxo/src/core/vendor/symfony/console/Formatter/OutputFormatterStyleInterface.php index 7ed67d9a11..3b15098cbe 100644 --- a/redaxo/src/core/vendor/symfony/console/Formatter/OutputFormatterStyleInterface.php +++ b/redaxo/src/core/vendor/symfony/console/Formatter/OutputFormatterStyleInterface.php @@ -20,26 +20,36 @@ interface OutputFormatterStyleInterface { /** * Sets style foreground color. + * + * @return void */ public function setForeground(?string $color); /** * Sets style background color. + * + * @return void */ public function setBackground(?string $color); /** * Sets some specific style option. + * + * @return void */ public function setOption(string $option); /** * Unsets some specific style option. + * + * @return void */ public function unsetOption(string $option); /** * Sets multiple style options at once. + * + * @return void */ public function setOptions(array $options); diff --git a/redaxo/src/core/vendor/symfony/console/Formatter/OutputFormatterStyleStack.php b/redaxo/src/core/vendor/symfony/console/Formatter/OutputFormatterStyleStack.php index 2c5cdf9b80..f98c2eff7c 100644 --- a/redaxo/src/core/vendor/symfony/console/Formatter/OutputFormatterStyleStack.php +++ b/redaxo/src/core/vendor/symfony/console/Formatter/OutputFormatterStyleStack.php @@ -34,6 +34,8 @@ public function __construct(OutputFormatterStyleInterface $emptyStyle = null) /** * Resets stack (ie. empty internal arrays). + * + * @return void */ public function reset() { @@ -42,6 +44,8 @@ public function reset() /** * Pushes a style in the stack. + * + * @return void */ public function push(OutputFormatterStyleInterface $style) { diff --git a/redaxo/src/core/vendor/symfony/console/Helper/DescriptorHelper.php b/redaxo/src/core/vendor/symfony/console/Helper/DescriptorHelper.php index 3015ff08d2..eb32bce8fc 100644 --- a/redaxo/src/core/vendor/symfony/console/Helper/DescriptorHelper.php +++ b/redaxo/src/core/vendor/symfony/console/Helper/DescriptorHelper.php @@ -14,6 +14,7 @@ use Symfony\Component\Console\Descriptor\DescriptorInterface; use Symfony\Component\Console\Descriptor\JsonDescriptor; use Symfony\Component\Console\Descriptor\MarkdownDescriptor; +use Symfony\Component\Console\Descriptor\ReStructuredTextDescriptor; use Symfony\Component\Console\Descriptor\TextDescriptor; use Symfony\Component\Console\Descriptor\XmlDescriptor; use Symfony\Component\Console\Exception\InvalidArgumentException; @@ -38,6 +39,7 @@ public function __construct() ->register('xml', new XmlDescriptor()) ->register('json', new JsonDescriptor()) ->register('md', new MarkdownDescriptor()) + ->register('rst', new ReStructuredTextDescriptor()) ; } @@ -48,6 +50,8 @@ public function __construct() * * format: string, the output format name * * raw_text: boolean, sets output type as raw * + * @return void + * * @throws InvalidArgumentException when the given format is not supported */ public function describe(OutputInterface $output, ?object $object, array $options = []) diff --git a/redaxo/src/core/vendor/symfony/console/Helper/Dumper.php b/redaxo/src/core/vendor/symfony/console/Helper/Dumper.php index ac7571ceaf..8c6a94d51f 100644 --- a/redaxo/src/core/vendor/symfony/console/Helper/Dumper.php +++ b/redaxo/src/core/vendor/symfony/console/Helper/Dumper.php @@ -40,14 +40,12 @@ public function __construct(OutputInterface $output, CliDumper $dumper = null, C return rtrim($dumper->dump(($this->cloner ??= new VarCloner())->cloneVar($var)->withRefHandles(false), true)); }; } else { - $this->handler = function ($var): string { - return match (true) { - null === $var => 'null', - true === $var => 'true', - false === $var => 'false', - \is_string($var) => '"'.$var.'"', - default => rtrim(print_r($var, true)), - }; + $this->handler = fn ($var): string => match (true) { + null === $var => 'null', + true === $var => 'true', + false === $var => 'false', + \is_string($var) => '"'.$var.'"', + default => rtrim(print_r($var, true)), }; } } diff --git a/redaxo/src/core/vendor/symfony/console/Helper/Helper.php b/redaxo/src/core/vendor/symfony/console/Helper/Helper.php index 920196e0fe..3631b30f69 100644 --- a/redaxo/src/core/vendor/symfony/console/Helper/Helper.php +++ b/redaxo/src/core/vendor/symfony/console/Helper/Helper.php @@ -21,8 +21,11 @@ */ abstract class Helper implements HelperInterface { - protected $helperSet = null; + protected $helperSet; + /** + * @return void + */ public function setHelperSet(HelperSet $helperSet = null) { if (1 > \func_num_args()) { @@ -88,6 +91,9 @@ public static function substr(?string $string, int $from, int $length = null): s return mb_substr($string, $from, $length, $encoding); } + /** + * @return string + */ public static function formatTime(int|float $secs) { static $timeFormats = [ @@ -117,6 +123,9 @@ public static function formatTime(int|float $secs) } } + /** + * @return string + */ public static function formatMemory(int $memory) { if ($memory >= 1024 * 1024 * 1024) { @@ -134,6 +143,9 @@ public static function formatMemory(int $memory) return sprintf('%d B', $memory); } + /** + * @return string + */ public static function removeDecoration(OutputFormatterInterface $formatter, ?string $string) { $isDecorated = $formatter->isDecorated(); diff --git a/redaxo/src/core/vendor/symfony/console/Helper/HelperInterface.php b/redaxo/src/core/vendor/symfony/console/Helper/HelperInterface.php index 2762cdf05c..ab626c9385 100644 --- a/redaxo/src/core/vendor/symfony/console/Helper/HelperInterface.php +++ b/redaxo/src/core/vendor/symfony/console/Helper/HelperInterface.php @@ -20,6 +20,8 @@ interface HelperInterface { /** * Sets the helper set associated with this helper. + * + * @return void */ public function setHelperSet(?HelperSet $helperSet); diff --git a/redaxo/src/core/vendor/symfony/console/Helper/HelperSet.php b/redaxo/src/core/vendor/symfony/console/Helper/HelperSet.php index cefe62be3c..dc5d499caa 100644 --- a/redaxo/src/core/vendor/symfony/console/Helper/HelperSet.php +++ b/redaxo/src/core/vendor/symfony/console/Helper/HelperSet.php @@ -35,6 +35,9 @@ public function __construct(array $helpers = []) } } + /** + * @return void + */ public function set(HelperInterface $helper, string $alias = null) { $this->helpers[$helper->getName()] = $helper; diff --git a/redaxo/src/core/vendor/symfony/console/Helper/InputAwareHelper.php b/redaxo/src/core/vendor/symfony/console/Helper/InputAwareHelper.php index ba81e37713..6f8225973c 100644 --- a/redaxo/src/core/vendor/symfony/console/Helper/InputAwareHelper.php +++ b/redaxo/src/core/vendor/symfony/console/Helper/InputAwareHelper.php @@ -23,6 +23,9 @@ abstract class InputAwareHelper extends Helper implements InputAwareInterface { protected $input; + /** + * @return void + */ public function setInput(InputInterface $input) { $this->input = $input; diff --git a/redaxo/src/core/vendor/symfony/console/Helper/ProgressBar.php b/redaxo/src/core/vendor/symfony/console/Helper/ProgressBar.php index 0d1126097e..19faea47c0 100644 --- a/redaxo/src/core/vendor/symfony/console/Helper/ProgressBar.php +++ b/redaxo/src/core/vendor/symfony/console/Helper/ProgressBar.php @@ -59,6 +59,7 @@ final class ProgressBar private Terminal $terminal; private ?string $previousMessage = null; private Cursor $cursor; + private array $placeholders = []; private static array $formatters; private static array $formats; @@ -94,12 +95,12 @@ public function __construct(OutputInterface $output, int $max = 0, float $minSec } /** - * Sets a placeholder formatter for a given name. + * Sets a placeholder formatter for a given name, globally for all instances of ProgressBar. * * This method also allow you to override an existing placeholder. * - * @param string $name The placeholder name (including the delimiter char like %) - * @param callable $callable A PHP callable + * @param string $name The placeholder name (including the delimiter char like %) + * @param callable(ProgressBar):string $callable A PHP callable */ public static function setPlaceholderFormatterDefinition(string $name, callable $callable): void { @@ -120,6 +121,26 @@ public static function getPlaceholderFormatterDefinition(string $name): ?callabl return self::$formatters[$name] ?? null; } + /** + * Sets a placeholder formatter for a given name, for this instance only. + * + * @param callable(ProgressBar):string $callable A PHP callable + */ + public function setPlaceholderFormatter(string $name, callable $callable): void + { + $this->placeholders[$name] = $callable; + } + + /** + * Gets the placeholder formatter for a given name. + * + * @param string $name The placeholder name (including the delimiter char like %) + */ + public function getPlaceholderFormatter(string $name): ?callable + { + return $this->placeholders[$name] ?? $this::getPlaceholderFormatterDefinition($name); + } + /** * Sets a format for a given name. * @@ -157,12 +178,12 @@ public static function getFormatDefinition(string $name): ?string * @param string $message The text to associate with the placeholder * @param string $name The name of the placeholder */ - public function setMessage(string $message, string $name = 'message') + public function setMessage(string $message, string $name = 'message'): void { $this->messages[$name] = $message; } - public function getMessage(string $name = 'message') + public function getMessage(string $name = 'message'): string { return $this->messages[$name]; } @@ -215,7 +236,7 @@ public function getRemaining(): float return round((time() - $this->startTime) / ($this->step - $this->startingStep) * ($this->max - $this->step)); } - public function setBarWidth(int $size) + public function setBarWidth(int $size): void { $this->barWidth = max(1, $size); } @@ -225,7 +246,7 @@ public function getBarWidth(): int return $this->barWidth; } - public function setBarCharacter(string $char) + public function setBarCharacter(string $char): void { $this->barChar = $char; } @@ -235,7 +256,7 @@ public function getBarCharacter(): string return $this->barChar ?? ($this->max ? '=' : $this->emptyBarChar); } - public function setEmptyBarCharacter(string $char) + public function setEmptyBarCharacter(string $char): void { $this->emptyBarChar = $char; } @@ -245,7 +266,7 @@ public function getEmptyBarCharacter(): string return $this->emptyBarChar; } - public function setProgressCharacter(string $char) + public function setProgressCharacter(string $char): void { $this->progressChar = $char; } @@ -255,7 +276,7 @@ public function getProgressCharacter(): string return $this->progressChar; } - public function setFormat(string $format) + public function setFormat(string $format): void { $this->format = null; $this->internalFormat = $format; @@ -266,7 +287,7 @@ public function setFormat(string $format) * * @param int|null $freq The frequency in steps */ - public function setRedrawFrequency(?int $freq) + public function setRedrawFrequency(?int $freq): void { $this->redrawFreq = null !== $freq ? max(1, $freq) : null; } @@ -325,7 +346,7 @@ public function start(int $max = null, int $startAt = 0): void * * @param int $step Number of steps to advance */ - public function advance(int $step = 1) + public function advance(int $step = 1): void { $this->setProgress($this->step + $step); } @@ -333,12 +354,12 @@ public function advance(int $step = 1) /** * Sets whether to overwrite the progressbar, false for new line. */ - public function setOverwrite(bool $overwrite) + public function setOverwrite(bool $overwrite): void { $this->overwrite = $overwrite; } - public function setProgress(int $step) + public function setProgress(int $step): void { if ($this->max && $step > $this->max) { $this->max = $step; @@ -371,7 +392,7 @@ public function setProgress(int $step) } } - public function setMaxSteps(int $max) + public function setMaxSteps(int $max): void { $this->format = null; $this->max = max(0, $max); @@ -431,7 +452,7 @@ public function clear(): void $this->overwrite(''); } - private function setRealFormat(string $format) + private function setRealFormat(string $format): void { // try to use the _nomax variant if available if (!$this->max && null !== self::getFormatDefinition($format.'_nomax')) { @@ -513,9 +534,7 @@ private static function initPlaceholderFormatters(): array return $display; }, - 'elapsed' => function (self $bar) { - return Helper::formatTime(time() - $bar->getStartTime()); - }, + 'elapsed' => fn (self $bar) => Helper::formatTime(time() - $bar->getStartTime()), 'remaining' => function (self $bar) { if (!$bar->getMaxSteps()) { throw new LogicException('Unable to display the remaining time if the maximum number of steps is not set.'); @@ -530,18 +549,10 @@ private static function initPlaceholderFormatters(): array return Helper::formatTime($bar->getEstimated()); }, - 'memory' => function (self $bar) { - return Helper::formatMemory(memory_get_usage(true)); - }, - 'current' => function (self $bar) { - return str_pad($bar->getProgress(), $bar->getStepWidth(), ' ', \STR_PAD_LEFT); - }, - 'max' => function (self $bar) { - return $bar->getMaxSteps(); - }, - 'percent' => function (self $bar) { - return floor($bar->getProgressPercent() * 100); - }, + 'memory' => fn (self $bar) => Helper::formatMemory(memory_get_usage(true)), + 'current' => fn (self $bar) => str_pad($bar->getProgress(), $bar->getStepWidth(), ' ', \STR_PAD_LEFT), + 'max' => fn (self $bar) => $bar->getMaxSteps(), + 'percent' => fn (self $bar) => floor($bar->getProgressPercent() * 100), ]; } @@ -568,7 +579,7 @@ private function buildLine(): string $regex = "{%([a-z\-_]+)(?:\:([^%]+))?%}i"; $callback = function ($matches) { - if ($formatter = $this::getPlaceholderFormatterDefinition($matches[1])) { + if ($formatter = $this->getPlaceholderFormatter($matches[1])) { $text = $formatter($this, $this->output); } elseif (isset($this->messages[$matches[1]])) { $text = $this->messages[$matches[1]]; @@ -585,9 +596,7 @@ private function buildLine(): string $line = preg_replace_callback($regex, $callback, $this->format); // gets string length for each sub line with multiline format - $linesLength = array_map(function ($subLine) { - return Helper::width(Helper::removeDecoration($this->output->getFormatter(), rtrim($subLine, "\r"))); - }, explode("\n", $line)); + $linesLength = array_map(fn ($subLine) => Helper::width(Helper::removeDecoration($this->output->getFormatter(), rtrim($subLine, "\r"))), explode("\n", $line)); $linesWidth = max($linesLength); diff --git a/redaxo/src/core/vendor/symfony/console/Helper/ProgressIndicator.php b/redaxo/src/core/vendor/symfony/console/Helper/ProgressIndicator.php index b5fa24c467..84dbef950c 100644 --- a/redaxo/src/core/vendor/symfony/console/Helper/ProgressIndicator.php +++ b/redaxo/src/core/vendor/symfony/console/Helper/ProgressIndicator.php @@ -70,6 +70,8 @@ public function __construct(OutputInterface $output, string $format = null, int /** * Sets the current indicator message. + * + * @return void */ public function setMessage(?string $message) { @@ -80,6 +82,8 @@ public function setMessage(?string $message) /** * Starts the indicator output. + * + * @return void */ public function start(string $message) { @@ -98,6 +102,8 @@ public function start(string $message) /** * Advances the indicator. + * + * @return void */ public function advance() { @@ -123,6 +129,8 @@ public function advance() /** * Finish the indicator with message. + * + * @return void */ public function finish(string $message) { @@ -148,6 +156,8 @@ public static function getFormatDefinition(string $name): ?string * Sets a placeholder formatter for a given name. * * This method also allow you to override an existing placeholder. + * + * @return void */ public static function setPlaceholderFormatterDefinition(string $name, callable $callable) { @@ -166,7 +176,7 @@ public static function getPlaceholderFormatterDefinition(string $name): ?callabl return self::$formatters[$name] ?? null; } - private function display() + private function display(): void { if (OutputInterface::VERBOSITY_QUIET === $this->output->getVerbosity()) { return; @@ -195,7 +205,7 @@ private function determineBestFormat(): string /** * Overwrites a previous message to the output. */ - private function overwrite(string $message) + private function overwrite(string $message): void { if ($this->output->isDecorated()) { $this->output->write("\x0D\x1B[2K"); @@ -216,18 +226,10 @@ private function getCurrentTimeInMilliseconds(): float private static function initPlaceholderFormatters(): array { return [ - 'indicator' => function (self $indicator) { - return $indicator->indicatorValues[$indicator->indicatorCurrent % \count($indicator->indicatorValues)]; - }, - 'message' => function (self $indicator) { - return $indicator->message; - }, - 'elapsed' => function (self $indicator) { - return Helper::formatTime(time() - $indicator->startTime); - }, - 'memory' => function () { - return Helper::formatMemory(memory_get_usage(true)); - }, + 'indicator' => fn (self $indicator) => $indicator->indicatorValues[$indicator->indicatorCurrent % \count($indicator->indicatorValues)], + 'message' => fn (self $indicator) => $indicator->message, + 'elapsed' => fn (self $indicator) => Helper::formatTime(time() - $indicator->startTime), + 'memory' => fn () => Helper::formatMemory(memory_get_usage(true)), ]; } } diff --git a/redaxo/src/core/vendor/symfony/console/Helper/QuestionHelper.php b/redaxo/src/core/vendor/symfony/console/Helper/QuestionHelper.php index c345b4af77..f32813c6c5 100644 --- a/redaxo/src/core/vendor/symfony/console/Helper/QuestionHelper.php +++ b/redaxo/src/core/vendor/symfony/console/Helper/QuestionHelper.php @@ -68,9 +68,7 @@ public function ask(InputInterface $input, OutputInterface $output, Question $qu return $this->doAsk($output, $question); } - $interviewer = function () use ($output, $question) { - return $this->doAsk($output, $question); - }; + $interviewer = fn () => $this->doAsk($output, $question); return $this->validateAttempts($interviewer, $output, $question); } catch (MissingInputException $exception) { @@ -91,6 +89,8 @@ public function getName(): string /** * Prevents usage of stty. + * + * @return void */ public static function disableStty() { @@ -123,7 +123,18 @@ private function doAsk(OutputInterface $output, Question $question): mixed } if (false === $ret) { + $isBlocked = stream_get_meta_data($inputStream)['blocked'] ?? true; + + if (!$isBlocked) { + stream_set_blocking($inputStream, true); + } + $ret = $this->readInput($inputStream, $question); + + if (!$isBlocked) { + stream_set_blocking($inputStream, false); + } + if (false === $ret) { throw new MissingInputException('Aborted.'); } @@ -159,7 +170,7 @@ private function getDefaultAnswer(Question $question): mixed } if ($validator = $question->getValidator()) { - return \call_user_func($question->getValidator(), $default); + return \call_user_func($validator, $default); } elseif ($question instanceof ChoiceQuestion) { $choices = $question->getChoices(); @@ -179,6 +190,8 @@ private function getDefaultAnswer(Question $question): mixed /** * Outputs the question prompt. + * + * @return void */ protected function writePrompt(OutputInterface $output, Question $question) { @@ -215,6 +228,8 @@ protected function formatChoiceQuestionChoices(ChoiceQuestion $question, string /** * Outputs an error message. + * + * @return void */ protected function writeError(OutputInterface $output, \Exception $error) { @@ -314,9 +329,7 @@ private function autocomplete(OutputInterface $output, Question $question, $inpu $matches = array_filter( $autocomplete($ret), - function ($match) use ($ret) { - return '' === $ret || str_starts_with($match, $ret); - } + fn ($match) => '' === $ret || str_starts_with($match, $ret) ); $numMatches = \count($matches); $ofs = -1; @@ -496,13 +509,11 @@ private function isInteractiveInput($inputStream): bool return self::$stdinIsInteractive = @posix_isatty(fopen('php://stdin', 'r')); } - if (!\function_exists('exec')) { + if (!\function_exists('shell_exec')) { return self::$stdinIsInteractive = true; } - exec('stty 2> /dev/null', $output, $status); - - return self::$stdinIsInteractive = 1 !== $status; + return self::$stdinIsInteractive = (bool) shell_exec('stty 2> '.('\\' === \DIRECTORY_SEPARATOR ? 'NUL' : '/dev/null')); } /** diff --git a/redaxo/src/core/vendor/symfony/console/Helper/SymfonyQuestionHelper.php b/redaxo/src/core/vendor/symfony/console/Helper/SymfonyQuestionHelper.php index 109045d043..8ebc84376b 100644 --- a/redaxo/src/core/vendor/symfony/console/Helper/SymfonyQuestionHelper.php +++ b/redaxo/src/core/vendor/symfony/console/Helper/SymfonyQuestionHelper.php @@ -25,6 +25,9 @@ */ class SymfonyQuestionHelper extends QuestionHelper { + /** + * @return void + */ protected function writePrompt(OutputInterface $output, Question $question) { $text = OutputFormatter::escapeTrailingBackslash($question->getQuestion()); @@ -80,6 +83,9 @@ protected function writePrompt(OutputInterface $output, Question $question) $output->write($prompt); } + /** + * @return void + */ protected function writeError(OutputInterface $output, \Exception $error) { if ($output instanceof SymfonyStyle) { diff --git a/redaxo/src/core/vendor/symfony/console/Helper/Table.php b/redaxo/src/core/vendor/symfony/console/Helper/Table.php index 907c9f505c..cf714873f5 100644 --- a/redaxo/src/core/vendor/symfony/console/Helper/Table.php +++ b/redaxo/src/core/vendor/symfony/console/Helper/Table.php @@ -66,6 +66,8 @@ public function __construct(OutputInterface $output) /** * Sets a style definition. + * + * @return void */ public static function setStyleDefinition(string $name, TableStyle $style) { @@ -310,6 +312,8 @@ public function setVertical(bool $vertical = true): static * | 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens | * | 960-425-059-0 | The Lord of the Rings | J. R. R. Tolkien | * +---------------+-----------------------+------------------+ + * + * @return void */ public function render() { @@ -450,7 +454,7 @@ public function render() * * +-----+-----------+-------+ */ - private function renderRowSeparator(int $type = self::SEPARATOR_MID, string $title = null, string $titleFormat = null) + private function renderRowSeparator(int $type = self::SEPARATOR_MID, string $title = null, string $titleFormat = null): void { if (!$count = $this->numberOfColumns) { return; @@ -515,7 +519,7 @@ private function renderColumnSeparator(int $type = self::BORDER_OUTSIDE): string * * | 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens | */ - private function renderRow(array $row, string $cellFormat, string $firstCellFormat = null) + private function renderRow(array $row, string $cellFormat, string $firstCellFormat = null): void { $rowContent = $this->renderColumnSeparator(self::BORDER_OUTSIDE); $columns = $this->getRowColumns($row); @@ -588,7 +592,7 @@ private function renderCell(array $row, int $column, string $cellFormat): string /** * Calculate number of columns for this table. */ - private function calculateNumberOfColumns(array $rows) + private function calculateNumberOfColumns(array $rows): void { $columns = [0]; foreach ($rows as $row) { @@ -727,7 +731,7 @@ private function fillNextRows(array $rows, int $line): array /** * fill cells for a row that contains colspan > 1. */ - private function fillCells(iterable $row) + private function fillCells(iterable $row): iterable { $newRow = []; @@ -789,7 +793,7 @@ private function getRowColumns(array $row): array /** * Calculates columns widths. */ - private function calculateColumnsWidth(iterable $groups) + private function calculateColumnsWidth(iterable $groups): void { for ($column = 0; $column < $this->numberOfColumns; ++$column) { $lengths = []; @@ -843,7 +847,7 @@ private function getCellWidth(array $row, int $column): int /** * Called after rendering to cleanup cache data. */ - private function cleanup() + private function cleanup(): void { $this->effectiveColumnWidths = []; unset($this->numberOfColumns); diff --git a/redaxo/src/core/vendor/symfony/console/Helper/TableCellStyle.php b/redaxo/src/core/vendor/symfony/console/Helper/TableCellStyle.php index 65ae9e7281..9419dcb402 100644 --- a/redaxo/src/core/vendor/symfony/console/Helper/TableCellStyle.php +++ b/redaxo/src/core/vendor/symfony/console/Helper/TableCellStyle.php @@ -67,9 +67,7 @@ public function getTagOptions(): array { return array_filter( $this->getOptions(), - function ($key) { - return \in_array($key, self::TAG_OPTIONS) && isset($this->options[$key]); - }, + fn ($key) => \in_array($key, self::TAG_OPTIONS) && isset($this->options[$key]), \ARRAY_FILTER_USE_KEY ); } diff --git a/redaxo/src/core/vendor/symfony/console/Input/ArgvInput.php b/redaxo/src/core/vendor/symfony/console/Input/ArgvInput.php index c0c28bb581..59f9217ec5 100644 --- a/redaxo/src/core/vendor/symfony/console/Input/ArgvInput.php +++ b/redaxo/src/core/vendor/symfony/console/Input/ArgvInput.php @@ -55,11 +55,17 @@ public function __construct(array $argv = null, InputDefinition $definition = nu parent::__construct($definition); } + /** + * @return void + */ protected function setTokens(array $tokens) { $this->tokens = $tokens; } + /** + * @return void + */ protected function parse() { $parseOptions = true; @@ -89,7 +95,7 @@ protected function parseToken(string $token, bool $parseOptions): bool /** * Parses a short option. */ - private function parseShortOption(string $token) + private function parseShortOption(string $token): void { $name = substr($token, 1); @@ -110,7 +116,7 @@ private function parseShortOption(string $token) * * @throws RuntimeException When option given doesn't exist */ - private function parseShortOptionSet(string $name) + private function parseShortOptionSet(string $name): void { $len = \strlen($name); for ($i = 0; $i < $len; ++$i) { @@ -133,7 +139,7 @@ private function parseShortOptionSet(string $name) /** * Parses a long option. */ - private function parseLongOption(string $token) + private function parseLongOption(string $token): void { $name = substr($token, 2); @@ -152,7 +158,7 @@ private function parseLongOption(string $token) * * @throws RuntimeException When too many arguments are given */ - private function parseArgument(string $token) + private function parseArgument(string $token): void { $c = \count($this->arguments); @@ -196,7 +202,7 @@ private function parseArgument(string $token) * * @throws RuntimeException When option given doesn't exist */ - private function addShortOption(string $shortcut, mixed $value) + private function addShortOption(string $shortcut, mixed $value): void { if (!$this->definition->hasShortcut($shortcut)) { throw new RuntimeException(sprintf('The "-%s" option does not exist.', $shortcut)); @@ -210,7 +216,7 @@ private function addShortOption(string $shortcut, mixed $value) * * @throws RuntimeException When option given doesn't exist */ - private function addLongOption(string $name, mixed $value) + private function addLongOption(string $name, mixed $value): void { if (!$this->definition->hasOption($name)) { if (!$this->definition->hasNegation($name)) { diff --git a/redaxo/src/core/vendor/symfony/console/Input/ArrayInput.php b/redaxo/src/core/vendor/symfony/console/Input/ArrayInput.php index 02fb4e8eef..355de61dd6 100644 --- a/redaxo/src/core/vendor/symfony/console/Input/ArrayInput.php +++ b/redaxo/src/core/vendor/symfony/console/Input/ArrayInput.php @@ -113,6 +113,9 @@ public function __toString(): string return implode(' ', $params); } + /** + * @return void + */ protected function parse() { foreach ($this->parameters as $key => $value) { @@ -134,7 +137,7 @@ protected function parse() * * @throws InvalidOptionException When option given doesn't exist */ - private function addShortOption(string $shortcut, mixed $value) + private function addShortOption(string $shortcut, mixed $value): void { if (!$this->definition->hasShortcut($shortcut)) { throw new InvalidOptionException(sprintf('The "-%s" option does not exist.', $shortcut)); @@ -149,7 +152,7 @@ private function addShortOption(string $shortcut, mixed $value) * @throws InvalidOptionException When option given doesn't exist * @throws InvalidOptionException When a required value is missing */ - private function addLongOption(string $name, mixed $value) + private function addLongOption(string $name, mixed $value): void { if (!$this->definition->hasOption($name)) { if (!$this->definition->hasNegation($name)) { @@ -182,7 +185,7 @@ private function addLongOption(string $name, mixed $value) * * @throws InvalidArgumentException When argument given doesn't exist */ - private function addArgument(string|int $name, mixed $value) + private function addArgument(string|int $name, mixed $value): void { if (!$this->definition->hasArgument($name)) { throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name)); diff --git a/redaxo/src/core/vendor/symfony/console/Input/Input.php b/redaxo/src/core/vendor/symfony/console/Input/Input.php index 7b90713c86..0f5617cd17 100644 --- a/redaxo/src/core/vendor/symfony/console/Input/Input.php +++ b/redaxo/src/core/vendor/symfony/console/Input/Input.php @@ -43,6 +43,9 @@ public function __construct(InputDefinition $definition = null) } } + /** + * @return void + */ public function bind(InputDefinition $definition) { $this->arguments = []; @@ -54,17 +57,20 @@ public function bind(InputDefinition $definition) /** * Processes command line arguments. + * + * @return void */ abstract protected function parse(); + /** + * @return void + */ public function validate() { $definition = $this->definition; $givenArguments = $this->arguments; - $missingArguments = array_filter(array_keys($definition->getArguments()), function ($argument) use ($definition, $givenArguments) { - return !\array_key_exists($argument, $givenArguments) && $definition->getArgument($argument)->isRequired(); - }); + $missingArguments = array_filter(array_keys($definition->getArguments()), fn ($argument) => !\array_key_exists($argument, $givenArguments) && $definition->getArgument($argument)->isRequired()); if (\count($missingArguments) > 0) { throw new RuntimeException(sprintf('Not enough arguments (missing: "%s").', implode(', ', $missingArguments))); @@ -76,6 +82,9 @@ public function isInteractive(): bool return $this->interactive; } + /** + * @return void + */ public function setInteractive(bool $interactive) { $this->interactive = $interactive; @@ -95,6 +104,9 @@ public function getArgument(string $name): mixed return $this->arguments[$name] ?? $this->definition->getArgument($name)->getDefault(); } + /** + * @return void + */ public function setArgument(string $name, mixed $value) { if (!$this->definition->hasArgument($name)) { @@ -131,6 +143,9 @@ public function getOption(string $name): mixed return \array_key_exists($name, $this->options) ? $this->options[$name] : $this->definition->getOption($name)->getDefault(); } + /** + * @return void + */ public function setOption(string $name, mixed $value) { if ($this->definition->hasNegation($name)) { @@ -157,11 +172,19 @@ public function escapeToken(string $token): string return preg_match('{^[\w-]+$}', $token) ? $token : escapeshellarg($token); } + /** + * @param resource $stream + * + * @return void + */ public function setStream($stream) { $this->stream = $stream; } + /** + * @return resource + */ public function getStream() { return $this->stream; diff --git a/redaxo/src/core/vendor/symfony/console/Input/InputArgument.php b/redaxo/src/core/vendor/symfony/console/Input/InputArgument.php index a130c41226..5cb151488d 100644 --- a/redaxo/src/core/vendor/symfony/console/Input/InputArgument.php +++ b/redaxo/src/core/vendor/symfony/console/Input/InputArgument.php @@ -37,7 +37,7 @@ class InputArgument /** * @param string $name The argument name - * @param int|null $mode The argument mode: self::REQUIRED or self::OPTIONAL + * @param int|null $mode The argument mode: a bit mask of self::REQUIRED, self::OPTIONAL and self::IS_ARRAY * @param string $description A description text * @param string|bool|int|float|array|null $default The default value (for self::OPTIONAL mode only) * @param array|\Closure(CompletionInput,CompletionSuggestions):list $suggestedValues The values used for input completion @@ -91,6 +91,8 @@ public function isArray(): bool /** * Sets the default value. * + * @return void + * * @throws LogicException When incorrect default value is given */ public function setDefault(string|bool|int|float|array $default = null) diff --git a/redaxo/src/core/vendor/symfony/console/Input/InputAwareInterface.php b/redaxo/src/core/vendor/symfony/console/Input/InputAwareInterface.php index 5a288de5d4..0ad27b4558 100644 --- a/redaxo/src/core/vendor/symfony/console/Input/InputAwareInterface.php +++ b/redaxo/src/core/vendor/symfony/console/Input/InputAwareInterface.php @@ -21,6 +21,8 @@ interface InputAwareInterface { /** * Sets the Console Input. + * + * @return void */ public function setInput(InputInterface $input); } diff --git a/redaxo/src/core/vendor/symfony/console/Input/InputDefinition.php b/redaxo/src/core/vendor/symfony/console/Input/InputDefinition.php index f4b14a1c89..b7162d7706 100644 --- a/redaxo/src/core/vendor/symfony/console/Input/InputDefinition.php +++ b/redaxo/src/core/vendor/symfony/console/Input/InputDefinition.php @@ -46,6 +46,8 @@ public function __construct(array $definition = []) /** * Sets the definition of the input. + * + * @return void */ public function setDefinition(array $definition) { @@ -67,6 +69,8 @@ public function setDefinition(array $definition) * Sets the InputArgument objects. * * @param InputArgument[] $arguments An array of InputArgument objects + * + * @return void */ public function setArguments(array $arguments = []) { @@ -81,6 +85,8 @@ public function setArguments(array $arguments = []) * Adds an array of InputArgument objects. * * @param InputArgument[] $arguments An array of InputArgument objects + * + * @return void */ public function addArguments(?array $arguments = []) { @@ -92,6 +98,8 @@ public function addArguments(?array $arguments = []) } /** + * @return void + * * @throws LogicException When incorrect argument is given */ public function addArgument(InputArgument $argument) @@ -190,6 +198,8 @@ public function getArgumentDefaults(): array * Sets the InputOption objects. * * @param InputOption[] $options An array of InputOption objects + * + * @return void */ public function setOptions(array $options = []) { @@ -203,6 +213,8 @@ public function setOptions(array $options = []) * Adds an array of InputOption objects. * * @param InputOption[] $options An array of InputOption objects + * + * @return void */ public function addOptions(array $options = []) { @@ -212,6 +224,8 @@ public function addOptions(array $options = []) } /** + * @return void + * * @throws LogicException When option given already exist */ public function addOption(InputOption $option) diff --git a/redaxo/src/core/vendor/symfony/console/Input/InputInterface.php b/redaxo/src/core/vendor/symfony/console/Input/InputInterface.php index 3af991a76f..aaed5fd01d 100644 --- a/redaxo/src/core/vendor/symfony/console/Input/InputInterface.php +++ b/redaxo/src/core/vendor/symfony/console/Input/InputInterface.php @@ -61,6 +61,8 @@ public function getParameterOption(string|array $values, string|bool|int|float|a /** * Binds the current Input instance with the given arguments and options. * + * @return void + * * @throws RuntimeException */ public function bind(InputDefinition $definition); @@ -68,6 +70,8 @@ public function bind(InputDefinition $definition); /** * Validates the input. * + * @return void + * * @throws RuntimeException When not enough arguments are given */ public function validate(); @@ -91,6 +95,8 @@ public function getArgument(string $name); /** * Sets an argument value by name. * + * @return void + * * @throws InvalidArgumentException When argument given doesn't exist */ public function setArgument(string $name, mixed $value); @@ -119,6 +125,8 @@ public function getOption(string $name); /** * Sets an option value by name. * + * @return void + * * @throws InvalidArgumentException When option given doesn't exist */ public function setOption(string $name, mixed $value); @@ -135,6 +143,8 @@ public function isInteractive(): bool; /** * Sets the input interactivity. + * + * @return void */ public function setInteractive(bool $interactive); } diff --git a/redaxo/src/core/vendor/symfony/console/Input/InputOption.php b/redaxo/src/core/vendor/symfony/console/Input/InputOption.php index 9a7032a030..fdf88dcc27 100644 --- a/redaxo/src/core/vendor/symfony/console/Input/InputOption.php +++ b/redaxo/src/core/vendor/symfony/console/Input/InputOption.php @@ -178,6 +178,9 @@ public function isNegatable(): bool return self::VALUE_NEGATABLE === (self::VALUE_NEGATABLE & $this->mode); } + /** + * @return void + */ public function setDefault(string|bool|int|float|array $default = null) { if (1 > \func_num_args()) { diff --git a/redaxo/src/core/vendor/symfony/console/Input/StreamableInputInterface.php b/redaxo/src/core/vendor/symfony/console/Input/StreamableInputInterface.php index d7e462f244..4b95fcb11e 100644 --- a/redaxo/src/core/vendor/symfony/console/Input/StreamableInputInterface.php +++ b/redaxo/src/core/vendor/symfony/console/Input/StreamableInputInterface.php @@ -25,6 +25,8 @@ interface StreamableInputInterface extends InputInterface * This is mainly useful for testing purpose. * * @param resource $stream The input stream + * + * @return void */ public function setStream($stream); diff --git a/redaxo/src/core/vendor/symfony/console/Output/AnsiColorMode.php b/redaxo/src/core/vendor/symfony/console/Output/AnsiColorMode.php index c6cc5c12f0..5f9f744fe6 100644 --- a/redaxo/src/core/vendor/symfony/console/Output/AnsiColorMode.php +++ b/redaxo/src/core/vendor/symfony/console/Output/AnsiColorMode.php @@ -26,7 +26,7 @@ enum AnsiColorMode case Ansi4; /* - * 8-bit Ansi colors (240 differents colors + 16 duplicate color codes, ensuring backward compatibility). + * 8-bit Ansi colors (240 different colors + 16 duplicate color codes, ensuring backward compatibility). * Output syntax is: "ESC[38;5;${foreGroundColorcode};48;5;${backGroundColorcode}m" * Should be compatible with most terminals. */ @@ -78,25 +78,7 @@ private function convertFromRGB(int $r, int $g, int $b): int private function degradeHexColorToAnsi4(int $r, int $g, int $b): int { - if (0 === round($this->getSaturation($r, $g, $b) / 50)) { - return 0; - } - - return (int) ((round($b / 255) << 2) | (round($g / 255) << 1) | round($r / 255)); - } - - private function getSaturation(int $r, int $g, int $b): int - { - $r = $r / 255; - $g = $g / 255; - $b = $b / 255; - $v = max($r, $g, $b); - - if (0 === $diff = $v - min($r, $g, $b)) { - return 0; - } - - return (int) ((int) $diff * 100 / $v); + return round($b / 255) << 2 | (round($g / 255) << 1) | round($r / 255); } /** diff --git a/redaxo/src/core/vendor/symfony/console/Output/BufferedOutput.php b/redaxo/src/core/vendor/symfony/console/Output/BufferedOutput.php index 94d4e414a0..ef5099bfd6 100644 --- a/redaxo/src/core/vendor/symfony/console/Output/BufferedOutput.php +++ b/redaxo/src/core/vendor/symfony/console/Output/BufferedOutput.php @@ -29,6 +29,9 @@ public function fetch(): string return $content; } + /** + * @return void + */ protected function doWrite(string $message, bool $newline) { $this->buffer .= $message; diff --git a/redaxo/src/core/vendor/symfony/console/Output/ConsoleOutput.php b/redaxo/src/core/vendor/symfony/console/Output/ConsoleOutput.php index e3aa92c7fc..c1eb7cd14b 100644 --- a/redaxo/src/core/vendor/symfony/console/Output/ConsoleOutput.php +++ b/redaxo/src/core/vendor/symfony/console/Output/ConsoleOutput.php @@ -64,18 +64,27 @@ public function section(): ConsoleSectionOutput return new ConsoleSectionOutput($this->getStream(), $this->consoleSectionOutputs, $this->getVerbosity(), $this->isDecorated(), $this->getFormatter()); } + /** + * @return void + */ public function setDecorated(bool $decorated) { parent::setDecorated($decorated); $this->stderr->setDecorated($decorated); } + /** + * @return void + */ public function setFormatter(OutputFormatterInterface $formatter) { parent::setFormatter($formatter); $this->stderr->setFormatter($formatter); } + /** + * @return void + */ public function setVerbosity(int $level) { parent::setVerbosity($level); @@ -87,6 +96,9 @@ public function getErrorOutput(): OutputInterface return $this->stderr; } + /** + * @return void + */ public function setErrorOutput(OutputInterface $error) { $this->stderr = $error; diff --git a/redaxo/src/core/vendor/symfony/console/Output/ConsoleOutputInterface.php b/redaxo/src/core/vendor/symfony/console/Output/ConsoleOutputInterface.php index 6b4babc6dd..9c0049c8f9 100644 --- a/redaxo/src/core/vendor/symfony/console/Output/ConsoleOutputInterface.php +++ b/redaxo/src/core/vendor/symfony/console/Output/ConsoleOutputInterface.php @@ -24,6 +24,9 @@ interface ConsoleOutputInterface extends OutputInterface */ public function getErrorOutput(): OutputInterface; + /** + * @return void + */ public function setErrorOutput(OutputInterface $error); public function section(): ConsoleSectionOutput; diff --git a/redaxo/src/core/vendor/symfony/console/Output/ConsoleSectionOutput.php b/redaxo/src/core/vendor/symfony/console/Output/ConsoleSectionOutput.php index c813c811ce..3f3f1434be 100644 --- a/redaxo/src/core/vendor/symfony/console/Output/ConsoleSectionOutput.php +++ b/redaxo/src/core/vendor/symfony/console/Output/ConsoleSectionOutput.php @@ -60,6 +60,8 @@ public function setMaxHeight(int $maxHeight): void * Clears previous output for this section. * * @param int $lines Number of lines to clear. If null, then the entire output of this section is cleared + * + * @return void */ public function clear(int $lines = null) { @@ -81,6 +83,8 @@ public function clear(int $lines = null) /** * Overwrites the previous output with a new message. + * + * @return void */ public function overwrite(string|iterable $message) { @@ -153,12 +157,15 @@ public function addContent(string $input, bool $newline = true): int /** * @internal */ - public function addNewLineOfInputSubmit() + public function addNewLineOfInputSubmit(): void { $this->content[] = \PHP_EOL; ++$this->lines; } + /** + * @return void + */ protected function doWrite(string $message, bool $newline) { if (!$this->isDecorated()) { diff --git a/redaxo/src/core/vendor/symfony/console/Output/NullOutput.php b/redaxo/src/core/vendor/symfony/console/Output/NullOutput.php index 4884cbad90..f3aa15b1d4 100644 --- a/redaxo/src/core/vendor/symfony/console/Output/NullOutput.php +++ b/redaxo/src/core/vendor/symfony/console/Output/NullOutput.php @@ -26,6 +26,9 @@ class NullOutput implements OutputInterface { private NullOutputFormatter $formatter; + /** + * @return void + */ public function setFormatter(OutputFormatterInterface $formatter) { // do nothing @@ -37,6 +40,9 @@ public function getFormatter(): OutputFormatterInterface return $this->formatter ??= new NullOutputFormatter(); } + /** + * @return void + */ public function setDecorated(bool $decorated) { // do nothing @@ -47,6 +53,9 @@ public function isDecorated(): bool return false; } + /** + * @return void + */ public function setVerbosity(int $level) { // do nothing @@ -77,11 +86,17 @@ public function isDebug(): bool return false; } + /** + * @return void + */ public function writeln(string|iterable $messages, int $options = self::OUTPUT_NORMAL) { // do nothing } + /** + * @return void + */ public function write(string|iterable $messages, bool $newline = false, int $options = self::OUTPUT_NORMAL) { // do nothing diff --git a/redaxo/src/core/vendor/symfony/console/Output/Output.php b/redaxo/src/core/vendor/symfony/console/Output/Output.php index 4cb71acbad..3a06311a8b 100644 --- a/redaxo/src/core/vendor/symfony/console/Output/Output.php +++ b/redaxo/src/core/vendor/symfony/console/Output/Output.php @@ -44,6 +44,9 @@ public function __construct(?int $verbosity = self::VERBOSITY_NORMAL, bool $deco $this->formatter->setDecorated($decorated); } + /** + * @return void + */ public function setFormatter(OutputFormatterInterface $formatter) { $this->formatter = $formatter; @@ -54,6 +57,9 @@ public function getFormatter(): OutputFormatterInterface return $this->formatter; } + /** + * @return void + */ public function setDecorated(bool $decorated) { $this->formatter->setDecorated($decorated); @@ -64,6 +70,9 @@ public function isDecorated(): bool return $this->formatter->isDecorated(); } + /** + * @return void + */ public function setVerbosity(int $level) { $this->verbosity = $level; @@ -94,11 +103,17 @@ public function isDebug(): bool return self::VERBOSITY_DEBUG <= $this->verbosity; } + /** + * @return void + */ public function writeln(string|iterable $messages, int $options = self::OUTPUT_NORMAL) { $this->write($messages, true, $options); } + /** + * @return void + */ public function write(string|iterable $messages, bool $newline = false, int $options = self::OUTPUT_NORMAL) { if (!is_iterable($messages)) { @@ -133,6 +148,8 @@ public function write(string|iterable $messages, bool $newline = false, int $opt /** * Writes a message to the output. + * + * @return void */ abstract protected function doWrite(string $message, bool $newline); } diff --git a/redaxo/src/core/vendor/symfony/console/Output/OutputInterface.php b/redaxo/src/core/vendor/symfony/console/Output/OutputInterface.php index bc927c51e9..fb1557720f 100644 --- a/redaxo/src/core/vendor/symfony/console/Output/OutputInterface.php +++ b/redaxo/src/core/vendor/symfony/console/Output/OutputInterface.php @@ -36,6 +36,8 @@ interface OutputInterface * @param bool $newline Whether to add a newline * @param int $options A bitmask of options (one of the OUTPUT or VERBOSITY constants), * 0 is considered the same as self::OUTPUT_NORMAL | self::VERBOSITY_NORMAL + * + * @return void */ public function write(string|iterable $messages, bool $newline = false, int $options = 0); @@ -44,11 +46,15 @@ public function write(string|iterable $messages, bool $newline = false, int $opt * * @param int $options A bitmask of options (one of the OUTPUT or VERBOSITY constants), * 0 is considered the same as self::OUTPUT_NORMAL | self::VERBOSITY_NORMAL + * + * @return void */ public function writeln(string|iterable $messages, int $options = 0); /** * Sets the verbosity of the output. + * + * @return void */ public function setVerbosity(int $level); @@ -79,6 +85,8 @@ public function isDebug(): bool; /** * Sets the decorated flag. + * + * @return void */ public function setDecorated(bool $decorated); @@ -87,6 +95,9 @@ public function setDecorated(bool $decorated); */ public function isDecorated(): bool; + /** + * @return void + */ public function setFormatter(OutputFormatterInterface $formatter); /** diff --git a/redaxo/src/core/vendor/symfony/console/Output/StreamOutput.php b/redaxo/src/core/vendor/symfony/console/Output/StreamOutput.php index 9ec524e4d2..155066ea0e 100644 --- a/redaxo/src/core/vendor/symfony/console/Output/StreamOutput.php +++ b/redaxo/src/core/vendor/symfony/console/Output/StreamOutput.php @@ -62,6 +62,9 @@ public function getStream() return $this->stream; } + /** + * @return void + */ protected function doWrite(string $message, bool $newline) { if ($newline) { diff --git a/redaxo/src/core/vendor/symfony/console/Output/TrimmedBufferOutput.php b/redaxo/src/core/vendor/symfony/console/Output/TrimmedBufferOutput.php index 1ca5a13e82..b00445ece8 100644 --- a/redaxo/src/core/vendor/symfony/console/Output/TrimmedBufferOutput.php +++ b/redaxo/src/core/vendor/symfony/console/Output/TrimmedBufferOutput.php @@ -45,6 +45,9 @@ public function fetch(): string return $content; } + /** + * @return void + */ protected function doWrite(string $message, bool $newline) { $this->buffer .= $message; diff --git a/redaxo/src/core/vendor/symfony/console/Question/Question.php b/redaxo/src/core/vendor/symfony/console/Question/Question.php index b06db9459b..26896bb531 100644 --- a/redaxo/src/core/vendor/symfony/console/Question/Question.php +++ b/redaxo/src/core/vendor/symfony/console/Question/Question.php @@ -146,12 +146,11 @@ public function setAutocompleterValues(?iterable $values): static if (\is_array($values)) { $values = $this->isAssoc($values) ? array_merge(array_keys($values), array_values($values)) : array_values($values); - $callback = static function () use ($values) { - return $values; - }; + $callback = static fn () => $values; } elseif ($values instanceof \Traversable) { - $valueCache = null; - $callback = static function () use ($values, &$valueCache) { + $callback = static function () use ($values) { + static $valueCache; + return $valueCache ??= iterator_to_array($values, false); }; } else { @@ -267,6 +266,9 @@ public function getNormalizer(): ?callable return $this->normalizer; } + /** + * @return bool + */ protected function isAssoc(array $array) { return (bool) \count(array_filter(array_keys($array), 'is_string')); diff --git a/redaxo/src/core/vendor/symfony/console/Resources/completion.bash b/redaxo/src/core/vendor/symfony/console/Resources/completion.bash index ad69eab0ff..0d76eacc3b 100644 --- a/redaxo/src/core/vendor/symfony/console/Resources/completion.bash +++ b/redaxo/src/core/vendor/symfony/console/Resources/completion.bash @@ -6,6 +6,16 @@ # https://symfony.com/doc/current/contributing/code/license.html _sf_{{ COMMAND_NAME }}() { + + # Use the default completion for shell redirect operators. + for w in '>' '>>' '&>' '<'; do + if [[ $w = "${COMP_WORDS[COMP_CWORD-1]}" ]]; then + compopt -o filenames + COMPREPLY=($(compgen -f -- "${COMP_WORDS[COMP_CWORD]}")) + return 0 + fi + done + # Use newline as only separator to allow space in completion values IFS=$'\n' local sf_cmd="${COMP_WORDS[0]}" diff --git a/redaxo/src/core/vendor/symfony/console/Style/OutputStyle.php b/redaxo/src/core/vendor/symfony/console/Style/OutputStyle.php index b694bb53a7..ddfa8decc2 100644 --- a/redaxo/src/core/vendor/symfony/console/Style/OutputStyle.php +++ b/redaxo/src/core/vendor/symfony/console/Style/OutputStyle.php @@ -30,6 +30,9 @@ public function __construct(OutputInterface $output) $this->output = $output; } + /** + * @return void + */ public function newLine(int $count = 1) { $this->output->write(str_repeat(\PHP_EOL, $count)); @@ -40,16 +43,25 @@ public function createProgressBar(int $max = 0): ProgressBar return new ProgressBar($this->output, $max); } + /** + * @return void + */ public function write(string|iterable $messages, bool $newline = false, int $type = self::OUTPUT_NORMAL) { $this->output->write($messages, $newline, $type); } + /** + * @return void + */ public function writeln(string|iterable $messages, int $type = self::OUTPUT_NORMAL) { $this->output->writeln($messages, $type); } + /** + * @return void + */ public function setVerbosity(int $level) { $this->output->setVerbosity($level); @@ -60,6 +72,9 @@ public function getVerbosity(): int return $this->output->getVerbosity(); } + /** + * @return void + */ public function setDecorated(bool $decorated) { $this->output->setDecorated($decorated); @@ -70,6 +85,9 @@ public function isDecorated(): bool return $this->output->isDecorated(); } + /** + * @return void + */ public function setFormatter(OutputFormatterInterface $formatter) { $this->output->setFormatter($formatter); @@ -100,6 +118,9 @@ public function isDebug(): bool return $this->output->isDebug(); } + /** + * @return OutputInterface + */ protected function getErrorOutput() { if (!$this->output instanceof ConsoleOutputInterface) { diff --git a/redaxo/src/core/vendor/symfony/console/Style/StyleInterface.php b/redaxo/src/core/vendor/symfony/console/Style/StyleInterface.php index 0bb1233946..e25a65bd24 100644 --- a/redaxo/src/core/vendor/symfony/console/Style/StyleInterface.php +++ b/redaxo/src/core/vendor/symfony/console/Style/StyleInterface.php @@ -20,51 +20,71 @@ interface StyleInterface { /** * Formats a command title. + * + * @return void */ public function title(string $message); /** * Formats a section title. + * + * @return void */ public function section(string $message); /** * Formats a list. + * + * @return void */ public function listing(array $elements); /** * Formats informational text. + * + * @return void */ public function text(string|array $message); /** * Formats a success result bar. + * + * @return void */ public function success(string|array $message); /** * Formats an error result bar. + * + * @return void */ public function error(string|array $message); /** * Formats an warning result bar. + * + * @return void */ public function warning(string|array $message); /** * Formats a note admonition. + * + * @return void */ public function note(string|array $message); /** * Formats a caution admonition. + * + * @return void */ public function caution(string|array $message); /** * Formats a table. + * + * @return void */ public function table(array $headers, array $rows); @@ -90,21 +110,29 @@ public function choice(string $question, array $choices, mixed $default = null): /** * Add newline(s). + * + * @return void */ public function newLine(int $count = 1); /** * Starts the progress output. + * + * @return void */ public function progressStart(int $max = 0); /** * Advances the progress output X steps. + * + * @return void */ public function progressAdvance(int $step = 1); /** * Finishes the progress output. + * + * @return void */ public function progressFinish(); } diff --git a/redaxo/src/core/vendor/symfony/console/Style/SymfonyStyle.php b/redaxo/src/core/vendor/symfony/console/Style/SymfonyStyle.php index 8fd6f849f9..cecce6c01b 100644 --- a/redaxo/src/core/vendor/symfony/console/Style/SymfonyStyle.php +++ b/redaxo/src/core/vendor/symfony/console/Style/SymfonyStyle.php @@ -60,6 +60,8 @@ public function __construct(InputInterface $input, OutputInterface $output) /** * Formats a message as a block of text. + * + * @return void */ public function block(string|array $messages, string $type = null, string $style = null, string $prefix = ' ', bool $padding = false, bool $escape = true) { @@ -70,6 +72,9 @@ public function block(string|array $messages, string $type = null, string $style $this->newLine(); } + /** + * @return void + */ public function title(string $message) { $this->autoPrependBlock(); @@ -80,6 +85,9 @@ public function title(string $message) $this->newLine(); } + /** + * @return void + */ public function section(string $message) { $this->autoPrependBlock(); @@ -90,17 +98,21 @@ public function section(string $message) $this->newLine(); } + /** + * @return void + */ public function listing(array $elements) { $this->autoPrependText(); - $elements = array_map(function ($element) { - return sprintf(' * %s', $element); - }, $elements); + $elements = array_map(fn ($element) => sprintf(' * %s', $element), $elements); $this->writeln($elements); $this->newLine(); } + /** + * @return void + */ public function text(string|array $message) { $this->autoPrependText(); @@ -113,27 +125,41 @@ public function text(string|array $message) /** * Formats a command comment. + * + * @return void */ public function comment(string|array $message) { $this->block($message, null, null, ' // ', false, false); } + /** + * @return void + */ public function success(string|array $message) { $this->block($message, 'OK', 'fg=black;bg=green', ' ', true); } + /** + * @return void + */ public function error(string|array $message) { $this->block($message, 'ERROR', 'fg=white;bg=red', ' ', true); } + /** + * @return void + */ public function warning(string|array $message) { $this->block($message, 'WARNING', 'fg=black;bg=yellow', ' ', true); } + /** + * @return void + */ public function note(string|array $message) { $this->block($message, 'NOTE', 'fg=yellow', ' ! '); @@ -141,17 +167,25 @@ public function note(string|array $message) /** * Formats an info message. + * + * @return void */ public function info(string|array $message) { $this->block($message, 'INFO', 'fg=green', ' ', true); } + /** + * @return void + */ public function caution(string|array $message) { $this->block($message, 'CAUTION', 'fg=white;bg=red', ' ! ', true); } + /** + * @return void + */ public function table(array $headers, array $rows) { $this->createTable() @@ -165,6 +199,8 @@ public function table(array $headers, array $rows) /** * Formats a horizontal table. + * + * @return void */ public function horizontalTable(array $headers, array $rows) { @@ -185,6 +221,8 @@ public function horizontalTable(array $headers, array $rows) * * 'A title' * * ['key' => 'value'] * * new TableSeparator() + * + * @return void */ public function definitionList(string|array|TableSeparator ...$list) { @@ -247,17 +285,26 @@ public function choice(string $question, array $choices, mixed $default = null, return $this->askQuestion($questionChoice); } + /** + * @return void + */ public function progressStart(int $max = 0) { $this->progressBar = $this->createProgressBar($max); $this->progressBar->start(); } + /** + * @return void + */ public function progressAdvance(int $step = 1) { $this->getProgressBar()->advance($step); } + /** + * @return void + */ public function progressFinish() { $this->getProgressBar()->finish(); @@ -311,6 +358,9 @@ public function askQuestion(Question $question): mixed return $answer; } + /** + * @return void + */ public function writeln(string|iterable $messages, int $type = self::OUTPUT_NORMAL) { if (!is_iterable($messages)) { @@ -323,6 +373,9 @@ public function writeln(string|iterable $messages, int $type = self::OUTPUT_NORM } } + /** + * @return void + */ public function write(string|iterable $messages, bool $newline = false, int $type = self::OUTPUT_NORMAL) { if (!is_iterable($messages)) { @@ -335,6 +388,9 @@ public function write(string|iterable $messages, bool $newline = false, int $typ } } + /** + * @return void + */ public function newLine(int $count = 1) { parent::newLine($count); @@ -381,7 +437,7 @@ private function autoPrependText(): void { $fetched = $this->bufferedOutput->fetch(); // Prepend new line if last char isn't EOL: - if (!str_ends_with($fetched, "\n")) { + if ($fetched && !str_ends_with($fetched, "\n")) { $this->newLine(); } } diff --git a/redaxo/src/core/vendor/symfony/console/Terminal.php b/redaxo/src/core/vendor/symfony/console/Terminal.php index 7d10b13ad5..3eda0376be 100644 --- a/redaxo/src/core/vendor/symfony/console/Terminal.php +++ b/redaxo/src/core/vendor/symfony/console/Terminal.php @@ -123,17 +123,15 @@ public static function hasSttyAvailable(): bool return self::$stty; } - // skip check if exec function is disabled - if (!\function_exists('exec')) { + // skip check if shell_exec function is disabled + if (!\function_exists('shell_exec')) { return false; } - exec('stty 2>&1', $output, $exitcode); - - return self::$stty = 0 === $exitcode; + return self::$stty = (bool) shell_exec('stty 2> '.('\\' === \DIRECTORY_SEPARATOR ? 'NUL' : '/dev/null')); } - private static function initDimensions() + private static function initDimensions(): void { if ('\\' === \DIRECTORY_SEPARATOR) { $ansicon = getenv('ANSICON'); @@ -167,7 +165,7 @@ private static function hasVt100Support(): bool /** * Initializes dimensions using the output of an stty columns line. */ - private static function initDimensionsUsingStty() + private static function initDimensionsUsingStty(): void { if ($sttyString = self::getSttyColumns()) { if (preg_match('/rows.(\d+);.columns.(\d+);/is', $sttyString, $matches)) { diff --git a/redaxo/src/core/vendor/symfony/console/Tester/TesterTrait.php b/redaxo/src/core/vendor/symfony/console/Tester/TesterTrait.php index 9670a49686..497b8c8c77 100644 --- a/redaxo/src/core/vendor/symfony/console/Tester/TesterTrait.php +++ b/redaxo/src/core/vendor/symfony/console/Tester/TesterTrait.php @@ -128,7 +128,7 @@ public function setInputs(array $inputs): static * * verbosity: Sets the output verbosity flag * * capture_stderr_separately: Make output of stdOut and stdErr separately available */ - private function initOutput(array $options) + private function initOutput(array $options): void { $this->captureStreamsIndependently = \array_key_exists('capture_stderr_separately', $options) && $options['capture_stderr_separately']; if (!$this->captureStreamsIndependently) { diff --git a/redaxo/src/core/vendor/symfony/console/composer.json b/redaxo/src/core/vendor/symfony/console/composer.json index 6cc6166d58..c34421299e 100644 --- a/redaxo/src/core/vendor/symfony/console/composer.json +++ b/redaxo/src/core/vendor/symfony/console/composer.json @@ -17,9 +17,9 @@ ], "require": { "php": ">=8.1", - "symfony/deprecation-contracts": "^2.1|^3", + "symfony/deprecation-contracts": "^2.5|^3", "symfony/polyfill-mbstring": "~1.0", - "symfony/service-contracts": "^1.1|^2|^3", + "symfony/service-contracts": "^2.5|^3", "symfony/string": "^5.4|^6.0" }, "require-dev": { @@ -34,12 +34,6 @@ "provide": { "psr/log-implementation": "1.0|2.0|3.0" }, - "suggest": { - "symfony/event-dispatcher": "", - "symfony/lock": "", - "symfony/process": "", - "psr/log": "For using the console logger" - }, "conflict": { "symfony/dependency-injection": "<5.4", "symfony/dotenv": "<5.4", diff --git a/redaxo/src/core/vendor/symfony/deprecation-contracts/composer.json b/redaxo/src/core/vendor/symfony/deprecation-contracts/composer.json index 774200fdcd..c6d02d8749 100644 --- a/redaxo/src/core/vendor/symfony/deprecation-contracts/composer.json +++ b/redaxo/src/core/vendor/symfony/deprecation-contracts/composer.json @@ -25,7 +25,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-main": "3.3-dev" + "dev-main": "3.4-dev" }, "thanks": { "name": "symfony/contracts", diff --git a/redaxo/src/core/vendor/symfony/http-foundation/AcceptHeader.php b/redaxo/src/core/vendor/symfony/http-foundation/AcceptHeader.php index 180e9604c7..853c000e00 100644 --- a/redaxo/src/core/vendor/symfony/http-foundation/AcceptHeader.php +++ b/redaxo/src/core/vendor/symfony/http-foundation/AcceptHeader.php @@ -46,11 +46,10 @@ public function __construct(array $items) */ public static function fromString(?string $headerValue): self { - $index = 0; - $parts = HeaderUtils::split($headerValue ?? '', ',;='); - return new self(array_map(function ($subParts) use (&$index) { + return new self(array_map(function ($subParts) { + static $index = 0; $part = array_shift($subParts); $attributes = HeaderUtils::combine($subParts); @@ -115,9 +114,7 @@ public function all(): array */ public function filter(string $pattern): self { - return new self(array_filter($this->items, function (AcceptHeaderItem $item) use ($pattern) { - return preg_match($pattern, $item->getValue()); - })); + return new self(array_filter($this->items, fn (AcceptHeaderItem $item) => preg_match($pattern, $item->getValue()))); } /** diff --git a/redaxo/src/core/vendor/symfony/http-foundation/BinaryFileResponse.php b/redaxo/src/core/vendor/symfony/http-foundation/BinaryFileResponse.php index 72cef7c0ea..cd716e590e 100644 --- a/redaxo/src/core/vendor/symfony/http-foundation/BinaryFileResponse.php +++ b/redaxo/src/core/vendor/symfony/http-foundation/BinaryFileResponse.php @@ -319,7 +319,7 @@ public function sendContent(): static while ('' !== $data) { $read = fwrite($out, $data); if (false === $read || connection_aborted()) { - break; + break 2; } if (0 < $length) { $length -= $read; @@ -358,6 +358,8 @@ public function getContent(): string|false /** * Trust X-Sendfile-Type header. + * + * @return void */ public static function trustXSendfileTypeHeader() { diff --git a/redaxo/src/core/vendor/symfony/http-foundation/ExpressionRequestMatcher.php b/redaxo/src/core/vendor/symfony/http-foundation/ExpressionRequestMatcher.php index 5628ea8bc1..fe65e920d9 100644 --- a/redaxo/src/core/vendor/symfony/http-foundation/ExpressionRequestMatcher.php +++ b/redaxo/src/core/vendor/symfony/http-foundation/ExpressionRequestMatcher.php @@ -29,6 +29,9 @@ class ExpressionRequestMatcher extends RequestMatcher private ExpressionLanguage $language; private Expression|string $expression; + /** + * @return void + */ public function setExpression(ExpressionLanguage $language, Expression|string $expression) { $this->language = $language; @@ -38,7 +41,7 @@ public function setExpression(ExpressionLanguage $language, Expression|string $e public function matches(Request $request): bool { if (!isset($this->language)) { - throw new \LogicException('Unable to match the request as the expression language is not available.'); + throw new \LogicException('Unable to match the request as the expression language is not available. Try running "composer require symfony/expression-language".'); } return $this->language->evaluate($this->expression, [ diff --git a/redaxo/src/core/vendor/symfony/http-foundation/FileBag.php b/redaxo/src/core/vendor/symfony/http-foundation/FileBag.php index 7ed39408fd..b74a02e2e1 100644 --- a/redaxo/src/core/vendor/symfony/http-foundation/FileBag.php +++ b/redaxo/src/core/vendor/symfony/http-foundation/FileBag.php @@ -31,12 +31,18 @@ public function __construct(array $parameters = []) $this->replace($parameters); } + /** + * @return void + */ public function replace(array $files = []) { $this->parameters = []; $this->add($files); } + /** + * @return void + */ public function set(string $key, mixed $value) { if (!\is_array($value) && !$value instanceof UploadedFile) { @@ -46,6 +52,9 @@ public function set(string $key, mixed $value) parent::set($key, $this->convertFileInformation($value)); } + /** + * @return void + */ public function add(array $files = []) { foreach ($files as $key => $file) { @@ -75,7 +84,7 @@ protected function convertFileInformation(array|UploadedFile $file): array|Uploa $file = new UploadedFile($file['tmp_name'], $file['name'], $file['type'], $file['error'], false); } } else { - $file = array_map(function ($v) { return $v instanceof UploadedFile || \is_array($v) ? $this->convertFileInformation($v) : $v; }, $file); + $file = array_map(fn ($v) => $v instanceof UploadedFile || \is_array($v) ? $this->convertFileInformation($v) : $v, $file); if (array_keys($keys) === $keys) { $file = array_filter($file); } diff --git a/redaxo/src/core/vendor/symfony/http-foundation/HeaderBag.php b/redaxo/src/core/vendor/symfony/http-foundation/HeaderBag.php index 0883024b3b..c49a239726 100644 --- a/redaxo/src/core/vendor/symfony/http-foundation/HeaderBag.php +++ b/redaxo/src/core/vendor/symfony/http-foundation/HeaderBag.php @@ -63,7 +63,7 @@ public function __toString(): string * * @param string|null $key The name of the headers to return or null to get them all * - * @return array>|array + * @return ($key is null ? array> : list) */ public function all(string $key = null): array { @@ -86,6 +86,8 @@ public function keys(): array /** * Replaces the current HTTP headers by a new set. + * + * @return void */ public function replace(array $headers = []) { @@ -95,6 +97,8 @@ public function replace(array $headers = []) /** * Adds new headers the current HTTP headers set. + * + * @return void */ public function add(array $headers) { @@ -126,6 +130,8 @@ public function get(string $key, string $default = null): ?string * * @param string|string[]|null $values The value or an array of values * @param bool $replace Whether to replace the actual value or not (true by default) + * + * @return void */ public function set(string $key, string|array|null $values, bool $replace = true) { @@ -170,6 +176,8 @@ public function contains(string $key, string $value): bool /** * Removes a header. + * + * @return void */ public function remove(string $key) { @@ -202,6 +210,8 @@ public function getDate(string $key, \DateTime $default = null): ?\DateTimeInter /** * Adds a custom Cache-Control directive. + * + * @return void */ public function addCacheControlDirective(string $key, bool|string $value = true) { @@ -228,6 +238,8 @@ public function getCacheControlDirective(string $key): bool|string|null /** * Removes a Cache-Control directive. + * + * @return void */ public function removeCacheControlDirective(string $key) { @@ -254,6 +266,9 @@ public function count(): int return \count($this->headers); } + /** + * @return string + */ protected function getCacheControlHeader() { ksort($this->cacheControl); diff --git a/redaxo/src/core/vendor/symfony/http-foundation/InputBag.php b/redaxo/src/core/vendor/symfony/http-foundation/InputBag.php index 877ac60f3a..77990f5711 100644 --- a/redaxo/src/core/vendor/symfony/http-foundation/InputBag.php +++ b/redaxo/src/core/vendor/symfony/http-foundation/InputBag.php @@ -43,7 +43,7 @@ public function get(string $key, mixed $default = null): string|int|float|bool|n /** * Replaces the current input values by a new set. */ - public function replace(array $inputs = []) + public function replace(array $inputs = []): void { $this->parameters = []; $this->add($inputs); @@ -52,7 +52,7 @@ public function replace(array $inputs = []) /** * Adds input values. */ - public function add(array $inputs = []) + public function add(array $inputs = []): void { foreach ($inputs as $input => $value) { $this->set($input, $value); @@ -64,7 +64,7 @@ public function add(array $inputs = []) * * @param string|int|float|bool|array|null $value */ - public function set(string $key, mixed $value) + public function set(string $key, mixed $value): void { if (null !== $value && !\is_scalar($value) && !\is_array($value) && !$value instanceof \Stringable) { throw new \InvalidArgumentException(sprintf('Expected a scalar, or an array as a 2nd argument to "%s()", "%s" given.', __METHOD__, get_debug_type($value))); @@ -73,6 +73,34 @@ public function set(string $key, mixed $value) $this->parameters[$key] = $value; } + /** + * Returns the parameter value converted to an enum. + * + * @template T of \BackedEnum + * + * @param class-string $class + * @param ?T $default + * + * @return ?T + */ + public function getEnum(string $key, string $class, \BackedEnum $default = null): ?\BackedEnum + { + try { + return parent::getEnum($key, $class, $default); + } catch (\UnexpectedValueException $e) { + throw new BadRequestException($e->getMessage(), $e->getCode(), $e); + } + } + + /** + * Returns the parameter value converted to string. + */ + public function getString(string $key, string $default = ''): string + { + // Shortcuts the parent method because the validation on scalar is already done in get(). + return (string) $this->get($key, $default); + } + public function filter(string $key, mixed $default = null, int $filter = \FILTER_DEFAULT, mixed $options = []): mixed { $value = $this->has($key) ? $this->all()[$key] : $default; @@ -90,6 +118,22 @@ public function filter(string $key, mixed $default = null, int $filter = \FILTER throw new \InvalidArgumentException(sprintf('A Closure must be passed to "%s()" when FILTER_CALLBACK is used, "%s" given.', __METHOD__, get_debug_type($options['options'] ?? null))); } - return filter_var($value, $filter, $options); + $options['flags'] ??= 0; + $nullOnFailure = $options['flags'] & \FILTER_NULL_ON_FAILURE; + $options['flags'] |= \FILTER_NULL_ON_FAILURE; + + $value = filter_var($value, $filter, $options); + + if (null !== $value || $nullOnFailure) { + return $value; + } + + $method = debug_backtrace(\DEBUG_BACKTRACE_IGNORE_ARGS | \DEBUG_BACKTRACE_PROVIDE_OBJECT, 2)[1]; + $method = ($method['object'] ?? null) === $this ? $method['function'] : 'filter'; + $hint = 'filter' === $method ? 'pass' : 'use method "filter()" with'; + + trigger_deprecation('symfony/http-foundation', '6.3', 'Ignoring invalid values when using "%s::%s(\'%s\')" is deprecated and will throw a "%s" in 7.0; '.$hint.' flag "FILTER_NULL_ON_FAILURE" to keep ignoring them.', $this::class, $method, $key, BadRequestException::class); + + return false; } } diff --git a/redaxo/src/core/vendor/symfony/http-foundation/IpUtils.php b/redaxo/src/core/vendor/symfony/http-foundation/IpUtils.php index 917eb6e1a4..ceab620c2f 100644 --- a/redaxo/src/core/vendor/symfony/http-foundation/IpUtils.php +++ b/redaxo/src/core/vendor/symfony/http-foundation/IpUtils.php @@ -18,6 +18,21 @@ */ class IpUtils { + public const PRIVATE_SUBNETS = [ + '127.0.0.0/8', // RFC1700 (Loopback) + '10.0.0.0/8', // RFC1918 + '192.168.0.0/16', // RFC1918 + '172.16.0.0/12', // RFC1918 + '169.254.0.0/16', // RFC3927 + '0.0.0.0/8', // RFC5735 + '240.0.0.0/4', // RFC1112 + '::1/128', // Loopback + 'fc00::/7', // Unique Local Address + 'fe80::/10', // Link Local Address + '::ffff:0:0/96', // IPv4 translations + '::/128', // Unspecified address + ]; + private static array $checkedIps = []; /** @@ -60,23 +75,23 @@ public static function checkIp(string $requestIp, string|array $ips): bool public static function checkIp4(string $requestIp, string $ip): bool { $cacheKey = $requestIp.'-'.$ip.'-v4'; - if (isset(self::$checkedIps[$cacheKey])) { - return self::$checkedIps[$cacheKey]; + if (null !== $cacheValue = self::getCacheResult($cacheKey)) { + return $cacheValue; } if (!filter_var($requestIp, \FILTER_VALIDATE_IP, \FILTER_FLAG_IPV4)) { - return self::$checkedIps[$cacheKey] = false; + return self::setCacheResult($cacheKey, false); } if (str_contains($ip, '/')) { [$address, $netmask] = explode('/', $ip, 2); if ('0' === $netmask) { - return self::$checkedIps[$cacheKey] = false !== filter_var($address, \FILTER_VALIDATE_IP, \FILTER_FLAG_IPV4); + return self::setCacheResult($cacheKey, false !== filter_var($address, \FILTER_VALIDATE_IP, \FILTER_FLAG_IPV4)); } if ($netmask < 0 || $netmask > 32) { - return self::$checkedIps[$cacheKey] = false; + return self::setCacheResult($cacheKey, false); } } else { $address = $ip; @@ -84,10 +99,10 @@ public static function checkIp4(string $requestIp, string $ip): bool } if (false === ip2long($address)) { - return self::$checkedIps[$cacheKey] = false; + return self::setCacheResult($cacheKey, false); } - return self::$checkedIps[$cacheKey] = 0 === substr_compare(sprintf('%032b', ip2long($requestIp)), sprintf('%032b', ip2long($address)), 0, $netmask); + return self::setCacheResult($cacheKey, 0 === substr_compare(sprintf('%032b', ip2long($requestIp)), sprintf('%032b', ip2long($address)), 0, $netmask)); } /** @@ -105,8 +120,8 @@ public static function checkIp4(string $requestIp, string $ip): bool public static function checkIp6(string $requestIp, string $ip): bool { $cacheKey = $requestIp.'-'.$ip.'-v6'; - if (isset(self::$checkedIps[$cacheKey])) { - return self::$checkedIps[$cacheKey]; + if (null !== $cacheValue = self::getCacheResult($cacheKey)) { + return $cacheValue; } if (!((\extension_loaded('sockets') && \defined('AF_INET6')) || @inet_pton('::1'))) { @@ -115,14 +130,14 @@ public static function checkIp6(string $requestIp, string $ip): bool // Check to see if we were given a IP4 $requestIp or $ip by mistake if (!filter_var($requestIp, \FILTER_VALIDATE_IP, \FILTER_FLAG_IPV6)) { - return self::$checkedIps[$cacheKey] = false; + return self::setCacheResult($cacheKey, false); } if (str_contains($ip, '/')) { [$address, $netmask] = explode('/', $ip, 2); if (!filter_var($address, \FILTER_VALIDATE_IP, \FILTER_FLAG_IPV6)) { - return self::$checkedIps[$cacheKey] = false; + return self::setCacheResult($cacheKey, false); } if ('0' === $netmask) { @@ -130,11 +145,11 @@ public static function checkIp6(string $requestIp, string $ip): bool } if ($netmask < 1 || $netmask > 128) { - return self::$checkedIps[$cacheKey] = false; + return self::setCacheResult($cacheKey, false); } } else { if (!filter_var($ip, \FILTER_VALIDATE_IP, \FILTER_FLAG_IPV6)) { - return self::$checkedIps[$cacheKey] = false; + return self::setCacheResult($cacheKey, false); } $address = $ip; @@ -145,7 +160,7 @@ public static function checkIp6(string $requestIp, string $ip): bool $bytesTest = unpack('n*', @inet_pton($requestIp)); if (!$bytesAddr || !$bytesTest) { - return self::$checkedIps[$cacheKey] = false; + return self::setCacheResult($cacheKey, false); } for ($i = 1, $ceil = ceil($netmask / 16); $i <= $ceil; ++$i) { @@ -153,11 +168,11 @@ public static function checkIp6(string $requestIp, string $ip): bool $left = ($left <= 16) ? $left : 16; $mask = ~(0xFFFF >> $left) & 0xFFFF; if (($bytesAddr[$i] & $mask) != ($bytesTest[$i] & $mask)) { - return self::$checkedIps[$cacheKey] = false; + return self::setCacheResult($cacheKey, false); } } - return self::$checkedIps[$cacheKey] = true; + return self::setCacheResult($cacheKey, true); } /** @@ -191,4 +206,36 @@ public static function anonymize(string $ip): string return $ip; } + + /** + * Checks if an IPv4 or IPv6 address is contained in the list of private IP subnets. + */ + public static function isPrivateIp(string $requestIp): bool + { + return self::checkIp($requestIp, self::PRIVATE_SUBNETS); + } + + private static function getCacheResult(string $cacheKey): ?bool + { + if (isset(self::$checkedIps[$cacheKey])) { + // Move the item last in cache (LRU) + $value = self::$checkedIps[$cacheKey]; + unset(self::$checkedIps[$cacheKey]); + self::$checkedIps[$cacheKey] = $value; + + return self::$checkedIps[$cacheKey]; + } + + return null; + } + + private static function setCacheResult(string $cacheKey, bool $result): bool + { + if (1000 < \count(self::$checkedIps)) { + // stop memory leak if there are many keys + self::$checkedIps = \array_slice(self::$checkedIps, 500, null, true); + } + + return self::$checkedIps[$cacheKey] = $result; + } } diff --git a/redaxo/src/core/vendor/symfony/http-foundation/ParameterBag.php b/redaxo/src/core/vendor/symfony/http-foundation/ParameterBag.php index 72c8f0949c..9d7012de35 100644 --- a/redaxo/src/core/vendor/symfony/http-foundation/ParameterBag.php +++ b/redaxo/src/core/vendor/symfony/http-foundation/ParameterBag.php @@ -60,6 +60,8 @@ public function keys(): array /** * Replaces the current parameters by a new set. + * + * @return void */ public function replace(array $parameters = []) { @@ -68,6 +70,8 @@ public function replace(array $parameters = []) /** * Adds parameters. + * + * @return void */ public function add(array $parameters = []) { @@ -79,6 +83,9 @@ public function get(string $key, mixed $default = null): mixed return \array_key_exists($key, $this->parameters) ? $this->parameters[$key] : $default; } + /** + * @return void + */ public function set(string $key, mixed $value) { $this->parameters[$key] = $value; @@ -94,6 +101,8 @@ public function has(string $key): bool /** * Removes a parameter. + * + * @return void */ public function remove(string $key) { @@ -105,7 +114,7 @@ public function remove(string $key) */ public function getAlpha(string $key, string $default = ''): string { - return preg_replace('/[^[:alpha:]]/', '', $this->get($key, $default)); + return preg_replace('/[^[:alpha:]]/', '', $this->getString($key, $default)); } /** @@ -113,7 +122,7 @@ public function getAlpha(string $key, string $default = ''): string */ public function getAlnum(string $key, string $default = ''): string { - return preg_replace('/[^[:alnum:]]/', '', $this->get($key, $default)); + return preg_replace('/[^[:alnum:]]/', '', $this->getString($key, $default)); } /** @@ -121,8 +130,20 @@ public function getAlnum(string $key, string $default = ''): string */ public function getDigits(string $key, string $default = ''): string { - // we need to remove - and + because they're allowed in the filter - return str_replace(['-', '+'], '', $this->filter($key, $default, \FILTER_SANITIZE_NUMBER_INT)); + return preg_replace('/[^[:digit:]]/', '', $this->getString($key, $default)); + } + + /** + * Returns the parameter as string. + */ + public function getString(string $key, string $default = ''): string + { + $value = $this->get($key, $default); + if (!\is_scalar($value) && !$value instanceof \Stringable) { + throw new \UnexpectedValueException(sprintf('Parameter value "%s" cannot be converted to "string".', $key)); + } + + return (string) $value; } /** @@ -130,7 +151,8 @@ public function getDigits(string $key, string $default = ''): string */ public function getInt(string $key, int $default = 0): int { - return (int) $this->get($key, $default); + // In 7.0 remove the fallback to 0, in case of failure an exception will be thrown + return $this->filter($key, $default, \FILTER_VALIDATE_INT, ['flags' => \FILTER_REQUIRE_SCALAR]) ?: 0; } /** @@ -138,13 +160,39 @@ public function getInt(string $key, int $default = 0): int */ public function getBoolean(string $key, bool $default = false): bool { - return $this->filter($key, $default, \FILTER_VALIDATE_BOOL); + return $this->filter($key, $default, \FILTER_VALIDATE_BOOL, ['flags' => \FILTER_REQUIRE_SCALAR]); + } + + /** + * Returns the parameter value converted to an enum. + * + * @template T of \BackedEnum + * + * @param class-string $class + * @param ?T $default + * + * @return ?T + */ + public function getEnum(string $key, string $class, \BackedEnum $default = null): ?\BackedEnum + { + $value = $this->get($key); + + if (null === $value) { + return $default; + } + + try { + return $class::from($value); + } catch (\ValueError|\TypeError $e) { + throw new \UnexpectedValueException(sprintf('Parameter "%s" cannot be converted to enum: %s.', $key, $e->getMessage()), $e->getCode(), $e); + } } /** * Filter key. * - * @param int $filter FILTER_* constant + * @param int $filter FILTER_* constant + * @param int|array{flags?: int, options?: array} $options Flags from FILTER_* constants * * @see https://php.net/filter-var */ @@ -162,11 +210,31 @@ public function filter(string $key, mixed $default = null, int $filter = \FILTER $options['flags'] = \FILTER_REQUIRE_ARRAY; } + if (\is_object($value) && !$value instanceof \Stringable) { + throw new \UnexpectedValueException(sprintf('Parameter value "%s" cannot be filtered.', $key)); + } + if ((\FILTER_CALLBACK & $filter) && !(($options['options'] ?? null) instanceof \Closure)) { throw new \InvalidArgumentException(sprintf('A Closure must be passed to "%s()" when FILTER_CALLBACK is used, "%s" given.', __METHOD__, get_debug_type($options['options'] ?? null))); } - return filter_var($value, $filter, $options); + $options['flags'] ??= 0; + $nullOnFailure = $options['flags'] & \FILTER_NULL_ON_FAILURE; + $options['flags'] |= \FILTER_NULL_ON_FAILURE; + + $value = filter_var($value, $filter, $options); + + if (null !== $value || $nullOnFailure) { + return $value; + } + + $method = debug_backtrace(\DEBUG_BACKTRACE_IGNORE_ARGS | \DEBUG_BACKTRACE_PROVIDE_OBJECT, 2)[1]; + $method = ($method['object'] ?? null) === $this ? $method['function'] : 'filter'; + $hint = 'filter' === $method ? 'pass' : 'use method "filter()" with'; + + trigger_deprecation('symfony/http-foundation', '6.3', 'Ignoring invalid values when using "%s::%s(\'%s\')" is deprecated and will throw an "%s" in 7.0; '.$hint.' flag "FILTER_NULL_ON_FAILURE" to keep ignoring them.', $this::class, $method, $key, \UnexpectedValueException::class); + + return false; } /** diff --git a/redaxo/src/core/vendor/symfony/http-foundation/Request.php b/redaxo/src/core/vendor/symfony/http-foundation/Request.php index 80866bb3ba..0bef6f8d70 100644 --- a/redaxo/src/core/vendor/symfony/http-foundation/Request.php +++ b/redaxo/src/core/vendor/symfony/http-foundation/Request.php @@ -89,6 +89,8 @@ class Request /** * Request body parameters ($_POST). * + * @see getPayload() for portability between content types + * * @var InputBag */ public $request; @@ -263,6 +265,8 @@ public function __construct(array $query = [], array $request = [], array $attri * @param array $files The FILES parameters * @param array $server The SERVER parameters * @param string|resource|null $content The raw body data + * + * @return void */ public function initialize(array $query = [], array $request = [], array $attributes = [], array $cookies = [], array $files = [], array $server = [], $content = null) { @@ -340,6 +344,10 @@ public static function create(string $uri, string $method = 'GET', array $parame $server['REQUEST_METHOD'] = strtoupper($method); $components = parse_url($uri); + if (false === $components) { + trigger_deprecation('symfony/http-foundation', '6.3', 'Calling "%s()" with an invalid URI is deprecated.', __METHOD__); + $components = []; + } if (isset($components['host'])) { $server['SERVER_NAME'] = $components['host']; $server['HTTP_HOST'] = $components['host']; @@ -417,6 +425,8 @@ public static function create(string $uri, string $method = 'GET', array $parame * This is mainly useful when you need to override the Request class * to keep BC with an existing system. It should not be used for any * other purpose. + * + * @return void */ public static function setFactory(?callable $callable) { @@ -521,6 +531,8 @@ public function __toString(): string * * It overrides $_GET, $_POST, $_REQUEST, $_SERVER, $_COOKIE. * $_FILES is never overridden, see rfc1867 + * + * @return void */ public function overrideGlobals() { @@ -561,6 +573,8 @@ public function overrideGlobals() * * @param array $proxies A list of trusted proxies, the string 'REMOTE_ADDR' will be replaced with $_SERVER['REMOTE_ADDR'] * @param int $trustedHeaderSet A bit field of Request::HEADER_*, to set which headers to trust from your proxies + * + * @return void */ public static function setTrustedProxies(array $proxies, int $trustedHeaderSet) { @@ -602,12 +616,12 @@ public static function getTrustedHeaderSet(): int * You should only list the hosts you manage using regexs. * * @param array $hostPatterns A list of trusted host patterns + * + * @return void */ public static function setTrustedHosts(array $hostPatterns) { - self::$trustedHostPatterns = array_map(function ($hostPattern) { - return sprintf('{%s}i', $hostPattern); - }, $hostPatterns); + self::$trustedHostPatterns = array_map(fn ($hostPattern) => sprintf('{%s}i', $hostPattern), $hostPatterns); // we need to reset trusted hosts on trusted host patterns change self::$trustedHosts = []; } @@ -650,6 +664,8 @@ public static function normalizeQueryString(?string $qs): string * If these methods are not protected against CSRF, this presents a possible vulnerability. * * The HTTP method can only be overridden when the real HTTP method is POST. + * + * @return void */ public static function enableHttpMethodParameterOverride() { @@ -735,6 +751,9 @@ public function hasSession(bool $skipIfUninitialized = false): bool return null !== $this->session && (!$skipIfUninitialized || $this->session instanceof SessionInterface); } + /** + * @return void + */ public function setSession(SessionInterface $session) { $this->session = $session; @@ -745,7 +764,7 @@ public function setSession(SessionInterface $session) * * @param callable(): SessionInterface $factory */ - public function setSessionFactory(callable $factory) + public function setSessionFactory(callable $factory): void { $this->session = $factory; } @@ -1155,6 +1174,8 @@ public function getHost(): string /** * Sets the request method. + * + * @return void */ public function setMethod(string $method) { @@ -1276,6 +1297,8 @@ public function getFormat(?string $mimeType): ?string * Associates a format with mime types. * * @param string|string[] $mimeTypes The associated mime types (the preferred one must be the first as it will be used as the content type) + * + * @return void */ public function setFormat(?string $format, string|array $mimeTypes) { @@ -1306,6 +1329,8 @@ public function getRequestFormat(?string $default = 'html'): ?string /** * Sets the request format. + * + * @return void */ public function setRequestFormat(?string $format) { @@ -1336,6 +1361,8 @@ public function getContentTypeFormat(): ?string /** * Sets the default locale. + * + * @return void */ public function setDefaultLocale(string $locale) { @@ -1356,6 +1383,8 @@ public function getDefaultLocale(): string /** * Sets the locale. + * + * @return void */ public function setLocale(string $locale) { @@ -1477,9 +1506,39 @@ public function getContent(bool $asResource = false) return $this->content; } + /** + * Gets the decoded form or json request body. + * + * @throws JsonException When the body cannot be decoded to an array + */ + public function getPayload(): InputBag + { + if ($this->request->count()) { + return clone $this->request; + } + + if ('' === $content = $this->getContent()) { + return new InputBag([]); + } + + try { + $content = json_decode($content, true, 512, \JSON_BIGINT_AS_STRING | \JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new JsonException('Could not decode request body.', $e->getCode(), $e); + } + + if (!\is_array($content)) { + throw new JsonException(sprintf('JSON content was expected to decode to an array, "%s" returned.', get_debug_type($content))); + } + + return new InputBag($content); + } + /** * Gets the request body decoded as array, typically from a JSON payload. * + * @see getPayload() for portability between content types + * * @throws JsonException When the body cannot be decoded to an array */ public function toArray(): array @@ -1693,6 +1752,9 @@ public function preferSafeContent(): bool * Copyright (c) 2005-2010 Zend Technologies USA Inc. (https://www.zend.com/) */ + /** + * @return string + */ protected function prepareRequestUri() { $requestUri = ''; @@ -1861,6 +1923,8 @@ protected function preparePathInfo(): string /** * Initializes HTTP request formats. + * + * @return void */ protected static function initializeFormats() { diff --git a/redaxo/src/core/vendor/symfony/http-foundation/RequestMatcher.php b/redaxo/src/core/vendor/symfony/http-foundation/RequestMatcher.php index c2addd36e8..8c5f1d8134 100644 --- a/redaxo/src/core/vendor/symfony/http-foundation/RequestMatcher.php +++ b/redaxo/src/core/vendor/symfony/http-foundation/RequestMatcher.php @@ -69,6 +69,8 @@ public function __construct(string $path = null, string $host = null, string|arr * Adds a check for the HTTP scheme. * * @param string|string[]|null $scheme An HTTP scheme or an array of HTTP schemes + * + * @return void */ public function matchScheme(string|array|null $scheme) { @@ -77,6 +79,8 @@ public function matchScheme(string|array|null $scheme) /** * Adds a check for the URL host name. + * + * @return void */ public function matchHost(?string $regexp) { @@ -87,6 +91,8 @@ public function matchHost(?string $regexp) * Adds a check for the the URL port. * * @param int|null $port The port number to connect to + * + * @return void */ public function matchPort(?int $port) { @@ -95,6 +101,8 @@ public function matchPort(?int $port) /** * Adds a check for the URL path info. + * + * @return void */ public function matchPath(?string $regexp) { @@ -105,6 +113,8 @@ public function matchPath(?string $regexp) * Adds a check for the client IP. * * @param string $ip A specific IP address or a range specified using IP/netmask like 192.168.1.0/24 + * + * @return void */ public function matchIp(string $ip) { @@ -115,20 +125,22 @@ public function matchIp(string $ip) * Adds a check for the client IP. * * @param string|string[]|null $ips A specific IP address or a range specified using IP/netmask like 192.168.1.0/24 + * + * @return void */ public function matchIps(string|array|null $ips) { $ips = null !== $ips ? (array) $ips : []; - $this->ips = array_reduce($ips, static function (array $ips, string $ip) { - return array_merge($ips, preg_split('/\s*,\s*/', $ip)); - }, []); + $this->ips = array_reduce($ips, static fn (array $ips, string $ip) => array_merge($ips, preg_split('/\s*,\s*/', $ip)), []); } /** * Adds a check for the HTTP method. * * @param string|string[]|null $method An HTTP method or an array of HTTP methods + * + * @return void */ public function matchMethod(string|array|null $method) { @@ -137,6 +149,8 @@ public function matchMethod(string|array|null $method) /** * Adds a check for request attribute. + * + * @return void */ public function matchAttribute(string $key, string $regexp) { diff --git a/redaxo/src/core/vendor/symfony/http-foundation/RequestMatcher/IpsRequestMatcher.php b/redaxo/src/core/vendor/symfony/http-foundation/RequestMatcher/IpsRequestMatcher.php index 2ddff038df..333612e2f2 100644 --- a/redaxo/src/core/vendor/symfony/http-foundation/RequestMatcher/IpsRequestMatcher.php +++ b/redaxo/src/core/vendor/symfony/http-foundation/RequestMatcher/IpsRequestMatcher.php @@ -30,9 +30,7 @@ class IpsRequestMatcher implements RequestMatcherInterface */ public function __construct(array|string $ips) { - $this->ips = array_reduce((array) $ips, static function (array $ips, string $ip) { - return array_merge($ips, preg_split('/\s*,\s*/', $ip)); - }, []); + $this->ips = array_reduce((array) $ips, static fn (array $ips, string $ip) => array_merge($ips, preg_split('/\s*,\s*/', $ip)), []); } public function matches(Request $request): bool diff --git a/redaxo/src/core/vendor/symfony/http-foundation/RequestMatcher/IsJsonRequestMatcher.php b/redaxo/src/core/vendor/symfony/http-foundation/RequestMatcher/IsJsonRequestMatcher.php index 5da46840f4..875f992be1 100644 --- a/redaxo/src/core/vendor/symfony/http-foundation/RequestMatcher/IsJsonRequestMatcher.php +++ b/redaxo/src/core/vendor/symfony/http-foundation/RequestMatcher/IsJsonRequestMatcher.php @@ -23,12 +23,6 @@ class IsJsonRequestMatcher implements RequestMatcherInterface { public function matches(Request $request): bool { - try { - json_decode($request->getContent(), true, 512, \JSON_BIGINT_AS_STRING | \JSON_THROW_ON_ERROR); - } catch (\JsonException) { - return false; - } - - return true; + return json_validate($request->getContent()); } } diff --git a/redaxo/src/core/vendor/symfony/http-foundation/RequestMatcher/MethodRequestMatcher.php b/redaxo/src/core/vendor/symfony/http-foundation/RequestMatcher/MethodRequestMatcher.php index c7a915980c..b37f6e3c87 100644 --- a/redaxo/src/core/vendor/symfony/http-foundation/RequestMatcher/MethodRequestMatcher.php +++ b/redaxo/src/core/vendor/symfony/http-foundation/RequestMatcher/MethodRequestMatcher.php @@ -32,9 +32,7 @@ class MethodRequestMatcher implements RequestMatcherInterface */ public function __construct(array|string $methods) { - $this->methods = array_reduce(array_map('strtoupper', (array) $methods), static function (array $methods, string $method) { - return array_merge($methods, preg_split('/\s*,\s*/', $method)); - }, []); + $this->methods = array_reduce(array_map('strtoupper', (array) $methods), static fn (array $methods, string $method) => array_merge($methods, preg_split('/\s*,\s*/', $method)), []); } public function matches(Request $request): bool diff --git a/redaxo/src/core/vendor/symfony/http-foundation/RequestMatcher/SchemeRequestMatcher.php b/redaxo/src/core/vendor/symfony/http-foundation/RequestMatcher/SchemeRequestMatcher.php index 4f5eabc2c5..9c9cd58b98 100644 --- a/redaxo/src/core/vendor/symfony/http-foundation/RequestMatcher/SchemeRequestMatcher.php +++ b/redaxo/src/core/vendor/symfony/http-foundation/RequestMatcher/SchemeRequestMatcher.php @@ -32,9 +32,7 @@ class SchemeRequestMatcher implements RequestMatcherInterface */ public function __construct(array|string $schemes) { - $this->schemes = array_reduce(array_map('strtolower', (array) $schemes), static function (array $schemes, string $scheme) { - return array_merge($schemes, preg_split('/\s*,\s*/', $scheme)); - }, []); + $this->schemes = array_reduce(array_map('strtolower', (array) $schemes), static fn (array $schemes, string $scheme) => array_merge($schemes, preg_split('/\s*,\s*/', $scheme)), []); } public function matches(Request $request): bool diff --git a/redaxo/src/core/vendor/symfony/http-foundation/RequestStack.php b/redaxo/src/core/vendor/symfony/http-foundation/RequestStack.php index 6b13fa1e6e..5aa8ba7934 100644 --- a/redaxo/src/core/vendor/symfony/http-foundation/RequestStack.php +++ b/redaxo/src/core/vendor/symfony/http-foundation/RequestStack.php @@ -31,6 +31,8 @@ class RequestStack * * This method should generally not be called directly as the stack * management should be taken care of by the application itself. + * + * @return void */ public function push(Request $request) { diff --git a/redaxo/src/core/vendor/symfony/http-foundation/Response.php b/redaxo/src/core/vendor/symfony/http-foundation/Response.php index c141cbc0bb..888c6ad858 100644 --- a/redaxo/src/core/vendor/symfony/http-foundation/Response.php +++ b/redaxo/src/core/vendor/symfony/http-foundation/Response.php @@ -211,6 +211,11 @@ class Response 511 => 'Network Authentication Required', // RFC6585 ]; + /** + * Tracks headers already sent in informational responses. + */ + private array $sentHeaders; + /** * @param int $status The HTTP status code (200 "OK" by default) * @@ -326,21 +331,54 @@ public function prepare(Request $request): static /** * Sends HTTP headers. * + * @param null|positive-int $statusCode The status code to use, override the statusCode property if set and not null + * * @return $this */ - public function sendHeaders(): static + public function sendHeaders(/* int $statusCode = null */): static { // headers have already been sent by the developer if (headers_sent()) { return $this; } + $statusCode = \func_num_args() > 0 ? func_get_arg(0) : null; + $informationalResponse = $statusCode >= 100 && $statusCode < 200; + if ($informationalResponse && !\function_exists('headers_send')) { + // skip informational responses if not supported by the SAPI + return $this; + } + // headers foreach ($this->headers->allPreserveCaseWithoutCookies() as $name => $values) { - $replace = 0 === strcasecmp($name, 'Content-Type'); - foreach ($values as $value) { + $newValues = $values; + $replace = false; + + // As recommended by RFC 8297, PHP automatically copies headers from previous 103 responses, we need to deal with that if headers changed + if (103 === $statusCode) { + $previousValues = $this->sentHeaders[$name] ?? null; + if ($previousValues === $values) { + // Header already sent in a previous response, it will be automatically copied in this response by PHP + continue; + } + + $replace = 0 === strcasecmp($name, 'Content-Type'); + + if (null !== $previousValues && array_diff($previousValues, $values)) { + header_remove($name); + $previousValues = null; + } + + $newValues = null === $previousValues ? $values : array_diff($values, $previousValues); + } + + foreach ($newValues as $value) { header($name.': '.$value, $replace, $this->statusCode); } + + if ($informationalResponse) { + $this->sentHeaders[$name] = $values; + } } // cookies @@ -348,8 +386,16 @@ public function sendHeaders(): static header('Set-Cookie: '.$cookie, false, $this->statusCode); } + if ($informationalResponse) { + headers_send($statusCode); + + return $this; + } + + $statusCode ??= $this->statusCode; + // status - header(sprintf('HTTP/%s %s %s', $this->version, $this->statusCode, $this->statusText), true, $this->statusCode); + header(sprintf('HTTP/%s %s %s', $this->version, $statusCode, $this->statusText), true, $statusCode); return $this; } diff --git a/redaxo/src/core/vendor/symfony/http-foundation/ResponseHeaderBag.php b/redaxo/src/core/vendor/symfony/http-foundation/ResponseHeaderBag.php index 9e8c5793a7..10450ca5e2 100644 --- a/redaxo/src/core/vendor/symfony/http-foundation/ResponseHeaderBag.php +++ b/redaxo/src/core/vendor/symfony/http-foundation/ResponseHeaderBag.php @@ -55,6 +55,9 @@ public function allPreserveCase(): array return $headers; } + /** + * @return array + */ public function allPreserveCaseWithoutCookies() { $headers = $this->allPreserveCase(); @@ -65,6 +68,9 @@ public function allPreserveCaseWithoutCookies() return $headers; } + /** + * @return void + */ public function replace(array $headers = []) { $this->headerNames = []; @@ -97,6 +103,9 @@ public function all(string $key = null): array return $headers; } + /** + * @return void + */ public function set(string $key, string|array|null $values, bool $replace = true) { $uniqueKey = strtr($key, self::UPPER, self::LOWER); @@ -125,6 +134,9 @@ public function set(string $key, string|array|null $values, bool $replace = true } } + /** + * @return void + */ public function remove(string $key) { $uniqueKey = strtr($key, self::UPPER, self::LOWER); @@ -157,6 +169,9 @@ public function getCacheControlDirective(string $key): bool|string|null return $this->computedCacheControl[$key] ?? null; } + /** + * @return void + */ public function setCookie(Cookie $cookie) { $this->cookies[$cookie->getDomain()][$cookie->getPath()][$cookie->getName()] = $cookie; @@ -165,6 +180,8 @@ public function setCookie(Cookie $cookie) /** * Removes a cookie from the array, but does not unset it in the browser. + * + * @return void */ public function removeCookie(string $name, ?string $path = '/', string $domain = null) { @@ -216,6 +233,8 @@ public function getCookies(string $format = self::COOKIES_FLAT): array /** * Clears a cookie in the browser. + * + * @return void */ public function clearCookie(string $name, ?string $path = '/', string $domain = null, bool $secure = false, bool $httpOnly = true, string $sameSite = null) { @@ -224,6 +243,8 @@ public function clearCookie(string $name, ?string $path = '/', string $domain = /** * @see HeaderUtils::makeDisposition() + * + * @return string */ public function makeDisposition(string $disposition, string $filename, string $filenameFallback = '') { diff --git a/redaxo/src/core/vendor/symfony/http-foundation/Session/Attribute/AttributeBag.php b/redaxo/src/core/vendor/symfony/http-foundation/Session/Attribute/AttributeBag.php index 6659617579..ad5a6590a5 100644 --- a/redaxo/src/core/vendor/symfony/http-foundation/Session/Attribute/AttributeBag.php +++ b/redaxo/src/core/vendor/symfony/http-foundation/Session/Attribute/AttributeBag.php @@ -36,11 +36,17 @@ public function getName(): string return $this->name; } + /** + * @return void + */ public function setName(string $name) { $this->name = $name; } + /** + * @return void + */ public function initialize(array &$attributes) { $this->attributes = &$attributes; @@ -61,6 +67,9 @@ public function get(string $name, mixed $default = null): mixed return \array_key_exists($name, $this->attributes) ? $this->attributes[$name] : $default; } + /** + * @return void + */ public function set(string $name, mixed $value) { $this->attributes[$name] = $value; @@ -71,6 +80,9 @@ public function all(): array return $this->attributes; } + /** + * @return void + */ public function replace(array $attributes) { $this->attributes = []; diff --git a/redaxo/src/core/vendor/symfony/http-foundation/Session/Attribute/AttributeBagInterface.php b/redaxo/src/core/vendor/symfony/http-foundation/Session/Attribute/AttributeBagInterface.php index 31a946444b..e8cd0b5a4d 100644 --- a/redaxo/src/core/vendor/symfony/http-foundation/Session/Attribute/AttributeBagInterface.php +++ b/redaxo/src/core/vendor/symfony/http-foundation/Session/Attribute/AttributeBagInterface.php @@ -32,6 +32,8 @@ public function get(string $name, mixed $default = null): mixed; /** * Sets an attribute. + * + * @return void */ public function set(string $name, mixed $value); @@ -42,6 +44,9 @@ public function set(string $name, mixed $value); */ public function all(): array; + /** + * @return void + */ public function replace(array $attributes); /** diff --git a/redaxo/src/core/vendor/symfony/http-foundation/Session/Flash/AutoExpireFlashBag.php b/redaxo/src/core/vendor/symfony/http-foundation/Session/Flash/AutoExpireFlashBag.php index 00b1ac9486..80bbeda0f8 100644 --- a/redaxo/src/core/vendor/symfony/http-foundation/Session/Flash/AutoExpireFlashBag.php +++ b/redaxo/src/core/vendor/symfony/http-foundation/Session/Flash/AutoExpireFlashBag.php @@ -35,11 +35,17 @@ public function getName(): string return $this->name; } + /** + * @return void + */ public function setName(string $name) { $this->name = $name; } + /** + * @return void + */ public function initialize(array &$flashes) { $this->flashes = &$flashes; @@ -51,6 +57,9 @@ public function initialize(array &$flashes) $this->flashes['new'] = []; } + /** + * @return void + */ public function add(string $type, mixed $message) { $this->flashes['new'][$type][] = $message; @@ -90,11 +99,17 @@ public function all(): array return $return; } + /** + * @return void + */ public function setAll(array $messages) { $this->flashes['new'] = $messages; } + /** + * @return void + */ public function set(string $type, string|array $messages) { $this->flashes['new'][$type] = (array) $messages; diff --git a/redaxo/src/core/vendor/symfony/http-foundation/Session/Flash/FlashBag.php b/redaxo/src/core/vendor/symfony/http-foundation/Session/Flash/FlashBag.php index a30d9528d1..659d59d186 100644 --- a/redaxo/src/core/vendor/symfony/http-foundation/Session/Flash/FlashBag.php +++ b/redaxo/src/core/vendor/symfony/http-foundation/Session/Flash/FlashBag.php @@ -35,16 +35,25 @@ public function getName(): string return $this->name; } + /** + * @return void + */ public function setName(string $name) { $this->name = $name; } + /** + * @return void + */ public function initialize(array &$flashes) { $this->flashes = &$flashes; } + /** + * @return void + */ public function add(string $type, mixed $message) { $this->flashes[$type][] = $message; @@ -81,11 +90,17 @@ public function all(): array return $return; } + /** + * @return void + */ public function set(string $type, string|array $messages) { $this->flashes[$type] = (array) $messages; } + /** + * @return void + */ public function setAll(array $messages) { $this->flashes = $messages; diff --git a/redaxo/src/core/vendor/symfony/http-foundation/Session/Flash/FlashBagInterface.php b/redaxo/src/core/vendor/symfony/http-foundation/Session/Flash/FlashBagInterface.php index cd10a23f3c..bbcf7f8b7d 100644 --- a/redaxo/src/core/vendor/symfony/http-foundation/Session/Flash/FlashBagInterface.php +++ b/redaxo/src/core/vendor/symfony/http-foundation/Session/Flash/FlashBagInterface.php @@ -22,11 +22,15 @@ interface FlashBagInterface extends SessionBagInterface { /** * Adds a flash message for the given type. + * + * @return void */ public function add(string $type, mixed $message); /** * Registers one or more messages for a given type. + * + * @return void */ public function set(string $type, string|array $messages); @@ -57,6 +61,8 @@ public function all(): array; /** * Sets all flash messages. + * + * @return void */ public function setAll(array $messages); diff --git a/redaxo/src/core/vendor/symfony/http-foundation/Session/Session.php b/redaxo/src/core/vendor/symfony/http-foundation/Session/Session.php index a55dde4821..b45be2f8c3 100644 --- a/redaxo/src/core/vendor/symfony/http-foundation/Session/Session.php +++ b/redaxo/src/core/vendor/symfony/http-foundation/Session/Session.php @@ -69,6 +69,9 @@ public function get(string $name, mixed $default = null): mixed return $this->getAttributeBag()->get($name, $default); } + /** + * @return void + */ public function set(string $name, mixed $value) { $this->getAttributeBag()->set($name, $value); @@ -79,6 +82,9 @@ public function all(): array return $this->getAttributeBag()->all(); } + /** + * @return void + */ public function replace(array $attributes) { $this->getAttributeBag()->replace($attributes); @@ -89,6 +95,9 @@ public function remove(string $name): mixed return $this->getAttributeBag()->remove($name); } + /** + * @return void + */ public function clear() { $this->getAttributeBag()->clear(); @@ -154,6 +163,9 @@ public function migrate(bool $destroy = false, int $lifetime = null): bool return $this->storage->regenerate($destroy, $lifetime); } + /** + * @return void + */ public function save() { $this->storage->save(); @@ -164,6 +176,9 @@ public function getId(): string return $this->storage->getId(); } + /** + * @return void + */ public function setId(string $id) { if ($this->storage->getId() !== $id) { @@ -176,6 +191,9 @@ public function getName(): string return $this->storage->getName(); } + /** + * @return void + */ public function setName(string $name) { $this->storage->setName($name); @@ -191,6 +209,9 @@ public function getMetadataBag(): MetadataBag return $this->storage->getMetadataBag(); } + /** + * @return void + */ public function registerBag(SessionBagInterface $bag) { $this->storage->registerBag(new SessionBagProxy($bag, $this->data, $this->usageIndex, $this->usageReporter)); diff --git a/redaxo/src/core/vendor/symfony/http-foundation/Session/SessionBagInterface.php b/redaxo/src/core/vendor/symfony/http-foundation/Session/SessionBagInterface.php index 821645d9b8..e1c2505549 100644 --- a/redaxo/src/core/vendor/symfony/http-foundation/Session/SessionBagInterface.php +++ b/redaxo/src/core/vendor/symfony/http-foundation/Session/SessionBagInterface.php @@ -25,6 +25,8 @@ public function getName(): string; /** * Initializes the Bag. + * + * @return void */ public function initialize(array &$array); diff --git a/redaxo/src/core/vendor/symfony/http-foundation/Session/SessionInterface.php b/redaxo/src/core/vendor/symfony/http-foundation/Session/SessionInterface.php index da2b3a37d6..534883d2d2 100644 --- a/redaxo/src/core/vendor/symfony/http-foundation/Session/SessionInterface.php +++ b/redaxo/src/core/vendor/symfony/http-foundation/Session/SessionInterface.php @@ -34,6 +34,8 @@ public function getId(): string; /** * Sets the session ID. + * + * @return void */ public function setId(string $id); @@ -44,6 +46,8 @@ public function getName(): string; /** * Sets the session name. + * + * @return void */ public function setName(string $name); @@ -78,6 +82,8 @@ public function migrate(bool $destroy = false, int $lifetime = null): bool; * This method is generally not required for real sessions as * the session will be automatically saved at the end of * code execution. + * + * @return void */ public function save(); @@ -93,6 +99,8 @@ public function get(string $name, mixed $default = null): mixed; /** * Sets an attribute. + * + * @return void */ public function set(string $name, mixed $value); @@ -103,6 +111,8 @@ public function all(): array; /** * Sets attributes. + * + * @return void */ public function replace(array $attributes); @@ -115,6 +125,8 @@ public function remove(string $name): mixed; /** * Clears all attributes. + * + * @return void */ public function clear(); @@ -125,6 +137,8 @@ public function isStarted(): bool; /** * Registers a SessionBagInterface with the session. + * + * @return void */ public function registerBag(SessionBagInterface $bag); diff --git a/redaxo/src/core/vendor/symfony/http-foundation/Session/SessionUtils.php b/redaxo/src/core/vendor/symfony/http-foundation/Session/SessionUtils.php index b5bce4a884..504c5848e9 100644 --- a/redaxo/src/core/vendor/symfony/http-foundation/Session/SessionUtils.php +++ b/redaxo/src/core/vendor/symfony/http-foundation/Session/SessionUtils.php @@ -25,7 +25,7 @@ final class SessionUtils * Finds the session header amongst the headers that are to be sent, removes it, and returns * it so the caller can process it further. */ - public static function popSessionCookie(string $sessionName, string $sessionId): ?string + public static function popSessionCookie(string $sessionName, #[\SensitiveParameter] string $sessionId): ?string { $sessionCookie = null; $sessionCookiePrefix = sprintf(' %s=', urlencode($sessionName)); diff --git a/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/Handler/AbstractSessionHandler.php b/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/Handler/AbstractSessionHandler.php index 88e513c5dd..288c24232c 100644 --- a/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/Handler/AbstractSessionHandler.php +++ b/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/Handler/AbstractSessionHandler.php @@ -38,13 +38,13 @@ public function open(string $savePath, string $sessionName): bool return true; } - abstract protected function doRead(string $sessionId): string; + abstract protected function doRead(#[\SensitiveParameter] string $sessionId): string; - abstract protected function doWrite(string $sessionId, string $data): bool; + abstract protected function doWrite(#[\SensitiveParameter] string $sessionId, string $data): bool; - abstract protected function doDestroy(string $sessionId): bool; + abstract protected function doDestroy(#[\SensitiveParameter] string $sessionId): bool; - public function validateId(string $sessionId): bool + public function validateId(#[\SensitiveParameter] string $sessionId): bool { $this->prefetchData = $this->read($sessionId); $this->prefetchId = $sessionId; @@ -52,7 +52,7 @@ public function validateId(string $sessionId): bool return '' !== $this->prefetchData; } - public function read(string $sessionId): string + public function read(#[\SensitiveParameter] string $sessionId): string { if (isset($this->prefetchId)) { $prefetchId = $this->prefetchId; @@ -72,7 +72,7 @@ public function read(string $sessionId): string return $data; } - public function write(string $sessionId, string $data): bool + public function write(#[\SensitiveParameter] string $sessionId, string $data): bool { // see https://github.com/igbinary/igbinary/issues/146 $this->igbinaryEmptyData ??= \function_exists('igbinary_serialize') ? igbinary_serialize([]) : ''; @@ -84,7 +84,7 @@ public function write(string $sessionId, string $data): bool return $this->doWrite($sessionId, $data); } - public function destroy(string $sessionId): bool + public function destroy(#[\SensitiveParameter] string $sessionId): bool { if (!headers_sent() && filter_var(\ini_get('session.use_cookies'), \FILTER_VALIDATE_BOOL)) { if (!isset($this->sessionName)) { diff --git a/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/Handler/MarshallingSessionHandler.php b/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/Handler/MarshallingSessionHandler.php index 9962fef3d6..1567f54332 100644 --- a/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/Handler/MarshallingSessionHandler.php +++ b/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/Handler/MarshallingSessionHandler.php @@ -37,7 +37,7 @@ public function close(): bool return $this->handler->close(); } - public function destroy(string $sessionId): bool + public function destroy(#[\SensitiveParameter] string $sessionId): bool { return $this->handler->destroy($sessionId); } @@ -47,12 +47,12 @@ public function gc(int $maxlifetime): int|false return $this->handler->gc($maxlifetime); } - public function read(string $sessionId): string + public function read(#[\SensitiveParameter] string $sessionId): string { return $this->marshaller->unmarshall($this->handler->read($sessionId)); } - public function write(string $sessionId, string $data): bool + public function write(#[\SensitiveParameter] string $sessionId, string $data): bool { $failed = []; $marshalledData = $this->marshaller->marshall(['data' => $data], $failed); @@ -64,12 +64,12 @@ public function write(string $sessionId, string $data): bool return $this->handler->write($sessionId, $marshalledData['data']); } - public function validateId(string $sessionId): bool + public function validateId(#[\SensitiveParameter] string $sessionId): bool { return $this->handler->validateId($sessionId); } - public function updateTimestamp(string $sessionId, string $data): bool + public function updateTimestamp(#[\SensitiveParameter] string $sessionId, string $data): bool { return $this->handler->updateTimestamp($sessionId, $data); } diff --git a/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/Handler/MemcachedSessionHandler.php b/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/Handler/MemcachedSessionHandler.php index 2bc29b459c..91a023ddbc 100644 --- a/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/Handler/MemcachedSessionHandler.php +++ b/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/Handler/MemcachedSessionHandler.php @@ -59,19 +59,19 @@ public function close(): bool return $this->memcached->quit(); } - protected function doRead(string $sessionId): string + protected function doRead(#[\SensitiveParameter] string $sessionId): string { return $this->memcached->get($this->prefix.$sessionId) ?: ''; } - public function updateTimestamp(string $sessionId, string $data): bool + public function updateTimestamp(#[\SensitiveParameter] string $sessionId, string $data): bool { $this->memcached->touch($this->prefix.$sessionId, $this->getCompatibleTtl()); return true; } - protected function doWrite(string $sessionId, string $data): bool + protected function doWrite(#[\SensitiveParameter] string $sessionId, string $data): bool { return $this->memcached->set($this->prefix.$sessionId, $data, $this->getCompatibleTtl()); } @@ -89,7 +89,7 @@ private function getCompatibleTtl(): int return $ttl; } - protected function doDestroy(string $sessionId): bool + protected function doDestroy(#[\SensitiveParameter] string $sessionId): bool { $result = $this->memcached->delete($this->prefix.$sessionId); diff --git a/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/Handler/MigratingSessionHandler.php b/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/Handler/MigratingSessionHandler.php index 1d42552368..8ed6a7b3fd 100644 --- a/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/Handler/MigratingSessionHandler.php +++ b/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/Handler/MigratingSessionHandler.php @@ -22,15 +22,8 @@ */ class MigratingSessionHandler implements \SessionHandlerInterface, \SessionUpdateTimestampHandlerInterface { - /** - * @var \SessionHandlerInterface&\SessionUpdateTimestampHandlerInterface - */ - private \SessionHandlerInterface $currentHandler; - - /** - * @var \SessionHandlerInterface&\SessionUpdateTimestampHandlerInterface - */ - private \SessionHandlerInterface $writeOnlyHandler; + private \SessionHandlerInterface&\SessionUpdateTimestampHandlerInterface $currentHandler; + private \SessionHandlerInterface&\SessionUpdateTimestampHandlerInterface $writeOnlyHandler; public function __construct(\SessionHandlerInterface $currentHandler, \SessionHandlerInterface $writeOnlyHandler) { @@ -53,7 +46,7 @@ public function close(): bool return $result; } - public function destroy(string $sessionId): bool + public function destroy(#[\SensitiveParameter] string $sessionId): bool { $result = $this->currentHandler->destroy($sessionId); $this->writeOnlyHandler->destroy($sessionId); @@ -77,13 +70,13 @@ public function open(string $savePath, string $sessionName): bool return $result; } - public function read(string $sessionId): string + public function read(#[\SensitiveParameter] string $sessionId): string { // No reading from new handler until switch-over return $this->currentHandler->read($sessionId); } - public function write(string $sessionId, string $sessionData): bool + public function write(#[\SensitiveParameter] string $sessionId, string $sessionData): bool { $result = $this->currentHandler->write($sessionId, $sessionData); $this->writeOnlyHandler->write($sessionId, $sessionData); @@ -91,13 +84,13 @@ public function write(string $sessionId, string $sessionData): bool return $result; } - public function validateId(string $sessionId): bool + public function validateId(#[\SensitiveParameter] string $sessionId): bool { // No reading from new handler until switch-over return $this->currentHandler->validateId($sessionId); } - public function updateTimestamp(string $sessionId, string $sessionData): bool + public function updateTimestamp(#[\SensitiveParameter] string $sessionId, string $sessionData): bool { $result = $this->currentHandler->updateTimestamp($sessionId, $sessionData); $this->writeOnlyHandler->updateTimestamp($sessionId, $sessionData); diff --git a/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/Handler/MongoDbSessionHandler.php b/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/Handler/MongoDbSessionHandler.php index 63c609ae21..5ea5b4ae7d 100644 --- a/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/Handler/MongoDbSessionHandler.php +++ b/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/Handler/MongoDbSessionHandler.php @@ -84,7 +84,7 @@ public function close(): bool return true; } - protected function doDestroy(string $sessionId): bool + protected function doDestroy(#[\SensitiveParameter] string $sessionId): bool { $this->getCollection()->deleteOne([ $this->options['id_field'] => $sessionId, @@ -100,7 +100,7 @@ public function gc(int $maxlifetime): int|false ])->getDeletedCount(); } - protected function doWrite(string $sessionId, string $data): bool + protected function doWrite(#[\SensitiveParameter] string $sessionId, string $data): bool { $ttl = ($this->ttl instanceof \Closure ? ($this->ttl)() : $this->ttl) ?? \ini_get('session.gc_maxlifetime'); $expiry = new UTCDateTime((time() + (int) $ttl) * 1000); @@ -120,7 +120,7 @@ protected function doWrite(string $sessionId, string $data): bool return true; } - public function updateTimestamp(string $sessionId, string $data): bool + public function updateTimestamp(#[\SensitiveParameter] string $sessionId, string $data): bool { $ttl = ($this->ttl instanceof \Closure ? ($this->ttl)() : $this->ttl) ?? \ini_get('session.gc_maxlifetime'); $expiry = new UTCDateTime((time() + (int) $ttl) * 1000); @@ -136,7 +136,7 @@ public function updateTimestamp(string $sessionId, string $data): bool return true; } - protected function doRead(string $sessionId): string + protected function doRead(#[\SensitiveParameter] string $sessionId): string { $dbData = $this->getCollection()->findOne([ $this->options['id_field'] => $sessionId, diff --git a/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/Handler/NullSessionHandler.php b/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/Handler/NullSessionHandler.php index 790ac2fedd..a77185e2eb 100644 --- a/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/Handler/NullSessionHandler.php +++ b/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/Handler/NullSessionHandler.php @@ -23,27 +23,27 @@ public function close(): bool return true; } - public function validateId(string $sessionId): bool + public function validateId(#[\SensitiveParameter] string $sessionId): bool { return true; } - protected function doRead(string $sessionId): string + protected function doRead(#[\SensitiveParameter] string $sessionId): string { return ''; } - public function updateTimestamp(string $sessionId, string $data): bool + public function updateTimestamp(#[\SensitiveParameter] string $sessionId, string $data): bool { return true; } - protected function doWrite(string $sessionId, string $data): bool + protected function doWrite(#[\SensitiveParameter] string $sessionId, string $data): bool { return true; } - protected function doDestroy(string $sessionId): bool + protected function doDestroy(#[\SensitiveParameter] string $sessionId): bool { return true; } diff --git a/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php b/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php index 06429b4ba0..a40a7bc77b 100644 --- a/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php +++ b/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php @@ -11,6 +11,9 @@ namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; +use Doctrine\DBAL\Schema\Schema; +use Doctrine\DBAL\Types\Types; + /** * Session handler using a PDO connection to read and write data. * @@ -148,7 +151,7 @@ class PdoSessionHandler extends AbstractSessionHandler * * @throws \InvalidArgumentException When PDO error mode is not PDO::ERRMODE_EXCEPTION */ - public function __construct(\PDO|string $pdoOrDsn = null, array $options = []) + public function __construct(#[\SensitiveParameter] \PDO|string $pdoOrDsn = null, #[\SensitiveParameter] array $options = []) { if ($pdoOrDsn instanceof \PDO) { if (\PDO::ERRMODE_EXCEPTION !== $pdoOrDsn->getAttribute(\PDO::ATTR_ERRMODE)) { @@ -175,6 +178,56 @@ public function __construct(\PDO|string $pdoOrDsn = null, array $options = []) $this->ttl = $options['ttl'] ?? null; } + /** + * Adds the Table to the Schema if it doesn't exist. + */ + public function configureSchema(Schema $schema, \Closure $isSameDatabase = null): void + { + if ($schema->hasTable($this->table) || ($isSameDatabase && !$isSameDatabase($this->getConnection()->exec(...)))) { + return; + } + + $table = $schema->createTable($this->table); + switch ($this->driver) { + case 'mysql': + $table->addColumn($this->idCol, Types::BINARY)->setLength(128)->setNotnull(true); + $table->addColumn($this->dataCol, Types::BLOB)->setNotnull(true); + $table->addColumn($this->lifetimeCol, Types::INTEGER)->setUnsigned(true)->setNotnull(true); + $table->addColumn($this->timeCol, Types::INTEGER)->setUnsigned(true)->setNotnull(true); + $table->addOption('collate', 'utf8mb4_bin'); + $table->addOption('engine', 'InnoDB'); + break; + case 'sqlite': + $table->addColumn($this->idCol, Types::TEXT)->setNotnull(true); + $table->addColumn($this->dataCol, Types::BLOB)->setNotnull(true); + $table->addColumn($this->lifetimeCol, Types::INTEGER)->setNotnull(true); + $table->addColumn($this->timeCol, Types::INTEGER)->setNotnull(true); + break; + case 'pgsql': + $table->addColumn($this->idCol, Types::STRING)->setLength(128)->setNotnull(true); + $table->addColumn($this->dataCol, Types::BINARY)->setNotnull(true); + $table->addColumn($this->lifetimeCol, Types::INTEGER)->setNotnull(true); + $table->addColumn($this->timeCol, Types::INTEGER)->setNotnull(true); + break; + case 'oci': + $table->addColumn($this->idCol, Types::STRING)->setLength(128)->setNotnull(true); + $table->addColumn($this->dataCol, Types::BLOB)->setNotnull(true); + $table->addColumn($this->lifetimeCol, Types::INTEGER)->setNotnull(true); + $table->addColumn($this->timeCol, Types::INTEGER)->setNotnull(true); + break; + case 'sqlsrv': + $table->addColumn($this->idCol, Types::TEXT)->setLength(128)->setNotnull(true); + $table->addColumn($this->dataCol, Types::BLOB)->setNotnull(true); + $table->addColumn($this->lifetimeCol, Types::INTEGER)->setUnsigned(true)->setNotnull(true); + $table->addColumn($this->timeCol, Types::INTEGER)->setUnsigned(true)->setNotnull(true); + break; + default: + throw new \DomainException(sprintf('Creating the session table is currently not implemented for PDO driver "%s".', $this->driver)); + } + $table->setPrimaryKey([$this->idCol]); + $table->addIndex([$this->lifetimeCol], $this->lifetimeCol.'_idx'); + } + /** * Creates the table to store sessions which can be called once for setup. * @@ -183,6 +236,8 @@ public function __construct(\PDO|string $pdoOrDsn = null, array $options = []) * saved in a BLOB. One could also use a shorter inlined varbinary column * if one was sure the data fits into it. * + * @return void + * * @throws \PDOException When the table already exists * @throws \DomainException When an unsupported PDO driver is used */ @@ -207,7 +262,7 @@ public function createTable() try { $this->pdo->exec($sql); - $this->pdo->exec("CREATE INDEX expiry ON $this->table ($this->lifetimeCol)"); + $this->pdo->exec("CREATE INDEX {$this->lifetimeCol}_idx ON $this->table ($this->lifetimeCol)"); } catch (\PDOException $e) { $this->rollback(); @@ -236,7 +291,7 @@ public function open(string $savePath, string $sessionName): bool return parent::open($savePath, $sessionName); } - public function read(string $sessionId): string + public function read(#[\SensitiveParameter] string $sessionId): string { try { return parent::read($sessionId); @@ -256,7 +311,7 @@ public function gc(int $maxlifetime): int|false return 0; } - protected function doDestroy(string $sessionId): bool + protected function doDestroy(#[\SensitiveParameter] string $sessionId): bool { // delete the record associated with this id $sql = "DELETE FROM $this->table WHERE $this->idCol = :id"; @@ -274,7 +329,7 @@ protected function doDestroy(string $sessionId): bool return true; } - protected function doWrite(string $sessionId, string $data): bool + protected function doWrite(#[\SensitiveParameter] string $sessionId, string $data): bool { $maxlifetime = (int) (($this->ttl instanceof \Closure ? ($this->ttl)() : $this->ttl) ?? \ini_get('session.gc_maxlifetime')); @@ -317,7 +372,7 @@ protected function doWrite(string $sessionId, string $data): bool return true; } - public function updateTimestamp(string $sessionId, string $data): bool + public function updateTimestamp(#[\SensitiveParameter] string $sessionId, string $data): bool { $expiry = time() + (int) (($this->ttl instanceof \Closure ? ($this->ttl)() : $this->ttl) ?? \ini_get('session.gc_maxlifetime')); @@ -325,8 +380,8 @@ public function updateTimestamp(string $sessionId, string $data): bool $updateStmt = $this->pdo->prepare( "UPDATE $this->table SET $this->lifetimeCol = :expiry, $this->timeCol = :time WHERE $this->idCol = :id" ); - $updateStmt->bindParam(':id', $sessionId, \PDO::PARAM_STR); - $updateStmt->bindParam(':expiry', $expiry, \PDO::PARAM_INT); + $updateStmt->bindValue(':id', $sessionId, \PDO::PARAM_STR); + $updateStmt->bindValue(':expiry', $expiry, \PDO::PARAM_INT); $updateStmt->bindValue(':time', time(), \PDO::PARAM_INT); $updateStmt->execute(); } catch (\PDOException $e) { @@ -366,7 +421,7 @@ public function close(): bool /** * Lazy-connects to the database. */ - private function connect(string $dsn): void + private function connect(#[\SensitiveParameter] string $dsn): void { $this->pdo = new \PDO($dsn, $this->username, $this->password, $this->connectionOptions); $this->pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); @@ -378,7 +433,7 @@ private function connect(string $dsn): void * * @todo implement missing support for oci DSN (which look totally different from other PDO ones) */ - private function buildDsnFromUrl(string $dsnOrUrl): string + private function buildDsnFromUrl(#[\SensitiveParameter] string $dsnOrUrl): string { // (pdo_)?sqlite3?:///... => (pdo_)?sqlite3?://localhost/... or else the URL will be invalid $url = preg_replace('#^((?:pdo_)?sqlite3?):///#', '$1://localhost/', $dsnOrUrl); @@ -561,7 +616,7 @@ private function rollback(): void * We need to make sure we do not return session data that is already considered garbage according * to the session.gc_maxlifetime setting because gc() is called after read() and only sometimes. */ - protected function doRead(string $sessionId): string + protected function doRead(#[\SensitiveParameter] string $sessionId): string { if (self::LOCK_ADVISORY === $this->lockMode) { $this->unlockStatements[] = $this->doAdvisoryLock($sessionId); @@ -632,7 +687,7 @@ protected function doRead(string $sessionId): string * - for oci using DBMS_LOCK.REQUEST * - for sqlsrv using sp_getapplock with LockOwner = Session */ - private function doAdvisoryLock(string $sessionId): \PDOStatement + private function doAdvisoryLock(#[\SensitiveParameter] string $sessionId): \PDOStatement { switch ($this->driver) { case 'mysql': @@ -731,7 +786,7 @@ private function getSelectSql(): string /** * Returns an insert statement supported by the database for writing session data. */ - private function getInsertStatement(string $sessionId, string $sessionData, int $maxlifetime): \PDOStatement + private function getInsertStatement(#[\SensitiveParameter] string $sessionId, string $sessionData, int $maxlifetime): \PDOStatement { switch ($this->driver) { case 'oci': @@ -758,7 +813,7 @@ private function getInsertStatement(string $sessionId, string $sessionData, int /** * Returns an update statement supported by the database for writing session data. */ - private function getUpdateStatement(string $sessionId, string $sessionData, int $maxlifetime): \PDOStatement + private function getUpdateStatement(#[\SensitiveParameter] string $sessionId, string $sessionData, int $maxlifetime): \PDOStatement { switch ($this->driver) { case 'oci': @@ -785,7 +840,7 @@ private function getUpdateStatement(string $sessionId, string $sessionData, int /** * Returns a merge/upsert (i.e. insert or update) statement when supported by the database for writing session data. */ - private function getMergeStatement(string $sessionId, string $data, int $maxlifetime): ?\PDOStatement + private function getMergeStatement(#[\SensitiveParameter] string $sessionId, string $data, int $maxlifetime): ?\PDOStatement { switch (true) { case 'mysql' === $this->driver: diff --git a/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/Handler/RedisSessionHandler.php b/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/Handler/RedisSessionHandler.php index 38f488644d..b696eee4b7 100644 --- a/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/Handler/RedisSessionHandler.php +++ b/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/Handler/RedisSessionHandler.php @@ -12,6 +12,7 @@ namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; use Predis\Response\ErrorInterface; +use Relay\Relay; /** * Redis based session storage handler based on the Redis class @@ -39,7 +40,7 @@ class RedisSessionHandler extends AbstractSessionHandler * @throws \InvalidArgumentException When unsupported client or options are passed */ public function __construct( - private \Redis|\RedisArray|\RedisCluster|\Predis\ClientInterface $redis, + private \Redis|Relay|\RedisArray|\RedisCluster|\Predis\ClientInterface $redis, array $options = [], ) { if ($diff = array_diff(array_keys($options), ['prefix', 'ttl'])) { @@ -50,12 +51,12 @@ public function __construct( $this->ttl = $options['ttl'] ?? null; } - protected function doRead(string $sessionId): string + protected function doRead(#[\SensitiveParameter] string $sessionId): string { return $this->redis->get($this->prefix.$sessionId) ?: ''; } - protected function doWrite(string $sessionId, string $data): bool + protected function doWrite(#[\SensitiveParameter] string $sessionId, string $data): bool { $ttl = ($this->ttl instanceof \Closure ? ($this->ttl)() : $this->ttl) ?? \ini_get('session.gc_maxlifetime'); $result = $this->redis->setEx($this->prefix.$sessionId, (int) $ttl, $data); @@ -63,7 +64,7 @@ protected function doWrite(string $sessionId, string $data): bool return $result && !$result instanceof ErrorInterface; } - protected function doDestroy(string $sessionId): bool + protected function doDestroy(#[\SensitiveParameter] string $sessionId): bool { static $unlink = true; @@ -93,7 +94,7 @@ public function gc(int $maxlifetime): int|false return 0; } - public function updateTimestamp(string $sessionId, string $data): bool + public function updateTimestamp(#[\SensitiveParameter] string $sessionId, string $data): bool { $ttl = ($this->ttl instanceof \Closure ? ($this->ttl)() : $this->ttl) ?? \ini_get('session.gc_maxlifetime'); diff --git a/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/Handler/SessionHandlerFactory.php b/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/Handler/SessionHandlerFactory.php index e390c8feea..aac62296ef 100644 --- a/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/Handler/SessionHandlerFactory.php +++ b/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/Handler/SessionHandlerFactory.php @@ -11,7 +11,11 @@ namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; +use Doctrine\DBAL\Configuration; use Doctrine\DBAL\DriverManager; +use Doctrine\DBAL\Schema\DefaultSchemaManagerFactory; +use Doctrine\DBAL\Tools\DsnParser; +use Relay\Relay; use Symfony\Component\Cache\Adapter\AbstractAdapter; /** @@ -32,6 +36,7 @@ public static function createHandler(object|string $connection, array $options = switch (true) { case $connection instanceof \Redis: + case $connection instanceof Relay: case $connection instanceof \RedisArray: case $connection instanceof \RedisCluster: case $connection instanceof \Predis\ClientInterface: @@ -54,7 +59,7 @@ public static function createHandler(object|string $connection, array $options = case str_starts_with($connection, 'rediss:'): case str_starts_with($connection, 'memcached:'): if (!class_exists(AbstractAdapter::class)) { - throw new \InvalidArgumentException(sprintf('Unsupported DSN "%s". Try running "composer require symfony/cache".', $connection)); + throw new \InvalidArgumentException('Unsupported Redis or Memcached DSN. Try running "composer require symfony/cache".'); } $handlerClass = str_starts_with($connection, 'memcached:') ? MemcachedSessionHandler::class : RedisSessionHandler::class; $connection = AbstractAdapter::createConnection($connection, ['lazy' => true]); @@ -63,9 +68,17 @@ public static function createHandler(object|string $connection, array $options = case str_starts_with($connection, 'pdo_oci://'): if (!class_exists(DriverManager::class)) { - throw new \InvalidArgumentException(sprintf('Unsupported DSN "%s". Try running "composer require doctrine/dbal".', $connection)); + throw new \InvalidArgumentException('Unsupported PDO OCI DSN. Try running "composer require doctrine/dbal".'); } - $connection = DriverManager::getConnection(['url' => $connection])->getWrappedConnection(); + $connection[3] = '-'; + $params = class_exists(DsnParser::class) ? (new DsnParser())->parse($connection) : ['url' => $connection]; + $config = new Configuration(); + if (class_exists(DefaultSchemaManagerFactory::class)) { + $config->setSchemaManagerFactory(new DefaultSchemaManagerFactory()); + } + + $connection = DriverManager::getConnection($params, $config); + $connection = method_exists($connection, 'getNativeConnection') ? $connection->getNativeConnection() : $connection->getWrappedConnection(); // no break; case str_starts_with($connection, 'mssql://'): diff --git a/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/Handler/StrictSessionHandler.php b/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/Handler/StrictSessionHandler.php index 1a16364815..1f86687447 100644 --- a/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/Handler/StrictSessionHandler.php +++ b/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/Handler/StrictSessionHandler.php @@ -47,22 +47,22 @@ public function open(string $savePath, string $sessionName): bool return $this->handler->open($savePath, $sessionName); } - protected function doRead(string $sessionId): string + protected function doRead(#[\SensitiveParameter] string $sessionId): string { return $this->handler->read($sessionId); } - public function updateTimestamp(string $sessionId, string $data): bool + public function updateTimestamp(#[\SensitiveParameter] string $sessionId, string $data): bool { return $this->write($sessionId, $data); } - protected function doWrite(string $sessionId, string $data): bool + protected function doWrite(#[\SensitiveParameter] string $sessionId, string $data): bool { return $this->handler->write($sessionId, $data); } - public function destroy(string $sessionId): bool + public function destroy(#[\SensitiveParameter] string $sessionId): bool { $this->doDestroy = true; $destroyed = parent::destroy($sessionId); @@ -70,7 +70,7 @@ public function destroy(string $sessionId): bool return $this->doDestroy ? $this->doDestroy($sessionId) : $destroyed; } - protected function doDestroy(string $sessionId): bool + protected function doDestroy(#[\SensitiveParameter] string $sessionId): bool { $this->doDestroy = false; diff --git a/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/MetadataBag.php b/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/MetadataBag.php index 2c77f9db6c..ebe4b748ad 100644 --- a/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/MetadataBag.php +++ b/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/MetadataBag.php @@ -51,6 +51,9 @@ public function __construct(string $storageKey = '_sf2_meta', int $updateThresho $this->updateThreshold = $updateThreshold; } + /** + * @return void + */ public function initialize(array &$array) { $this->meta = &$array; @@ -82,6 +85,8 @@ public function getLifetime(): int * will leave the system settings unchanged, 0 sets the cookie * to expire with browser session. Time is in seconds, and is * not a Unix timestamp. + * + * @return void */ public function stampNew(int $lifetime = null) { @@ -126,6 +131,8 @@ public function getName(): string /** * Sets name. + * + * @return void */ public function setName(string $name) { diff --git a/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/MockArraySessionStorage.php b/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/MockArraySessionStorage.php index 67fa0f95e0..d30b56d691 100644 --- a/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/MockArraySessionStorage.php +++ b/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/MockArraySessionStorage.php @@ -68,6 +68,9 @@ public function __construct(string $name = 'MOCKSESSID', MetadataBag $metaBag = $this->setMetadataBag($metaBag); } + /** + * @return void + */ public function setSessionData(array $array) { $this->data = $array; @@ -105,6 +108,9 @@ public function getId(): string return $this->id; } + /** + * @return void + */ public function setId(string $id) { if ($this->started) { @@ -119,11 +125,17 @@ public function getName(): string return $this->name; } + /** + * @return void + */ public function setName(string $name) { $this->name = $name; } + /** + * @return void + */ public function save() { if (!$this->started || $this->closed) { @@ -134,6 +146,9 @@ public function save() $this->started = false; } + /** + * @return void + */ public function clear() { // clear out the bags @@ -148,6 +163,9 @@ public function clear() $this->loadSession(); } + /** + * @return void + */ public function registerBag(SessionBagInterface $bag) { $this->bags[$bag->getName()] = $bag; @@ -171,6 +189,9 @@ public function isStarted(): bool return $this->started; } + /** + * @return void + */ public function setMetadataBag(MetadataBag $bag = null) { if (1 > \func_num_args()) { @@ -198,6 +219,9 @@ protected function generateId(): string return hash('sha256', uniqid('ss_mock_', true)); } + /** + * @return void + */ protected function loadSession() { $bags = array_merge($this->bags, [$this->metadataBag]); diff --git a/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/MockFileSessionStorage.php b/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/MockFileSessionStorage.php index 28771ad54e..95f69f2e13 100644 --- a/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/MockFileSessionStorage.php +++ b/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/MockFileSessionStorage.php @@ -73,6 +73,9 @@ public function regenerate(bool $destroy = false, int $lifetime = null): bool return parent::regenerate($destroy, $lifetime); } + /** + * @return void + */ public function save() { if (!$this->started) { diff --git a/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php b/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php index 8b89478820..7c6b6f9296 100644 --- a/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php +++ b/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php @@ -183,6 +183,9 @@ public function getId(): string return $this->saveHandler->getId(); } + /** + * @return void + */ public function setId(string $id) { $this->saveHandler->setId($id); @@ -193,6 +196,9 @@ public function getName(): string return $this->saveHandler->getName(); } + /** + * @return void + */ public function setName(string $name) { $this->saveHandler->setName($name); @@ -222,6 +228,9 @@ public function regenerate(bool $destroy = false, int $lifetime = null): bool return session_regenerate_id($destroy); } + /** + * @return void + */ public function save() { // Store a copy so we can restore the bags in case the session was not left empty @@ -261,6 +270,9 @@ public function save() $this->started = false; } + /** + * @return void + */ public function clear() { // clear out the bags @@ -275,6 +287,9 @@ public function clear() $this->loadSession(); } + /** + * @return void + */ public function registerBag(SessionBagInterface $bag) { if ($this->started) { @@ -299,6 +314,9 @@ public function getBag(string $name): SessionBagInterface return $this->bags[$name]; } + /** + * @return void + */ public function setMetadataBag(MetadataBag $metaBag = null) { if (1 > \func_num_args()) { @@ -329,6 +347,8 @@ public function isStarted(): bool * @param array $options Session ini directives [key => value] * * @see https://php.net/session.configuration + * + * @return void */ public function setOptions(array $options) { @@ -372,6 +392,8 @@ public function setOptions(array $options) * @see https://php.net/sessionhandlerinterface * @see https://php.net/sessionhandler * + * @return void + * * @throws \InvalidArgumentException */ public function setSaveHandler(AbstractProxy|\SessionHandlerInterface $saveHandler = null) @@ -404,6 +426,8 @@ public function setSaveHandler(AbstractProxy|\SessionHandlerInterface $saveHandl * are set to (either PHP's internal, or a custom save handler set with session_set_save_handler()). * PHP takes the return value from the read() handler, unserializes it * and populates $_SESSION with the result automatically. + * + * @return void */ protected function loadSession(array &$session = null) { diff --git a/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/PhpBridgeSessionStorage.php b/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/PhpBridgeSessionStorage.php index eed748f811..28cb3c3d05 100644 --- a/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/PhpBridgeSessionStorage.php +++ b/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/PhpBridgeSessionStorage.php @@ -41,6 +41,9 @@ public function start(): bool return true; } + /** + * @return void + */ public function clear() { // clear out the bags and nothing else that may be set diff --git a/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/Proxy/AbstractProxy.php b/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/Proxy/AbstractProxy.php index 1845ee2c9e..2fcd06b10b 100644 --- a/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/Proxy/AbstractProxy.php +++ b/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/Proxy/AbstractProxy.php @@ -71,6 +71,8 @@ public function getId(): string /** * Sets the session ID. * + * @return void + * * @throws \LogicException */ public function setId(string $id) @@ -93,6 +95,8 @@ public function getName(): string /** * Sets the session name. * + * @return void + * * @throws \LogicException */ public function setName(string $name) diff --git a/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/Proxy/SessionHandlerProxy.php b/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/Proxy/SessionHandlerProxy.php index c292e58f05..7bf3f9ff1e 100644 --- a/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/Proxy/SessionHandlerProxy.php +++ b/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/Proxy/SessionHandlerProxy.php @@ -44,17 +44,17 @@ public function close(): bool return $this->handler->close(); } - public function read(string $sessionId): string|false + public function read(#[\SensitiveParameter] string $sessionId): string|false { return $this->handler->read($sessionId); } - public function write(string $sessionId, string $data): bool + public function write(#[\SensitiveParameter] string $sessionId, string $data): bool { return $this->handler->write($sessionId, $data); } - public function destroy(string $sessionId): bool + public function destroy(#[\SensitiveParameter] string $sessionId): bool { return $this->handler->destroy($sessionId); } @@ -64,12 +64,12 @@ public function gc(int $maxlifetime): int|false return $this->handler->gc($maxlifetime); } - public function validateId(string $sessionId): bool + public function validateId(#[\SensitiveParameter] string $sessionId): bool { return !$this->handler instanceof \SessionUpdateTimestampHandlerInterface || $this->handler->validateId($sessionId); } - public function updateTimestamp(string $sessionId, string $data): bool + public function updateTimestamp(#[\SensitiveParameter] string $sessionId, string $data): bool { return $this->handler instanceof \SessionUpdateTimestampHandlerInterface ? $this->handler->updateTimestamp($sessionId, $data) : $this->write($sessionId, $data); } diff --git a/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/SessionStorageInterface.php b/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/SessionStorageInterface.php index 8bd62a43ae..ed2189e4e7 100644 --- a/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/SessionStorageInterface.php +++ b/redaxo/src/core/vendor/symfony/http-foundation/Session/Storage/SessionStorageInterface.php @@ -40,6 +40,8 @@ public function getId(): string; /** * Sets the session ID. + * + * @return void */ public function setId(string $id); @@ -50,6 +52,8 @@ public function getName(): string; /** * Sets the session name. + * + * @return void */ public function setName(string $name); @@ -90,6 +94,8 @@ public function regenerate(bool $destroy = false, int $lifetime = null): bool; * a real PHP session would interfere with testing, in which case * it should actually persist the session data if required. * + * @return void + * * @throws \RuntimeException if the session is saved without being started, or if the session * is already closed */ @@ -97,6 +103,8 @@ public function save(); /** * Clear all session data in memory. + * + * @return void */ public function clear(); @@ -109,6 +117,8 @@ public function getBag(string $name): SessionBagInterface; /** * Registers a SessionBagInterface for use. + * + * @return void */ public function registerBag(SessionBagInterface $bag); diff --git a/redaxo/src/core/vendor/symfony/http-foundation/StreamedJsonResponse.php b/redaxo/src/core/vendor/symfony/http-foundation/StreamedJsonResponse.php new file mode 100644 index 0000000000..cf858a5eb7 --- /dev/null +++ b/redaxo/src/core/vendor/symfony/http-foundation/StreamedJsonResponse.php @@ -0,0 +1,143 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpFoundation; + +/** + * StreamedJsonResponse represents a streamed HTTP response for JSON. + * + * A StreamedJsonResponse uses a structure and generics to create an + * efficient resource-saving JSON response. + * + * It is recommended to use flush() function after a specific number of items to directly stream the data. + * + * @see flush() + * + * @author Alexander Schranz + * + * Example usage: + * + * function loadArticles(): \Generator + * // some streamed loading + * yield ['title' => 'Article 1']; + * yield ['title' => 'Article 2']; + * yield ['title' => 'Article 3']; + * // recommended to use flush() after every specific number of items + * }), + * + * $response = new StreamedJsonResponse( + * // json structure with generators in which will be streamed + * [ + * '_embedded' => [ + * 'articles' => loadArticles(), // any generator which you want to stream as list of data + * ], + * ], + * ); + */ +class StreamedJsonResponse extends StreamedResponse +{ + private const PLACEHOLDER = '__symfony_json__'; + + /** + * @param mixed[] $data JSON Data containing PHP generators which will be streamed as list of data + * @param int $status The HTTP status code (200 "OK" by default) + * @param array $headers An array of HTTP headers + * @param int $encodingOptions Flags for the json_encode() function + */ + public function __construct( + private readonly array $data, + int $status = 200, + array $headers = [], + private int $encodingOptions = JsonResponse::DEFAULT_ENCODING_OPTIONS, + ) { + parent::__construct($this->stream(...), $status, $headers); + + if (!$this->headers->get('Content-Type')) { + $this->headers->set('Content-Type', 'application/json'); + } + } + + private function stream(): void + { + $generators = []; + $structure = $this->data; + + array_walk_recursive($structure, function (&$item, $key) use (&$generators) { + if (self::PLACEHOLDER === $key) { + // if the placeholder is already in the structure it should be replaced with a new one that explode + // works like expected for the structure + $generators[] = $key; + } + + // generators should be used but for better DX all kind of Traversable and objects are supported + if (\is_object($item)) { + $generators[] = $item; + $item = self::PLACEHOLDER; + } elseif (self::PLACEHOLDER === $item) { + // if the placeholder is already in the structure it should be replaced with a new one that explode + // works like expected for the structure + $generators[] = $item; + } + }); + + $jsonEncodingOptions = \JSON_THROW_ON_ERROR | $this->encodingOptions; + $keyEncodingOptions = $jsonEncodingOptions & ~\JSON_NUMERIC_CHECK; + + $jsonParts = explode('"'.self::PLACEHOLDER.'"', json_encode($structure, $jsonEncodingOptions)); + + foreach ($generators as $index => $generator) { + // send first and between parts of the structure + echo $jsonParts[$index]; + + if ($generator instanceof \JsonSerializable || !$generator instanceof \Traversable) { + // the placeholders, JsonSerializable and none traversable items in the structure are rendered here + echo json_encode($generator, $jsonEncodingOptions); + + continue; + } + + $isFirstItem = true; + $startTag = '['; + + foreach ($generator as $key => $item) { + if ($isFirstItem) { + $isFirstItem = false; + // depending on the first elements key the generator is detected as a list or map + // we can not check for a whole list or map because that would hurt the performance + // of the streamed response which is the main goal of this response class + if (0 !== $key) { + $startTag = '{'; + } + + echo $startTag; + } else { + // if not first element of the generic, a separator is required between the elements + echo ','; + } + + if ('{' === $startTag) { + echo json_encode((string) $key, $keyEncodingOptions).':'; + } + + echo json_encode($item, $jsonEncodingOptions); + } + + if ($isFirstItem) { // indicates that the generator was empty + echo '['; + } + + echo '[' === $startTag ? ']' : '}'; + } + + // send last part of the structure + echo $jsonParts[array_key_last($jsonParts)]; + } +} diff --git a/redaxo/src/core/vendor/symfony/http-foundation/StreamedResponse.php b/redaxo/src/core/vendor/symfony/http-foundation/StreamedResponse.php index 0bddcdc9bb..2c8ff15f36 100644 --- a/redaxo/src/core/vendor/symfony/http-foundation/StreamedResponse.php +++ b/redaxo/src/core/vendor/symfony/http-foundation/StreamedResponse.php @@ -59,17 +59,22 @@ public function setCallback(callable $callback): static /** * This method only sends the headers once. * + * @param null|positive-int $statusCode The status code to use, override the statusCode property if set and not null + * * @return $this */ - public function sendHeaders(): static + public function sendHeaders(/* int $statusCode = null */): static { if ($this->headersSent) { return $this; } - $this->headersSent = true; + $statusCode = \func_num_args() > 0 ? func_get_arg(0) : null; + if ($statusCode < 100 || $statusCode >= 200) { + $this->headersSent = true; + } - return parent::sendHeaders(); + return parent::sendHeaders($statusCode); } /** diff --git a/redaxo/src/core/vendor/symfony/http-foundation/UrlHelper.php b/redaxo/src/core/vendor/symfony/http-foundation/UrlHelper.php index 42fcf0459a..d5641eff86 100644 --- a/redaxo/src/core/vendor/symfony/http-foundation/UrlHelper.php +++ b/redaxo/src/core/vendor/symfony/http-foundation/UrlHelper.php @@ -12,6 +12,7 @@ namespace Symfony\Component\HttpFoundation; use Symfony\Component\Routing\RequestContext; +use Symfony\Component\Routing\RequestContextAwareInterface; /** * A helper service for manipulating URLs within and outside the request scope. @@ -20,13 +21,11 @@ */ final class UrlHelper { - private RequestStack $requestStack; - private ?RequestContext $requestContext; - public function __construct(RequestStack $requestStack, RequestContext $requestContext = null) - { - $this->requestStack = $requestStack; - $this->requestContext = $requestContext; + public function __construct( + private RequestStack $requestStack, + private RequestContextAwareInterface|RequestContext|null $requestContext = null, + ) { } public function getAbsoluteUrl(string $path): string @@ -73,28 +72,36 @@ public function getRelativePath(string $path): string private function getAbsoluteUrlFromContext(string $path): string { - if (null === $this->requestContext || '' === $host = $this->requestContext->getHost()) { + if (null === $context = $this->requestContext) { + return $path; + } + + if ($context instanceof RequestContextAwareInterface) { + $context = $context->getContext(); + } + + if ('' === $host = $context->getHost()) { return $path; } - $scheme = $this->requestContext->getScheme(); + $scheme = $context->getScheme(); $port = ''; - if ('http' === $scheme && 80 !== $this->requestContext->getHttpPort()) { - $port = ':'.$this->requestContext->getHttpPort(); - } elseif ('https' === $scheme && 443 !== $this->requestContext->getHttpsPort()) { - $port = ':'.$this->requestContext->getHttpsPort(); + if ('http' === $scheme && 80 !== $context->getHttpPort()) { + $port = ':'.$context->getHttpPort(); + } elseif ('https' === $scheme && 443 !== $context->getHttpsPort()) { + $port = ':'.$context->getHttpsPort(); } if ('#' === $path[0]) { - $queryString = $this->requestContext->getQueryString(); - $path = $this->requestContext->getPathInfo().($queryString ? '?'.$queryString : '').$path; + $queryString = $context->getQueryString(); + $path = $context->getPathInfo().($queryString ? '?'.$queryString : '').$path; } elseif ('?' === $path[0]) { - $path = $this->requestContext->getPathInfo().$path; + $path = $context->getPathInfo().$path; } if ('/' !== $path[0]) { - $path = rtrim($this->requestContext->getBaseUrl(), '/').'/'.$path; + $path = rtrim($context->getBaseUrl(), '/').'/'.$path; } return $scheme.'://'.$host.$port.$path; diff --git a/redaxo/src/core/vendor/symfony/http-foundation/composer.json b/redaxo/src/core/vendor/symfony/http-foundation/composer.json index e333a23b7a..248bcbb163 100644 --- a/redaxo/src/core/vendor/symfony/http-foundation/composer.json +++ b/redaxo/src/core/vendor/symfony/http-foundation/composer.json @@ -17,11 +17,13 @@ ], "require": { "php": ">=8.1", - "symfony/deprecation-contracts": "^2.1|^3", - "symfony/polyfill-mbstring": "~1.1" + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/polyfill-mbstring": "~1.1", + "symfony/polyfill-php83": "^1.27" }, "require-dev": { - "predis/predis": "~1.0", + "doctrine/dbal": "^2.13.1|^3.0", + "predis/predis": "^1.1|^2.0", "symfony/cache": "^5.4|^6.0", "symfony/dependency-injection": "^5.4|^6.0", "symfony/http-kernel": "^5.4.12|^6.0.12|^6.1.4", @@ -32,9 +34,6 @@ "conflict": { "symfony/cache": "<6.2" }, - "suggest" : { - "symfony/mime": "To use the file extension guesser" - }, "autoload": { "psr-4": { "Symfony\\Component\\HttpFoundation\\": "" }, "exclude-from-classmap": [ diff --git a/redaxo/src/core/vendor/symfony/polyfill-php83/LICENSE b/redaxo/src/core/vendor/symfony/polyfill-php83/LICENSE new file mode 100644 index 0000000000..0ece8964f7 --- /dev/null +++ b/redaxo/src/core/vendor/symfony/polyfill-php83/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2022 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/redaxo/src/core/vendor/symfony/polyfill-php83/Php83.php b/redaxo/src/core/vendor/symfony/polyfill-php83/Php83.php new file mode 100644 index 0000000000..04a5ad46a6 --- /dev/null +++ b/redaxo/src/core/vendor/symfony/polyfill-php83/Php83.php @@ -0,0 +1,41 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Polyfill\Php83; + +/** + * @author Ion Bazan + * + * @internal + */ +final class Php83 +{ + private const JSON_MAX_DEPTH = 0x7FFFFFFF; // see https://www.php.net/manual/en/function.json-decode.php + + public static function json_validate(string $json, int $depth = 512, int $flags = 0): bool + { + if (0 !== $flags && \defined('JSON_INVALID_UTF8_IGNORE') && \JSON_INVALID_UTF8_IGNORE !== $flags) { + throw new \ValueError('json_validate(): Argument #3 ($flags) must be a valid flag (allowed flags: JSON_INVALID_UTF8_IGNORE)'); + } + + if ($depth <= 0) { + throw new \ValueError('json_validate(): Argument #2 ($depth) must be greater than 0'); + } + + if ($depth >= self::JSON_MAX_DEPTH) { + throw new \ValueError(sprintf('json_validate(): Argument #2 ($depth) must be less than %d', self::JSON_MAX_DEPTH)); + } + + json_decode($json, null, $depth, $flags); + + return \JSON_ERROR_NONE === json_last_error(); + } +} diff --git a/redaxo/src/core/vendor/symfony/polyfill-php83/bootstrap.php b/redaxo/src/core/vendor/symfony/polyfill-php83/bootstrap.php new file mode 100644 index 0000000000..3b8ccc8b00 --- /dev/null +++ b/redaxo/src/core/vendor/symfony/polyfill-php83/bootstrap.php @@ -0,0 +1,20 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Symfony\Polyfill\Php83 as p; + +if (\PHP_VERSION_ID >= 80300) { + return; +} + +if (!function_exists('json_validate')) { + function json_validate(string $json, int $depth = 512, int $flags = 0): bool { return p\Php83::json_validate($json, $depth, $flags); } +} diff --git a/redaxo/src/core/vendor/symfony/polyfill-php83/composer.json b/redaxo/src/core/vendor/symfony/polyfill-php83/composer.json new file mode 100644 index 0000000000..31c96ea5be --- /dev/null +++ b/redaxo/src/core/vendor/symfony/polyfill-php83/composer.json @@ -0,0 +1,36 @@ +{ + "name": "symfony/polyfill-php83", + "type": "library", + "description": "Symfony polyfill backporting some PHP 8.3+ features to lower PHP versions", + "keywords": ["polyfill", "shim", "compatibility", "portable"], + "homepage": "https://symfony.com", + "license": "MIT", + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "require": { + "php": ">=7.1", + "symfony/polyfill-php80": "^1.14" + }, + "autoload": { + "psr-4": { "Symfony\\Polyfill\\Php83\\": "" }, + "files": [ "bootstrap.php" ] + }, + "minimum-stability": "dev", + "extra": { + "branch-alias": { + "dev-main": "1.27-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + } +} diff --git a/redaxo/src/core/vendor/symfony/service-contracts/composer.json b/redaxo/src/core/vendor/symfony/service-contracts/composer.json index 36b0d95e77..a64188b51b 100644 --- a/redaxo/src/core/vendor/symfony/service-contracts/composer.json +++ b/redaxo/src/core/vendor/symfony/service-contracts/composer.json @@ -22,9 +22,6 @@ "conflict": { "ext-psr": "<1.1|>=2" }, - "suggest": { - "symfony/service-implementation": "" - }, "autoload": { "psr-4": { "Symfony\\Contracts\\Service\\": "" }, "exclude-from-classmap": [ @@ -34,7 +31,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-main": "3.3-dev" + "dev-main": "3.4-dev" }, "thanks": { "name": "symfony/contracts", diff --git a/redaxo/src/core/vendor/symfony/string/AbstractUnicodeString.php b/redaxo/src/core/vendor/symfony/string/AbstractUnicodeString.php index 2a2bed71ed..d19a61a9c6 100644 --- a/redaxo/src/core/vendor/symfony/string/AbstractUnicodeString.php +++ b/redaxo/src/core/vendor/symfony/string/AbstractUnicodeString.php @@ -40,10 +40,6 @@ abstract class AbstractUnicodeString extends AbstractString private const FOLD_FROM = ['İ', 'µ', 'ſ', "\xCD\x85", 'ς', 'ϐ', 'ϑ', 'ϕ', 'ϖ', 'ϰ', 'ϱ', 'ϵ', 'ẛ', "\xE1\xBE\xBE", 'ß', 'ʼn', 'ǰ', 'ΐ', 'ΰ', 'և', 'ẖ', 'ẗ', 'ẘ', 'ẙ', 'ẚ', 'ẞ', 'ὐ', 'ὒ', 'ὔ', 'ὖ', 'ᾀ', 'ᾁ', 'ᾂ', 'ᾃ', 'ᾄ', 'ᾅ', 'ᾆ', 'ᾇ', 'ᾈ', 'ᾉ', 'ᾊ', 'ᾋ', 'ᾌ', 'ᾍ', 'ᾎ', 'ᾏ', 'ᾐ', 'ᾑ', 'ᾒ', 'ᾓ', 'ᾔ', 'ᾕ', 'ᾖ', 'ᾗ', 'ᾘ', 'ᾙ', 'ᾚ', 'ᾛ', 'ᾜ', 'ᾝ', 'ᾞ', 'ᾟ', 'ᾠ', 'ᾡ', 'ᾢ', 'ᾣ', 'ᾤ', 'ᾥ', 'ᾦ', 'ᾧ', 'ᾨ', 'ᾩ', 'ᾪ', 'ᾫ', 'ᾬ', 'ᾭ', 'ᾮ', 'ᾯ', 'ᾲ', 'ᾳ', 'ᾴ', 'ᾶ', 'ᾷ', 'ᾼ', 'ῂ', 'ῃ', 'ῄ', 'ῆ', 'ῇ', 'ῌ', 'ῒ', 'ῖ', 'ῗ', 'ῢ', 'ῤ', 'ῦ', 'ῧ', 'ῲ', 'ῳ', 'ῴ', 'ῶ', 'ῷ', 'ῼ', 'ff', 'fi', 'fl', 'ffi', 'ffl', 'ſt', 'st', 'ﬓ', 'ﬔ', 'ﬕ', 'ﬖ', 'ﬗ']; private const FOLD_TO = ['i̇', 'μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'π', 'κ', 'ρ', 'ε', 'ṡ', 'ι', 'ss', 'ʼn', 'ǰ', 'ΐ', 'ΰ', 'եւ', 'ẖ', 'ẗ', 'ẘ', 'ẙ', 'aʾ', 'ss', 'ὐ', 'ὒ', 'ὔ', 'ὖ', 'ἀι', 'ἁι', 'ἂι', 'ἃι', 'ἄι', 'ἅι', 'ἆι', 'ἇι', 'ἀι', 'ἁι', 'ἂι', 'ἃι', 'ἄι', 'ἅι', 'ἆι', 'ἇι', 'ἠι', 'ἡι', 'ἢι', 'ἣι', 'ἤι', 'ἥι', 'ἦι', 'ἧι', 'ἠι', 'ἡι', 'ἢι', 'ἣι', 'ἤι', 'ἥι', 'ἦι', 'ἧι', 'ὠι', 'ὡι', 'ὢι', 'ὣι', 'ὤι', 'ὥι', 'ὦι', 'ὧι', 'ὠι', 'ὡι', 'ὢι', 'ὣι', 'ὤι', 'ὥι', 'ὦι', 'ὧι', 'ὰι', 'αι', 'άι', 'ᾶ', 'ᾶι', 'αι', 'ὴι', 'ηι', 'ήι', 'ῆ', 'ῆι', 'ηι', 'ῒ', 'ῖ', 'ῗ', 'ῢ', 'ῤ', 'ῦ', 'ῧ', 'ὼι', 'ωι', 'ώι', 'ῶ', 'ῶι', 'ωι', 'ff', 'fi', 'fl', 'ffi', 'ffl', 'st', 'st', 'մն', 'մե', 'մի', 'վն', 'մխ']; - // the subset of upper case mappings that map one code point to many code points - private const UPPER_FROM = ['ß', 'ff', 'fi', 'fl', 'ffi', 'ffl', 'ſt', 'st', 'և', 'ﬓ', 'ﬔ', 'ﬕ', 'ﬖ', 'ﬗ', 'ʼn', 'ΐ', 'ΰ', 'ǰ', 'ẖ', 'ẗ', 'ẘ', 'ẙ', 'ẚ', 'ὐ', 'ὒ', 'ὔ', 'ὖ', 'ᾶ', 'ῆ', 'ῒ', 'ΐ', 'ῖ', 'ῗ', 'ῢ', 'ΰ', 'ῤ', 'ῦ', 'ῧ', 'ῶ']; - private const UPPER_TO = ['SS', 'FF', 'FI', 'FL', 'FFI', 'FFL', 'ST', 'ST', 'ԵՒ', 'ՄՆ', 'ՄԵ', 'ՄԻ', 'ՎՆ', 'ՄԽ', 'ʼN', 'Ϊ́', 'Ϋ́', 'J̌', 'H̱', 'T̈', 'W̊', 'Y̊', 'Aʾ', 'Υ̓', 'Υ̓̀', 'Υ̓́', 'Υ̓͂', 'Α͂', 'Η͂', 'Ϊ̀', 'Ϊ́', 'Ι͂', 'Ϊ͂', 'Ϋ̀', 'Ϋ́', 'Ρ̓', 'Υ͂', 'Ϋ͂', 'Ω͂']; - // the subset of https://github.com/unicode-org/cldr/blob/master/common/transforms/Latin-ASCII.xml that is not in NFKD private const TRANSLIT_FROM = ['Æ', 'Ð', 'Ø', 'Þ', 'ß', 'æ', 'ð', 'ø', 'þ', 'Đ', 'đ', 'Ħ', 'ħ', 'ı', 'ĸ', 'Ŀ', 'ŀ', 'Ł', 'ł', 'ʼn', 'Ŋ', 'ŋ', 'Œ', 'œ', 'Ŧ', 'ŧ', 'ƀ', 'Ɓ', 'Ƃ', 'ƃ', 'Ƈ', 'ƈ', 'Ɖ', 'Ɗ', 'Ƌ', 'ƌ', 'Ɛ', 'Ƒ', 'ƒ', 'Ɠ', 'ƕ', 'Ɩ', 'Ɨ', 'Ƙ', 'ƙ', 'ƚ', 'Ɲ', 'ƞ', 'Ƣ', 'ƣ', 'Ƥ', 'ƥ', 'ƫ', 'Ƭ', 'ƭ', 'Ʈ', 'Ʋ', 'Ƴ', 'ƴ', 'Ƶ', 'ƶ', 'DŽ', 'Dž', 'dž', 'Ǥ', 'ǥ', 'ȡ', 'Ȥ', 'ȥ', 'ȴ', 'ȵ', 'ȶ', 'ȷ', 'ȸ', 'ȹ', 'Ⱥ', 'Ȼ', 'ȼ', 'Ƚ', 'Ⱦ', 'ȿ', 'ɀ', 'Ƀ', 'Ʉ', 'Ɇ', 'ɇ', 'Ɉ', 'ɉ', 'Ɍ', 'ɍ', 'Ɏ', 'ɏ', 'ɓ', 'ɕ', 'ɖ', 'ɗ', 'ɛ', 'ɟ', 'ɠ', 'ɡ', 'ɢ', 'ɦ', 'ɧ', 'ɨ', 'ɪ', 'ɫ', 'ɬ', 'ɭ', 'ɱ', 'ɲ', 'ɳ', 'ɴ', 'ɶ', 'ɼ', 'ɽ', 'ɾ', 'ʀ', 'ʂ', 'ʈ', 'ʉ', 'ʋ', 'ʏ', 'ʐ', 'ʑ', 'ʙ', 'ʛ', 'ʜ', 'ʝ', 'ʟ', 'ʠ', 'ʣ', 'ʥ', 'ʦ', 'ʪ', 'ʫ', 'ᴀ', 'ᴁ', 'ᴃ', 'ᴄ', 'ᴅ', 'ᴆ', 'ᴇ', 'ᴊ', 'ᴋ', 'ᴌ', 'ᴍ', 'ᴏ', 'ᴘ', 'ᴛ', 'ᴜ', 'ᴠ', 'ᴡ', 'ᴢ', 'ᵫ', 'ᵬ', 'ᵭ', 'ᵮ', 'ᵯ', 'ᵰ', 'ᵱ', 'ᵲ', 'ᵳ', 'ᵴ', 'ᵵ', 'ᵶ', 'ᵺ', 'ᵻ', 'ᵽ', 'ᵾ', 'ᶀ', 'ᶁ', 'ᶂ', 'ᶃ', 'ᶄ', 'ᶅ', 'ᶆ', 'ᶇ', 'ᶈ', 'ᶉ', 'ᶊ', 'ᶌ', 'ᶍ', 'ᶎ', 'ᶏ', 'ᶑ', 'ᶒ', 'ᶓ', 'ᶖ', 'ᶙ', 'ẚ', 'ẜ', 'ẝ', 'ẞ', 'Ỻ', 'ỻ', 'Ỽ', 'ỽ', 'Ỿ', 'ỿ', '©', '®', '₠', '₢', '₣', '₤', '₧', '₺', '₹', 'ℌ', '℞', '㎧', '㎮', '㏆', '㏗', '㏞', '㏟', '¼', '½', '¾', '⅓', '⅔', '⅕', '⅖', '⅗', '⅘', '⅙', '⅚', '⅛', '⅜', '⅝', '⅞', '⅟', '〇', '‘', '’', '‚', '‛', '“', '”', '„', '‟', '′', '″', '〝', '〞', '«', '»', '‹', '›', '‐', '‑', '‒', '–', '—', '―', '︱', '︲', '﹘', '‖', '⁄', '⁅', '⁆', '⁎', '、', '。', '〈', '〉', '《', '》', '〔', '〕', '〘', '〙', '〚', '〛', '︑', '︒', '︹', '︺', '︽', '︾', '︿', '﹀', '﹑', '﹝', '﹞', '⦅', '⦆', '。', '、', '×', '÷', '−', '∕', '∖', '∣', '∥', '≪', '≫', '⦅', '⦆']; private const TRANSLIT_TO = ['AE', 'D', 'O', 'TH', 'ss', 'ae', 'd', 'o', 'th', 'D', 'd', 'H', 'h', 'i', 'q', 'L', 'l', 'L', 'l', '\'n', 'N', 'n', 'OE', 'oe', 'T', 't', 'b', 'B', 'B', 'b', 'C', 'c', 'D', 'D', 'D', 'd', 'E', 'F', 'f', 'G', 'hv', 'I', 'I', 'K', 'k', 'l', 'N', 'n', 'OI', 'oi', 'P', 'p', 't', 'T', 't', 'T', 'V', 'Y', 'y', 'Z', 'z', 'DZ', 'Dz', 'dz', 'G', 'g', 'd', 'Z', 'z', 'l', 'n', 't', 'j', 'db', 'qp', 'A', 'C', 'c', 'L', 'T', 's', 'z', 'B', 'U', 'E', 'e', 'J', 'j', 'R', 'r', 'Y', 'y', 'b', 'c', 'd', 'd', 'e', 'j', 'g', 'g', 'G', 'h', 'h', 'i', 'I', 'l', 'l', 'l', 'm', 'n', 'n', 'N', 'OE', 'r', 'r', 'r', 'R', 's', 't', 'u', 'v', 'Y', 'z', 'z', 'B', 'G', 'H', 'j', 'L', 'q', 'dz', 'dz', 'ts', 'ls', 'lz', 'A', 'AE', 'B', 'C', 'D', 'D', 'E', 'J', 'K', 'L', 'M', 'O', 'P', 'T', 'U', 'V', 'W', 'Z', 'ue', 'b', 'd', 'f', 'm', 'n', 'p', 'r', 'r', 's', 't', 'z', 'th', 'I', 'p', 'U', 'b', 'd', 'f', 'g', 'k', 'l', 'm', 'n', 'p', 'r', 's', 'v', 'x', 'z', 'a', 'd', 'e', 'e', 'i', 'u', 'a', 's', 's', 'SS', 'LL', 'll', 'V', 'v', 'Y', 'y', '(C)', '(R)', 'CE', 'Cr', 'Fr.', 'L.', 'Pts', 'TL', 'Rs', 'x', 'Rx', 'm/s', 'rad/s', 'C/kg', 'pH', 'V/m', 'A/m', ' 1/4', ' 1/2', ' 3/4', ' 1/3', ' 2/3', ' 1/5', ' 2/5', ' 3/5', ' 4/5', ' 1/6', ' 5/6', ' 1/8', ' 3/8', ' 5/8', ' 7/8', ' 1/', '0', '\'', '\'', ',', '\'', '"', '"', ',,', '"', '\'', '"', '"', '"', '<<', '>>', '<', '>', '-', '-', '-', '-', '-', '-', '-', '-', '-', '||', '/', '[', ']', '*', ',', '.', '<', '>', '<<', '>>', '[', ']', '[', ']', '[', ']', ',', '.', '[', ']', '<<', '>>', '<', '>', ',', '[', ']', '((', '))', '.', ',', '*', '/', '-', '/', '\\', '|', '||', '<<', '>>', '((', '))']; @@ -159,7 +155,9 @@ public function ascii(array $rules = []): self public function camel(): static { $str = clone $this; - $str->string = str_replace(' ', '', preg_replace_callback('/\b.(?![A-Z]{2,})/u', static function ($m) use (&$i) { + $str->string = str_replace(' ', '', preg_replace_callback('/\b.(?![A-Z]{2,})/u', static function ($m) { + static $i = 0; + return 1 === ++$i ? ('İ' === $m[0] ? 'i̇' : mb_strtolower($m[0], 'UTF-8')) : mb_convert_case($m[0], \MB_CASE_TITLE, 'UTF-8'); }, preg_replace('/[^\pL0-9]++/u', ' ', $this->string))); @@ -360,9 +358,7 @@ public function title(bool $allWords = false): static $limit = $allWords ? -1 : 1; - $str->string = preg_replace_callback('/\b./u', static function (array $m): string { - return mb_convert_case($m[0], \MB_CASE_TITLE, 'UTF-8'); - }, $str->string, $limit); + $str->string = preg_replace_callback('/\b./u', static fn (array $m): string => mb_convert_case($m[0], \MB_CASE_TITLE, 'UTF-8'), $str->string, $limit); return $str; } diff --git a/redaxo/src/core/vendor/symfony/string/LazyString.php b/redaxo/src/core/vendor/symfony/string/LazyString.php index 9523b8cdb2..3128ebb361 100644 --- a/redaxo/src/core/vendor/symfony/string/LazyString.php +++ b/redaxo/src/core/vendor/symfony/string/LazyString.php @@ -30,7 +30,9 @@ public static function fromCallable(callable|array $callback, mixed ...$argument } $lazyString = new static(); - $lazyString->value = static function () use (&$callback, &$arguments, &$value): string { + $lazyString->value = static function () use (&$callback, &$arguments): string { + static $value; + if (null !== $arguments) { if (!\is_callable($callback)) { $callback[0] = $callback[0](); diff --git a/redaxo/src/core/vendor/symfony/string/Slugger/AsciiSlugger.php b/redaxo/src/core/vendor/symfony/string/Slugger/AsciiSlugger.php index 826d07ca09..6e550c61cf 100644 --- a/redaxo/src/core/vendor/symfony/string/Slugger/AsciiSlugger.php +++ b/redaxo/src/core/vendor/symfony/string/Slugger/AsciiSlugger.php @@ -74,6 +74,9 @@ public function __construct(string $defaultLocale = null, array|\Closure $symbol $this->symbolsMap = $symbolsMap ?? $this->symbolsMap; } + /** + * @return void + */ public function setLocale(string $locale) { $this->defaultLocale = $locale; @@ -121,9 +124,7 @@ public function slug(string $string, string $separator = '-', string $locale = n // If the symbols map is passed as a closure, there is no need to fallback to the parent locale // as the closure can just provide substitutions for all locales of interest. $symbolsMap = $this->symbolsMap; - array_unshift($transliterator, static function ($s) use ($symbolsMap, $locale) { - return $symbolsMap($s, $locale); - }); + array_unshift($transliterator, static fn ($s) => $symbolsMap($s, $locale)); } $unicodeString = (new UnicodeString($string))->ascii($transliterator); diff --git a/redaxo/src/core/vendor/symfony/string/composer.json b/redaxo/src/core/vendor/symfony/string/composer.json index 44a809d589..3545c85311 100644 --- a/redaxo/src/core/vendor/symfony/string/composer.json +++ b/redaxo/src/core/vendor/symfony/string/composer.json @@ -26,11 +26,11 @@ "symfony/error-handler": "^5.4|^6.0", "symfony/intl": "^6.2", "symfony/http-client": "^5.4|^6.0", - "symfony/translation-contracts": "^2.0|^3.0", + "symfony/translation-contracts": "^2.5|^3.0", "symfony/var-exporter": "^5.4|^6.0" }, "conflict": { - "symfony/translation-contracts": "<2.0" + "symfony/translation-contracts": "<2.5" }, "autoload": { "psr-4": { "Symfony\\Component\\String\\": "" }, diff --git a/redaxo/src/core/vendor/symfony/var-dumper/Caster/AmqpCaster.php b/redaxo/src/core/vendor/symfony/var-dumper/Caster/AmqpCaster.php index dc3b62198a..22026f46a7 100644 --- a/redaxo/src/core/vendor/symfony/var-dumper/Caster/AmqpCaster.php +++ b/redaxo/src/core/vendor/symfony/var-dumper/Caster/AmqpCaster.php @@ -46,6 +46,9 @@ class AmqpCaster \AMQP_EX_TYPE_HEADERS => 'AMQP_EX_TYPE_HEADERS', ]; + /** + * @return array + */ public static function castConnection(\AMQPConnection $c, array $a, Stub $stub, bool $isNested) { $prefix = Caster::PREFIX_VIRTUAL; @@ -79,6 +82,9 @@ public static function castConnection(\AMQPConnection $c, array $a, Stub $stub, return $a; } + /** + * @return array + */ public static function castChannel(\AMQPChannel $c, array $a, Stub $stub, bool $isNested) { $prefix = Caster::PREFIX_VIRTUAL; @@ -102,6 +108,9 @@ public static function castChannel(\AMQPChannel $c, array $a, Stub $stub, bool $ return $a; } + /** + * @return array + */ public static function castQueue(\AMQPQueue $c, array $a, Stub $stub, bool $isNested) { $prefix = Caster::PREFIX_VIRTUAL; @@ -125,6 +134,9 @@ public static function castQueue(\AMQPQueue $c, array $a, Stub $stub, bool $isNe return $a; } + /** + * @return array + */ public static function castExchange(\AMQPExchange $c, array $a, Stub $stub, bool $isNested) { $prefix = Caster::PREFIX_VIRTUAL; @@ -153,6 +165,9 @@ public static function castExchange(\AMQPExchange $c, array $a, Stub $stub, bool return $a; } + /** + * @return array + */ public static function castEnvelope(\AMQPEnvelope $c, array $a, Stub $stub, bool $isNested, int $filter = 0) { $prefix = Caster::PREFIX_VIRTUAL; diff --git a/redaxo/src/core/vendor/symfony/var-dumper/Caster/Caster.php b/redaxo/src/core/vendor/symfony/var-dumper/Caster/Caster.php index b6a84fcbe6..32c69ee04d 100644 --- a/redaxo/src/core/vendor/symfony/var-dumper/Caster/Caster.php +++ b/redaxo/src/core/vendor/symfony/var-dumper/Caster/Caster.php @@ -36,6 +36,8 @@ class Caster public const PREFIX_VIRTUAL = "\0~\0"; public const PREFIX_DYNAMIC = "\0+\0"; public const PREFIX_PROTECTED = "\0*\0"; + // usage: sprintf(Caster::PATTERN_PRIVATE, $class, $property) + public const PATTERN_PRIVATE = "\0%s\0%s"; /** * Casts objects to arrays and adds the dynamic property prefix. diff --git a/redaxo/src/core/vendor/symfony/var-dumper/Caster/ClassStub.php b/redaxo/src/core/vendor/symfony/var-dumper/Caster/ClassStub.php index fb8377a039..86b44dd2ab 100644 --- a/redaxo/src/core/vendor/symfony/var-dumper/Caster/ClassStub.php +++ b/redaxo/src/core/vendor/symfony/var-dumper/Caster/ClassStub.php @@ -56,9 +56,7 @@ public function __construct(string $identifier, callable|array|string $callable } if (str_contains($identifier, "@anonymous\0")) { - $this->value = $identifier = preg_replace_callback('/[a-zA-Z_\x7f-\xff][\\\\a-zA-Z0-9_\x7f-\xff]*+@anonymous\x00.*?\.php(?:0x?|:[0-9]++\$)[0-9a-fA-F]++/', function ($m) { - return class_exists($m[0], false) ? (get_parent_class($m[0]) ?: key(class_implements($m[0])) ?: 'class').'@anonymous' : $m[0]; - }, $identifier); + $this->value = $identifier = preg_replace_callback('/[a-zA-Z_\x7f-\xff][\\\\a-zA-Z0-9_\x7f-\xff]*+@anonymous\x00.*?\.php(?:0x?|:[0-9]++\$)[0-9a-fA-F]++/', fn ($m) => class_exists($m[0], false) ? (get_parent_class($m[0]) ?: key(class_implements($m[0])) ?: 'class').'@anonymous' : $m[0], $identifier); } if (null !== $callable && $r instanceof \ReflectionFunctionAbstract) { @@ -87,6 +85,9 @@ public function __construct(string $identifier, callable|array|string $callable } } + /** + * @return mixed + */ public static function wrapCallable(mixed $callable) { if (\is_object($callable) || !\is_callable($callable)) { diff --git a/redaxo/src/core/vendor/symfony/var-dumper/Caster/DOMCaster.php b/redaxo/src/core/vendor/symfony/var-dumper/Caster/DOMCaster.php index 8b770b8ae3..d2d3fc1294 100644 --- a/redaxo/src/core/vendor/symfony/var-dumper/Caster/DOMCaster.php +++ b/redaxo/src/core/vendor/symfony/var-dumper/Caster/DOMCaster.php @@ -63,6 +63,9 @@ class DOMCaster \XML_NAMESPACE_DECL_NODE => 'XML_NAMESPACE_DECL_NODE', ]; + /** + * @return array + */ public static function castException(\DOMException $e, array $a, Stub $stub, bool $isNested) { $k = Caster::PREFIX_PROTECTED.'code'; @@ -73,6 +76,9 @@ public static function castException(\DOMException $e, array $a, Stub $stub, boo return $a; } + /** + * @return array + */ public static function castLength($dom, array $a, Stub $stub, bool $isNested) { $a += [ @@ -82,6 +88,9 @@ public static function castLength($dom, array $a, Stub $stub, bool $isNested) return $a; } + /** + * @return array + */ public static function castImplementation(\DOMImplementation $dom, array $a, Stub $stub, bool $isNested) { $a += [ @@ -92,6 +101,9 @@ public static function castImplementation(\DOMImplementation $dom, array $a, Stu return $a; } + /** + * @return array + */ public static function castNode(\DOMNode $dom, array $a, Stub $stub, bool $isNested) { $a += [ @@ -116,6 +128,9 @@ public static function castNode(\DOMNode $dom, array $a, Stub $stub, bool $isNes return $a; } + /** + * @return array + */ public static function castNameSpaceNode(\DOMNameSpaceNode $dom, array $a, Stub $stub, bool $isNested) { $a += [ @@ -132,6 +147,9 @@ public static function castNameSpaceNode(\DOMNameSpaceNode $dom, array $a, Stub return $a; } + /** + * @return array + */ public static function castDocument(\DOMDocument $dom, array $a, Stub $stub, bool $isNested, int $filter = 0) { $a += [ @@ -166,6 +184,9 @@ public static function castDocument(\DOMDocument $dom, array $a, Stub $stub, boo return $a; } + /** + * @return array + */ public static function castCharacterData(\DOMCharacterData $dom, array $a, Stub $stub, bool $isNested) { $a += [ @@ -176,6 +197,9 @@ public static function castCharacterData(\DOMCharacterData $dom, array $a, Stub return $a; } + /** + * @return array + */ public static function castAttr(\DOMAttr $dom, array $a, Stub $stub, bool $isNested) { $a += [ @@ -189,6 +213,9 @@ public static function castAttr(\DOMAttr $dom, array $a, Stub $stub, bool $isNes return $a; } + /** + * @return array + */ public static function castElement(\DOMElement $dom, array $a, Stub $stub, bool $isNested) { $a += [ @@ -199,6 +226,9 @@ public static function castElement(\DOMElement $dom, array $a, Stub $stub, bool return $a; } + /** + * @return array + */ public static function castText(\DOMText $dom, array $a, Stub $stub, bool $isNested) { $a += [ @@ -208,6 +238,9 @@ public static function castText(\DOMText $dom, array $a, Stub $stub, bool $isNes return $a; } + /** + * @return array + */ public static function castDocumentType(\DOMDocumentType $dom, array $a, Stub $stub, bool $isNested) { $a += [ @@ -222,6 +255,9 @@ public static function castDocumentType(\DOMDocumentType $dom, array $a, Stub $s return $a; } + /** + * @return array + */ public static function castNotation(\DOMNotation $dom, array $a, Stub $stub, bool $isNested) { $a += [ @@ -232,6 +268,9 @@ public static function castNotation(\DOMNotation $dom, array $a, Stub $stub, boo return $a; } + /** + * @return array + */ public static function castEntity(\DOMEntity $dom, array $a, Stub $stub, bool $isNested) { $a += [ @@ -246,6 +285,9 @@ public static function castEntity(\DOMEntity $dom, array $a, Stub $stub, bool $i return $a; } + /** + * @return array + */ public static function castProcessingInstruction(\DOMProcessingInstruction $dom, array $a, Stub $stub, bool $isNested) { $a += [ @@ -256,6 +298,9 @@ public static function castProcessingInstruction(\DOMProcessingInstruction $dom, return $a; } + /** + * @return array + */ public static function castXPath(\DOMXPath $dom, array $a, Stub $stub, bool $isNested) { $a += [ diff --git a/redaxo/src/core/vendor/symfony/var-dumper/Caster/DateCaster.php b/redaxo/src/core/vendor/symfony/var-dumper/Caster/DateCaster.php index 07e8c5ea8c..a0cbddb76f 100644 --- a/redaxo/src/core/vendor/symfony/var-dumper/Caster/DateCaster.php +++ b/redaxo/src/core/vendor/symfony/var-dumper/Caster/DateCaster.php @@ -24,10 +24,13 @@ class DateCaster { private const PERIOD_LIMIT = 3; + /** + * @return array + */ public static function castDateTime(\DateTimeInterface $d, array $a, Stub $stub, bool $isNested, int $filter) { $prefix = Caster::PREFIX_VIRTUAL; - $location = $d->getTimezone()->getLocation(); + $location = $d->getTimezone() ? $d->getTimezone()->getLocation() : null; $fromNow = (new \DateTimeImmutable())->diff($d); $title = $d->format('l, F j, Y') @@ -47,6 +50,9 @@ public static function castDateTime(\DateTimeInterface $d, array $a, Stub $stub, return $a; } + /** + * @return array + */ public static function castInterval(\DateInterval $interval, array $a, Stub $stub, bool $isNested, int $filter) { $now = new \DateTimeImmutable('@0', new \DateTimeZone('UTC')); @@ -76,6 +82,9 @@ private static function formatInterval(\DateInterval $i): string return $i->format(rtrim($format)); } + /** + * @return array + */ public static function castTimeZone(\DateTimeZone $timeZone, array $a, Stub $stub, bool $isNested, int $filter) { $location = $timeZone->getLocation(); @@ -87,6 +96,9 @@ public static function castTimeZone(\DateTimeZone $timeZone, array $a, Stub $stu return $filter & Caster::EXCLUDE_VERBOSE ? $z : $z + $a; } + /** + * @return array + */ public static function castPeriod(\DatePeriod $p, array $a, Stub $stub, bool $isNested, int $filter) { $dates = []; diff --git a/redaxo/src/core/vendor/symfony/var-dumper/Caster/DoctrineCaster.php b/redaxo/src/core/vendor/symfony/var-dumper/Caster/DoctrineCaster.php index 129b2cb47b..3120c3d919 100644 --- a/redaxo/src/core/vendor/symfony/var-dumper/Caster/DoctrineCaster.php +++ b/redaxo/src/core/vendor/symfony/var-dumper/Caster/DoctrineCaster.php @@ -25,6 +25,9 @@ */ class DoctrineCaster { + /** + * @return array + */ public static function castCommonProxy(CommonProxy $proxy, array $a, Stub $stub, bool $isNested) { foreach (['__cloner__', '__initializer__'] as $k) { @@ -37,6 +40,9 @@ public static function castCommonProxy(CommonProxy $proxy, array $a, Stub $stub, return $a; } + /** + * @return array + */ public static function castOrmProxy(OrmProxy $proxy, array $a, Stub $stub, bool $isNested) { foreach (['_entityPersister', '_identifier'] as $k) { @@ -49,6 +55,9 @@ public static function castOrmProxy(OrmProxy $proxy, array $a, Stub $stub, bool return $a; } + /** + * @return array + */ public static function castPersistentCollection(PersistentCollection $coll, array $a, Stub $stub, bool $isNested) { foreach (['snapshot', 'association', 'typeClass'] as $k) { diff --git a/redaxo/src/core/vendor/symfony/var-dumper/Caster/ExceptionCaster.php b/redaxo/src/core/vendor/symfony/var-dumper/Caster/ExceptionCaster.php index 14caf71f32..02efb1b023 100644 --- a/redaxo/src/core/vendor/symfony/var-dumper/Caster/ExceptionCaster.php +++ b/redaxo/src/core/vendor/symfony/var-dumper/Caster/ExceptionCaster.php @@ -11,6 +11,7 @@ namespace Symfony\Component\VarDumper\Caster; +use Symfony\Component\ErrorHandler\Exception\FlattenException; use Symfony\Component\ErrorHandler\Exception\SilencedErrorContext; use Symfony\Component\VarDumper\Cloner\Stub; use Symfony\Component\VarDumper\Exception\ThrowingCasterException; @@ -46,16 +47,25 @@ class ExceptionCaster private static array $framesCache = []; + /** + * @return array + */ public static function castError(\Error $e, array $a, Stub $stub, bool $isNested, int $filter = 0) { return self::filterExceptionArray($stub->class, $a, "\0Error\0", $filter); } + /** + * @return array + */ public static function castException(\Exception $e, array $a, Stub $stub, bool $isNested, int $filter = 0) { return self::filterExceptionArray($stub->class, $a, "\0Exception\0", $filter); } + /** + * @return array + */ public static function castErrorException(\ErrorException $e, array $a, Stub $stub, bool $isNested) { if (isset($a[$s = Caster::PREFIX_PROTECTED.'severity'], self::$errorTypes[$a[$s]])) { @@ -65,6 +75,9 @@ public static function castErrorException(\ErrorException $e, array $a, Stub $st return $a; } + /** + * @return array + */ public static function castThrowingCasterException(ThrowingCasterException $e, array $a, Stub $stub, bool $isNested) { $trace = Caster::PREFIX_VIRTUAL.'trace'; @@ -83,6 +96,9 @@ public static function castThrowingCasterException(ThrowingCasterException $e, a return $a; } + /** + * @return array + */ public static function castSilencedErrorContext(SilencedErrorContext $e, array $a, Stub $stub, bool $isNested) { $sPrefix = "\0".SilencedErrorContext::class."\0"; @@ -110,6 +126,9 @@ public static function castSilencedErrorContext(SilencedErrorContext $e, array $ return $a; } + /** + * @return array + */ public static function castTraceStub(TraceStub $trace, array $a, Stub $stub, bool $isNested) { if (!$isNested) { @@ -184,6 +203,9 @@ public static function castTraceStub(TraceStub $trace, array $a, Stub $stub, boo return $a; } + /** + * @return array + */ public static function castFrameStub(FrameStub $frame, array $a, Stub $stub, bool $isNested) { if (!$isNested) { @@ -267,6 +289,19 @@ public static function castFrameStub(FrameStub $frame, array $a, Stub $stub, boo return $a; } + /** + * @return array + */ + public static function castFlattenException(FlattenException $e, array $a, Stub $stub, bool $isNested) + { + if ($isNested) { + $k = sprintf(Caster::PATTERN_PRIVATE, FlattenException::class, 'traceAsString'); + $a[$k] = new CutStub($a[$k]); + } + + return $a; + } + private static function filterExceptionArray(string $xClass, array $a, string $xPrefix, int $filter): array { if (isset($a[$xPrefix.'trace'])) { @@ -285,12 +320,10 @@ private static function filterExceptionArray(string $xClass, array $a, string $x if (empty($a[$xPrefix.'previous'])) { unset($a[$xPrefix.'previous']); } - unset($a[$xPrefix.'string'], $a[Caster::PREFIX_DYNAMIC.'xdebug_message'], $a[Caster::PREFIX_DYNAMIC.'__destructorException']); + unset($a[$xPrefix.'string'], $a[Caster::PREFIX_DYNAMIC.'xdebug_message']); if (isset($a[Caster::PREFIX_PROTECTED.'message']) && str_contains($a[Caster::PREFIX_PROTECTED.'message'], "@anonymous\0")) { - $a[Caster::PREFIX_PROTECTED.'message'] = preg_replace_callback('/[a-zA-Z_\x7f-\xff][\\\\a-zA-Z0-9_\x7f-\xff]*+@anonymous\x00.*?\.php(?:0x?|:[0-9]++\$)[0-9a-fA-F]++/', function ($m) { - return class_exists($m[0], false) ? (get_parent_class($m[0]) ?: key(class_implements($m[0])) ?: 'class').'@anonymous' : $m[0]; - }, $a[Caster::PREFIX_PROTECTED.'message']); + $a[Caster::PREFIX_PROTECTED.'message'] = preg_replace_callback('/[a-zA-Z_\x7f-\xff][\\\\a-zA-Z0-9_\x7f-\xff]*+@anonymous\x00.*?\.php(?:0x?|:[0-9]++\$)[0-9a-fA-F]++/', fn ($m) => class_exists($m[0], false) ? (get_parent_class($m[0]) ?: key(class_implements($m[0])) ?: 'class').'@anonymous' : $m[0], $a[Caster::PREFIX_PROTECTED.'message']); } if (isset($a[Caster::PREFIX_PROTECTED.'file'], $a[Caster::PREFIX_PROTECTED.'line'])) { diff --git a/redaxo/src/core/vendor/symfony/var-dumper/Caster/FiberCaster.php b/redaxo/src/core/vendor/symfony/var-dumper/Caster/FiberCaster.php index c74a9e59c4..b797dbd634 100644 --- a/redaxo/src/core/vendor/symfony/var-dumper/Caster/FiberCaster.php +++ b/redaxo/src/core/vendor/symfony/var-dumper/Caster/FiberCaster.php @@ -20,6 +20,9 @@ */ final class FiberCaster { + /** + * @return array + */ public static function castFiber(\Fiber $fiber, array $a, Stub $stub, bool $isNested, int $filter = 0) { $prefix = Caster::PREFIX_VIRTUAL; diff --git a/redaxo/src/core/vendor/symfony/var-dumper/Caster/IntlCaster.php b/redaxo/src/core/vendor/symfony/var-dumper/Caster/IntlCaster.php index 1ed91d4d6a..a4590f4b5a 100644 --- a/redaxo/src/core/vendor/symfony/var-dumper/Caster/IntlCaster.php +++ b/redaxo/src/core/vendor/symfony/var-dumper/Caster/IntlCaster.php @@ -21,6 +21,9 @@ */ class IntlCaster { + /** + * @return array + */ public static function castMessageFormatter(\MessageFormatter $c, array $a, Stub $stub, bool $isNested) { $a += [ @@ -31,6 +34,9 @@ public static function castMessageFormatter(\MessageFormatter $c, array $a, Stub return self::castError($c, $a); } + /** + * @return array + */ public static function castNumberFormatter(\NumberFormatter $c, array $a, Stub $stub, bool $isNested, int $filter = 0) { $a += [ @@ -108,6 +114,9 @@ public static function castNumberFormatter(\NumberFormatter $c, array $a, Stub $ return self::castError($c, $a); } + /** + * @return array + */ public static function castIntlTimeZone(\IntlTimeZone $c, array $a, Stub $stub, bool $isNested) { $a += [ @@ -125,6 +134,9 @@ public static function castIntlTimeZone(\IntlTimeZone $c, array $a, Stub $stub, return self::castError($c, $a); } + /** + * @return array + */ public static function castIntlCalendar(\IntlCalendar $c, array $a, Stub $stub, bool $isNested, int $filter = 0) { $a += [ @@ -142,6 +154,9 @@ public static function castIntlCalendar(\IntlCalendar $c, array $a, Stub $stub, return self::castError($c, $a); } + /** + * @return array + */ public static function castIntlDateFormatter(\IntlDateFormatter $c, array $a, Stub $stub, bool $isNested, int $filter = 0) { $a += [ diff --git a/redaxo/src/core/vendor/symfony/var-dumper/Caster/LinkStub.php b/redaxo/src/core/vendor/symfony/var-dumper/Caster/LinkStub.php index 4113e3a278..df95f8b0ef 100644 --- a/redaxo/src/core/vendor/symfony/var-dumper/Caster/LinkStub.php +++ b/redaxo/src/core/vendor/symfony/var-dumper/Caster/LinkStub.php @@ -60,7 +60,7 @@ public function __construct(string $label, int $line = 0, string $href = null) } } - private function getComposerRoot(string $file, bool &$inVendor) + private function getComposerRoot(string $file, bool &$inVendor): string|false { if (!isset(self::$vendorRoots)) { self::$vendorRoots = []; diff --git a/redaxo/src/core/vendor/symfony/var-dumper/Caster/MemcachedCaster.php b/redaxo/src/core/vendor/symfony/var-dumper/Caster/MemcachedCaster.php index bc1fd63faa..2f161e8cb3 100644 --- a/redaxo/src/core/vendor/symfony/var-dumper/Caster/MemcachedCaster.php +++ b/redaxo/src/core/vendor/symfony/var-dumper/Caster/MemcachedCaster.php @@ -23,6 +23,9 @@ class MemcachedCaster private static array $optionConstants; private static array $defaultOptions; + /** + * @return array + */ public static function castMemcached(\Memcached $c, array $a, Stub $stub, bool $isNested) { $a += [ diff --git a/redaxo/src/core/vendor/symfony/var-dumper/Caster/PdoCaster.php b/redaxo/src/core/vendor/symfony/var-dumper/Caster/PdoCaster.php index 0372a63014..d68eae2166 100644 --- a/redaxo/src/core/vendor/symfony/var-dumper/Caster/PdoCaster.php +++ b/redaxo/src/core/vendor/symfony/var-dumper/Caster/PdoCaster.php @@ -59,6 +59,9 @@ class PdoCaster ], ]; + /** + * @return array + */ public static function castPdo(\PDO $c, array $a, Stub $stub, bool $isNested) { $attr = []; @@ -108,6 +111,9 @@ public static function castPdo(\PDO $c, array $a, Stub $stub, bool $isNested) return $a; } + /** + * @return array + */ public static function castPdoStatement(\PDOStatement $c, array $a, Stub $stub, bool $isNested) { $prefix = Caster::PREFIX_VIRTUAL; diff --git a/redaxo/src/core/vendor/symfony/var-dumper/Caster/PgSqlCaster.php b/redaxo/src/core/vendor/symfony/var-dumper/Caster/PgSqlCaster.php index d8e5b52534..0d8b3d919b 100644 --- a/redaxo/src/core/vendor/symfony/var-dumper/Caster/PgSqlCaster.php +++ b/redaxo/src/core/vendor/symfony/var-dumper/Caster/PgSqlCaster.php @@ -69,6 +69,9 @@ class PgSqlCaster 'function' => \PGSQL_DIAG_SOURCE_FUNCTION, ]; + /** + * @return array + */ public static function castLargeObject($lo, array $a, Stub $stub, bool $isNested) { $a['seek position'] = pg_lo_tell($lo); @@ -76,6 +79,9 @@ public static function castLargeObject($lo, array $a, Stub $stub, bool $isNested return $a; } + /** + * @return array + */ public static function castLink($link, array $a, Stub $stub, bool $isNested) { $a['status'] = pg_connection_status($link); @@ -108,6 +114,9 @@ public static function castLink($link, array $a, Stub $stub, bool $isNested) return $a; } + /** + * @return array + */ public static function castResult($result, array $a, Stub $stub, bool $isNested) { $a['num rows'] = pg_num_rows($result); diff --git a/redaxo/src/core/vendor/symfony/var-dumper/Caster/ProxyManagerCaster.php b/redaxo/src/core/vendor/symfony/var-dumper/Caster/ProxyManagerCaster.php index e7120191fe..eb6c88db6a 100644 --- a/redaxo/src/core/vendor/symfony/var-dumper/Caster/ProxyManagerCaster.php +++ b/redaxo/src/core/vendor/symfony/var-dumper/Caster/ProxyManagerCaster.php @@ -21,6 +21,9 @@ */ class ProxyManagerCaster { + /** + * @return array + */ public static function castProxy(ProxyInterface $c, array $a, Stub $stub, bool $isNested) { if ($parent = get_parent_class($c)) { diff --git a/redaxo/src/core/vendor/symfony/var-dumper/Caster/RdKafkaCaster.php b/redaxo/src/core/vendor/symfony/var-dumper/Caster/RdKafkaCaster.php index 82b8c8affb..fcaa1b768a 100644 --- a/redaxo/src/core/vendor/symfony/var-dumper/Caster/RdKafkaCaster.php +++ b/redaxo/src/core/vendor/symfony/var-dumper/Caster/RdKafkaCaster.php @@ -31,6 +31,9 @@ */ class RdKafkaCaster { + /** + * @return array + */ public static function castKafkaConsumer(KafkaConsumer $c, array $a, Stub $stub, bool $isNested) { $prefix = Caster::PREFIX_VIRTUAL; @@ -51,6 +54,9 @@ public static function castKafkaConsumer(KafkaConsumer $c, array $a, Stub $stub, return $a; } + /** + * @return array + */ public static function castTopic(Topic $c, array $a, Stub $stub, bool $isNested) { $prefix = Caster::PREFIX_VIRTUAL; @@ -62,6 +68,9 @@ public static function castTopic(Topic $c, array $a, Stub $stub, bool $isNested) return $a; } + /** + * @return array + */ public static function castTopicPartition(TopicPartition $c, array $a) { $prefix = Caster::PREFIX_VIRTUAL; @@ -75,6 +84,9 @@ public static function castTopicPartition(TopicPartition $c, array $a) return $a; } + /** + * @return array + */ public static function castMessage(Message $c, array $a, Stub $stub, bool $isNested) { $prefix = Caster::PREFIX_VIRTUAL; @@ -86,6 +98,9 @@ public static function castMessage(Message $c, array $a, Stub $stub, bool $isNes return $a; } + /** + * @return array + */ public static function castConf(Conf $c, array $a, Stub $stub, bool $isNested) { $prefix = Caster::PREFIX_VIRTUAL; @@ -97,6 +112,9 @@ public static function castConf(Conf $c, array $a, Stub $stub, bool $isNested) return $a; } + /** + * @return array + */ public static function castTopicConf(TopicConf $c, array $a, Stub $stub, bool $isNested) { $prefix = Caster::PREFIX_VIRTUAL; @@ -108,6 +126,9 @@ public static function castTopicConf(TopicConf $c, array $a, Stub $stub, bool $i return $a; } + /** + * @return array + */ public static function castRdKafka(\RdKafka $c, array $a, Stub $stub, bool $isNested) { $prefix = Caster::PREFIX_VIRTUAL; @@ -121,6 +142,9 @@ public static function castRdKafka(\RdKafka $c, array $a, Stub $stub, bool $isNe return $a; } + /** + * @return array + */ public static function castCollectionMetadata(CollectionMetadata $c, array $a, Stub $stub, bool $isNested) { $a += iterator_to_array($c); @@ -128,6 +152,9 @@ public static function castCollectionMetadata(CollectionMetadata $c, array $a, S return $a; } + /** + * @return array + */ public static function castTopicMetadata(TopicMetadata $c, array $a, Stub $stub, bool $isNested) { $prefix = Caster::PREFIX_VIRTUAL; @@ -140,6 +167,9 @@ public static function castTopicMetadata(TopicMetadata $c, array $a, Stub $stub, return $a; } + /** + * @return array + */ public static function castPartitionMetadata(PartitionMetadata $c, array $a, Stub $stub, bool $isNested) { $prefix = Caster::PREFIX_VIRTUAL; @@ -153,6 +183,9 @@ public static function castPartitionMetadata(PartitionMetadata $c, array $a, Stu return $a; } + /** + * @return array + */ public static function castBrokerMetadata(BrokerMetadata $c, array $a, Stub $stub, bool $isNested) { $prefix = Caster::PREFIX_VIRTUAL; @@ -166,6 +199,9 @@ public static function castBrokerMetadata(BrokerMetadata $c, array $a, Stub $stu return $a; } + /** + * @return array + */ private static function extractMetadata(KafkaConsumer|\RdKafka $c) { $prefix = Caster::PREFIX_VIRTUAL; diff --git a/redaxo/src/core/vendor/symfony/var-dumper/Caster/RedisCaster.php b/redaxo/src/core/vendor/symfony/var-dumper/Caster/RedisCaster.php index eac25a12a8..6ff046754d 100644 --- a/redaxo/src/core/vendor/symfony/var-dumper/Caster/RedisCaster.php +++ b/redaxo/src/core/vendor/symfony/var-dumper/Caster/RedisCaster.php @@ -11,6 +11,7 @@ namespace Symfony\Component\VarDumper\Caster; +use Relay\Relay; use Symfony\Component\VarDumper\Cloner\Stub; /** @@ -23,15 +24,15 @@ class RedisCaster { private const SERIALIZERS = [ - \Redis::SERIALIZER_NONE => 'NONE', - \Redis::SERIALIZER_PHP => 'PHP', + 0 => 'NONE', // Redis::SERIALIZER_NONE + 1 => 'PHP', // Redis::SERIALIZER_PHP 2 => 'IGBINARY', // Optional Redis::SERIALIZER_IGBINARY ]; private const MODES = [ - \Redis::ATOMIC => 'ATOMIC', - \Redis::MULTI => 'MULTI', - \Redis::PIPELINE => 'PIPELINE', + 0 => 'ATOMIC', // Redis::ATOMIC + 1 => 'MULTI', // Redis::MULTI + 2 => 'PIPELINE', // Redis::PIPELINE ]; private const COMPRESSION_MODES = [ @@ -46,7 +47,10 @@ class RedisCaster \RedisCluster::FAILOVER_DISTRIBUTE_SLAVES => 'DISTRIBUTE_SLAVES', ]; - public static function castRedis(\Redis $c, array $a, Stub $stub, bool $isNested) + /** + * @return array + */ + public static function castRedis(\Redis|Relay $c, array $a, Stub $stub, bool $isNested) { $prefix = Caster::PREFIX_VIRTUAL; @@ -72,6 +76,9 @@ public static function castRedis(\Redis $c, array $a, Stub $stub, bool $isNested ]; } + /** + * @return array + */ public static function castRedisArray(\RedisArray $c, array $a, Stub $stub, bool $isNested) { $prefix = Caster::PREFIX_VIRTUAL; @@ -84,6 +91,9 @@ public static function castRedisArray(\RedisArray $c, array $a, Stub $stub, bool ]; } + /** + * @return array + */ public static function castRedisCluster(\RedisCluster $c, array $a, Stub $stub, bool $isNested) { $prefix = Caster::PREFIX_VIRTUAL; @@ -102,9 +112,9 @@ public static function castRedisCluster(\RedisCluster $c, array $a, Stub $stub, return $a; } - private static function getRedisOptions(\Redis|\RedisArray|\RedisCluster $redis, array $options = []): EnumStub + private static function getRedisOptions(\Redis|Relay|\RedisArray|\RedisCluster $redis, array $options = []): EnumStub { - $serializer = $redis->getOption(\Redis::OPT_SERIALIZER); + $serializer = $redis->getOption(\defined('Redis::OPT_SERIALIZER') ? \Redis::OPT_SERIALIZER : 1); if (\is_array($serializer)) { foreach ($serializer as &$v) { if (isset(self::SERIALIZERS[$v])) { @@ -136,11 +146,11 @@ private static function getRedisOptions(\Redis|\RedisArray|\RedisCluster $redis, } $options += [ - 'TCP_KEEPALIVE' => \defined('Redis::OPT_TCP_KEEPALIVE') ? $redis->getOption(\Redis::OPT_TCP_KEEPALIVE) : 0, - 'READ_TIMEOUT' => $redis->getOption(\Redis::OPT_READ_TIMEOUT), + 'TCP_KEEPALIVE' => \defined('Redis::OPT_TCP_KEEPALIVE') ? $redis->getOption(\Redis::OPT_TCP_KEEPALIVE) : Relay::OPT_TCP_KEEPALIVE, + 'READ_TIMEOUT' => $redis->getOption(\defined('Redis::OPT_READ_TIMEOUT') ? \Redis::OPT_READ_TIMEOUT : Relay::OPT_READ_TIMEOUT), 'COMPRESSION' => $compression, 'SERIALIZER' => $serializer, - 'PREFIX' => $redis->getOption(\Redis::OPT_PREFIX), + 'PREFIX' => $redis->getOption(\defined('Redis::OPT_PREFIX') ? \Redis::OPT_PREFIX : Relay::OPT_PREFIX), 'SCAN' => $retry, ]; diff --git a/redaxo/src/core/vendor/symfony/var-dumper/Caster/ReflectionCaster.php b/redaxo/src/core/vendor/symfony/var-dumper/Caster/ReflectionCaster.php index 00675dfdc7..4adb9bc9fe 100644 --- a/redaxo/src/core/vendor/symfony/var-dumper/Caster/ReflectionCaster.php +++ b/redaxo/src/core/vendor/symfony/var-dumper/Caster/ReflectionCaster.php @@ -35,6 +35,9 @@ class ReflectionCaster 'isVariadic' => 'isVariadic', ]; + /** + * @return array + */ public static function castClosure(\Closure $c, array $a, Stub $stub, bool $isNested, int $filter = 0) { $prefix = Caster::PREFIX_VIRTUAL; @@ -71,6 +74,9 @@ public static function castClosure(\Closure $c, array $a, Stub $stub, bool $isNe return $a; } + /** + * @return array + */ public static function unsetClosureFileInfo(\Closure $c, array $a) { unset($a[Caster::PREFIX_VIRTUAL.'file'], $a[Caster::PREFIX_VIRTUAL.'line']); @@ -78,7 +84,7 @@ public static function unsetClosureFileInfo(\Closure $c, array $a) return $a; } - public static function castGenerator(\Generator $c, array $a, Stub $stub, bool $isNested) + public static function castGenerator(\Generator $c, array $a, Stub $stub, bool $isNested): array { // Cannot create ReflectionGenerator based on a terminated Generator try { @@ -92,6 +98,9 @@ public static function castGenerator(\Generator $c, array $a, Stub $stub, bool $ return self::castReflectionGenerator($reflectionGenerator, $a, $stub, $isNested); } + /** + * @return array + */ public static function castType(\ReflectionType $c, array $a, Stub $stub, bool $isNested) { $prefix = Caster::PREFIX_VIRTUAL; @@ -114,6 +123,9 @@ public static function castType(\ReflectionType $c, array $a, Stub $stub, bool $ return $a; } + /** + * @return array + */ public static function castAttribute(\ReflectionAttribute $c, array $a, Stub $stub, bool $isNested) { self::addMap($a, $c, [ @@ -124,6 +136,9 @@ public static function castAttribute(\ReflectionAttribute $c, array $a, Stub $st return $a; } + /** + * @return array + */ public static function castReflectionGenerator(\ReflectionGenerator $c, array $a, Stub $stub, bool $isNested) { $prefix = Caster::PREFIX_VIRTUAL; @@ -159,6 +174,9 @@ public static function castReflectionGenerator(\ReflectionGenerator $c, array $a return $a; } + /** + * @return array + */ public static function castClass(\ReflectionClass $c, array $a, Stub $stub, bool $isNested, int $filter = 0) { $prefix = Caster::PREFIX_VIRTUAL; @@ -190,6 +208,9 @@ public static function castClass(\ReflectionClass $c, array $a, Stub $stub, bool return $a; } + /** + * @return array + */ public static function castFunctionAbstract(\ReflectionFunctionAbstract $c, array $a, Stub $stub, bool $isNested, int $filter = 0) { $prefix = Caster::PREFIX_VIRTUAL; @@ -248,6 +269,9 @@ public static function castFunctionAbstract(\ReflectionFunctionAbstract $c, arra return $a; } + /** + * @return array + */ public static function castClassConstant(\ReflectionClassConstant $c, array $a, Stub $stub, bool $isNested) { $a[Caster::PREFIX_VIRTUAL.'modifiers'] = implode(' ', \Reflection::getModifierNames($c->getModifiers())); @@ -258,6 +282,9 @@ public static function castClassConstant(\ReflectionClassConstant $c, array $a, return $a; } + /** + * @return array + */ public static function castMethod(\ReflectionMethod $c, array $a, Stub $stub, bool $isNested) { $a[Caster::PREFIX_VIRTUAL.'modifiers'] = implode(' ', \Reflection::getModifierNames($c->getModifiers())); @@ -265,6 +292,9 @@ public static function castMethod(\ReflectionMethod $c, array $a, Stub $stub, bo return $a; } + /** + * @return array + */ public static function castParameter(\ReflectionParameter $c, array $a, Stub $stub, bool $isNested) { $prefix = Caster::PREFIX_VIRTUAL; @@ -305,6 +335,9 @@ public static function castParameter(\ReflectionParameter $c, array $a, Stub $st return $a; } + /** + * @return array + */ public static function castProperty(\ReflectionProperty $c, array $a, Stub $stub, bool $isNested) { $a[Caster::PREFIX_VIRTUAL.'modifiers'] = implode(' ', \Reflection::getModifierNames($c->getModifiers())); @@ -315,6 +348,9 @@ public static function castProperty(\ReflectionProperty $c, array $a, Stub $stub return $a; } + /** + * @return array + */ public static function castReference(\ReflectionReference $c, array $a, Stub $stub, bool $isNested) { $a[Caster::PREFIX_VIRTUAL.'id'] = $c->getId(); @@ -322,6 +358,9 @@ public static function castReference(\ReflectionReference $c, array $a, Stub $st return $a; } + /** + * @return array + */ public static function castExtension(\ReflectionExtension $c, array $a, Stub $stub, bool $isNested) { self::addMap($a, $c, [ @@ -338,6 +377,9 @@ public static function castExtension(\ReflectionExtension $c, array $a, Stub $st return $a; } + /** + * @return array + */ public static function castZendExtension(\ReflectionZendExtension $c, array $a, Stub $stub, bool $isNested) { self::addMap($a, $c, [ @@ -350,6 +392,9 @@ public static function castZendExtension(\ReflectionZendExtension $c, array $a, return $a; } + /** + * @return string + */ public static function getSignature(array $a) { $prefix = Caster::PREFIX_VIRTUAL; @@ -402,7 +447,7 @@ public static function getSignature(array $a) return $signature; } - private static function addExtra(array &$a, \Reflector $c) + private static function addExtra(array &$a, \Reflector $c): void { $x = isset($a[Caster::PREFIX_VIRTUAL.'extra']) ? $a[Caster::PREFIX_VIRTUAL.'extra']->value : []; @@ -418,7 +463,7 @@ private static function addExtra(array &$a, \Reflector $c) } } - private static function addMap(array &$a, object $c, array $map, string $prefix = Caster::PREFIX_VIRTUAL) + private static function addMap(array &$a, object $c, array $map, string $prefix = Caster::PREFIX_VIRTUAL): void { foreach ($map as $k => $m) { if ('isDisabled' === $k) { diff --git a/redaxo/src/core/vendor/symfony/var-dumper/Caster/ResourceCaster.php b/redaxo/src/core/vendor/symfony/var-dumper/Caster/ResourceCaster.php index 6db234e869..f3bbf3be4f 100644 --- a/redaxo/src/core/vendor/symfony/var-dumper/Caster/ResourceCaster.php +++ b/redaxo/src/core/vendor/symfony/var-dumper/Caster/ResourceCaster.php @@ -27,6 +27,9 @@ public static function castCurl(\CurlHandle $h, array $a, Stub $stub, bool $isNe return curl_getinfo($h); } + /** + * @return array + */ public static function castDba($dba, array $a, Stub $stub, bool $isNested) { $list = dba_list(); @@ -35,12 +38,15 @@ public static function castDba($dba, array $a, Stub $stub, bool $isNested) return $a; } + /** + * @return array + */ public static function castProcess($process, array $a, Stub $stub, bool $isNested) { return proc_get_status($process); } - public static function castStream($stream, array $a, Stub $stub, bool $isNested) + public static function castStream($stream, array $a, Stub $stub, bool $isNested): array { $a = stream_get_meta_data($stream) + static::castStreamContext($stream, $a, $stub, $isNested); if ($a['uri'] ?? false) { @@ -50,11 +56,17 @@ public static function castStream($stream, array $a, Stub $stub, bool $isNested) return $a; } + /** + * @return array + */ public static function castStreamContext($stream, array $a, Stub $stub, bool $isNested) { return @stream_context_get_params($stream) ?: $a; } + /** + * @return array + */ public static function castGd($gd, array $a, Stub $stub, bool $isNested) { $a['size'] = imagesx($gd).'x'.imagesy($gd); @@ -63,6 +75,9 @@ public static function castGd($gd, array $a, Stub $stub, bool $isNested) return $a; } + /** + * @return array + */ public static function castOpensslX509($h, array $a, Stub $stub, bool $isNested) { $stub->cut = -1; diff --git a/redaxo/src/core/vendor/symfony/var-dumper/Caster/ScalarStub.php b/redaxo/src/core/vendor/symfony/var-dumper/Caster/ScalarStub.php new file mode 100644 index 0000000000..3bb1935b88 --- /dev/null +++ b/redaxo/src/core/vendor/symfony/var-dumper/Caster/ScalarStub.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Caster; + +use Symfony\Component\VarDumper\Cloner\Stub; + +/** + * Represents any arbitrary value. + * + * @author Alexandre Daubois + */ +class ScalarStub extends Stub +{ + public function __construct(mixed $value) + { + $this->value = $value; + } +} diff --git a/redaxo/src/core/vendor/symfony/var-dumper/Caster/SplCaster.php b/redaxo/src/core/vendor/symfony/var-dumper/Caster/SplCaster.php index 448afbad90..ea86cb4988 100644 --- a/redaxo/src/core/vendor/symfony/var-dumper/Caster/SplCaster.php +++ b/redaxo/src/core/vendor/symfony/var-dumper/Caster/SplCaster.php @@ -29,16 +29,25 @@ class SplCaster \SplFileObject::READ_CSV => 'READ_CSV', ]; + /** + * @return array + */ public static function castArrayObject(\ArrayObject $c, array $a, Stub $stub, bool $isNested) { return self::castSplArray($c, $a, $stub, $isNested); } + /** + * @return array + */ public static function castArrayIterator(\ArrayIterator $c, array $a, Stub $stub, bool $isNested) { return self::castSplArray($c, $a, $stub, $isNested); } + /** + * @return array + */ public static function castHeap(\Iterator $c, array $a, Stub $stub, bool $isNested) { $a += [ @@ -48,6 +57,9 @@ public static function castHeap(\Iterator $c, array $a, Stub $stub, bool $isNest return $a; } + /** + * @return array + */ public static function castDoublyLinkedList(\SplDoublyLinkedList $c, array $a, Stub $stub, bool $isNested) { $prefix = Caster::PREFIX_VIRTUAL; @@ -63,6 +75,9 @@ public static function castDoublyLinkedList(\SplDoublyLinkedList $c, array $a, S return $a; } + /** + * @return array + */ public static function castFileInfo(\SplFileInfo $c, array $a, Stub $stub, bool $isNested) { static $map = [ @@ -139,6 +154,9 @@ public static function castFileInfo(\SplFileInfo $c, array $a, Stub $stub, bool return $a; } + /** + * @return array + */ public static function castFileObject(\SplFileObject $c, array $a, Stub $stub, bool $isNested) { static $map = [ @@ -176,6 +194,9 @@ public static function castFileObject(\SplFileObject $c, array $a, Stub $stub, b return $a; } + /** + * @return array + */ public static function castObjectStorage(\SplObjectStorage $c, array $a, Stub $stub, bool $isNested) { $storage = []; @@ -184,10 +205,10 @@ public static function castObjectStorage(\SplObjectStorage $c, array $a, Stub $s $clone = clone $c; foreach ($clone as $obj) { - $storage[] = [ + $storage[] = new EnumStub([ 'object' => $obj, 'info' => $clone->getInfo(), - ]; + ]); } $a += [ @@ -197,6 +218,9 @@ public static function castObjectStorage(\SplObjectStorage $c, array $a, Stub $s return $a; } + /** + * @return array + */ public static function castOuterIterator(\OuterIterator $c, array $a, Stub $stub, bool $isNested) { $a[Caster::PREFIX_VIRTUAL.'innerIterator'] = $c->getInnerIterator(); @@ -204,6 +228,9 @@ public static function castOuterIterator(\OuterIterator $c, array $a, Stub $stub return $a; } + /** + * @return array + */ public static function castWeakReference(\WeakReference $c, array $a, Stub $stub, bool $isNested) { $a[Caster::PREFIX_VIRTUAL.'object'] = $c->get(); @@ -211,6 +238,27 @@ public static function castWeakReference(\WeakReference $c, array $a, Stub $stub return $a; } + /** + * @return array + */ + public static function castWeakMap(\WeakMap $c, array $a, Stub $stub, bool $isNested) + { + $map = []; + + foreach (clone $c as $obj => $data) { + $map[] = new EnumStub([ + 'object' => $obj, + 'data' => $data, + ]); + } + + $a += [ + Caster::PREFIX_VIRTUAL.'map' => $map, + ]; + + return $a; + } + private static function castSplArray(\ArrayObject|\ArrayIterator $c, array $a, Stub $stub, bool $isNested): array { $prefix = Caster::PREFIX_VIRTUAL; diff --git a/redaxo/src/core/vendor/symfony/var-dumper/Caster/StubCaster.php b/redaxo/src/core/vendor/symfony/var-dumper/Caster/StubCaster.php index 32ead7c277..4b93ff76f6 100644 --- a/redaxo/src/core/vendor/symfony/var-dumper/Caster/StubCaster.php +++ b/redaxo/src/core/vendor/symfony/var-dumper/Caster/StubCaster.php @@ -22,6 +22,9 @@ */ class StubCaster { + /** + * @return array + */ public static function castStub(Stub $c, array $a, Stub $stub, bool $isNested) { if ($isNested) { @@ -43,11 +46,17 @@ public static function castStub(Stub $c, array $a, Stub $stub, bool $isNested) return $a; } + /** + * @return array + */ public static function castCutArray(CutArrayStub $c, array $a, Stub $stub, bool $isNested) { return $isNested ? $c->preservedSubset : $a; } + /** + * @return array + */ public static function cutInternals($obj, array $a, Stub $stub, bool $isNested) { if ($isNested) { @@ -59,6 +68,9 @@ public static function cutInternals($obj, array $a, Stub $stub, bool $isNested) return $a; } + /** + * @return array + */ public static function castEnum(EnumStub $c, array $a, Stub $stub, bool $isNested) { if ($isNested) { @@ -81,4 +93,15 @@ public static function castEnum(EnumStub $c, array $a, Stub $stub, bool $isNeste return $a; } + + /** + * @return array + */ + public static function castScalar(ScalarStub $scalarStub, array $a, Stub $stub) + { + $stub->type = Stub::TYPE_SCALAR; + $stub->attr['value'] = $scalarStub->value; + + return $a; + } } diff --git a/redaxo/src/core/vendor/symfony/var-dumper/Caster/SymfonyCaster.php b/redaxo/src/core/vendor/symfony/var-dumper/Caster/SymfonyCaster.php index 3b13666cc1..ebc00f90ec 100644 --- a/redaxo/src/core/vendor/symfony/var-dumper/Caster/SymfonyCaster.php +++ b/redaxo/src/core/vendor/symfony/var-dumper/Caster/SymfonyCaster.php @@ -31,6 +31,9 @@ class SymfonyCaster 'format' => 'getRequestFormat', ]; + /** + * @return array + */ public static function castRequest(Request $request, array $a, Stub $stub, bool $isNested) { $clone = null; @@ -46,6 +49,9 @@ public static function castRequest(Request $request, array $a, Stub $stub, bool return $a; } + /** + * @return array + */ public static function castHttpClient($client, array $a, Stub $stub, bool $isNested) { $multiKey = sprintf("\0%s\0multi", $client::class); @@ -56,6 +62,9 @@ public static function castHttpClient($client, array $a, Stub $stub, bool $isNes return $a; } + /** + * @return array + */ public static function castHttpClientResponse($response, array $a, Stub $stub, bool $isNested) { $stub->cut += \count($a); @@ -68,6 +77,9 @@ public static function castHttpClientResponse($response, array $a, Stub $stub, b return $a; } + /** + * @return array + */ public static function castLazyObjectState($state, array $a, Stub $stub, bool $isNested) { if (!$isNested) { @@ -93,6 +105,9 @@ public static function castLazyObjectState($state, array $a, Stub $stub, bool $i return $a; } + /** + * @return array + */ public static function castUuid(Uuid $uuid, array $a, Stub $stub, bool $isNested) { $a[Caster::PREFIX_VIRTUAL.'toBase58'] = $uuid->toBase58(); @@ -106,6 +121,9 @@ public static function castUuid(Uuid $uuid, array $a, Stub $stub, bool $isNested return $a; } + /** + * @return array + */ public static function castUlid(Ulid $ulid, array $a, Stub $stub, bool $isNested) { $a[Caster::PREFIX_VIRTUAL.'toBase58'] = $ulid->toBase58(); diff --git a/redaxo/src/core/vendor/symfony/var-dumper/Caster/XmlReaderCaster.php b/redaxo/src/core/vendor/symfony/var-dumper/Caster/XmlReaderCaster.php index 506746b468..d802bbf2a1 100644 --- a/redaxo/src/core/vendor/symfony/var-dumper/Caster/XmlReaderCaster.php +++ b/redaxo/src/core/vendor/symfony/var-dumper/Caster/XmlReaderCaster.php @@ -43,6 +43,9 @@ class XmlReaderCaster \XMLReader::XML_DECLARATION => 'XML_DECLARATION', ]; + /** + * @return array + */ public static function castXmlReader(\XMLReader $reader, array $a, Stub $stub, bool $isNested) { try { diff --git a/redaxo/src/core/vendor/symfony/var-dumper/Caster/XmlResourceCaster.php b/redaxo/src/core/vendor/symfony/var-dumper/Caster/XmlResourceCaster.php index ba55fcedd9..0cf42584a0 100644 --- a/redaxo/src/core/vendor/symfony/var-dumper/Caster/XmlResourceCaster.php +++ b/redaxo/src/core/vendor/symfony/var-dumper/Caster/XmlResourceCaster.php @@ -47,6 +47,9 @@ class XmlResourceCaster \XML_ERROR_EXTERNAL_ENTITY_HANDLING => 'XML_ERROR_EXTERNAL_ENTITY_HANDLING', ]; + /** + * @return array + */ public static function castXml($h, array $a, Stub $stub, bool $isNested) { $a['current_byte_index'] = xml_get_current_byte_index($h); diff --git a/redaxo/src/core/vendor/symfony/var-dumper/Cloner/AbstractCloner.php b/redaxo/src/core/vendor/symfony/var-dumper/Cloner/AbstractCloner.php index 6c3efdeb60..6a746b88e3 100644 --- a/redaxo/src/core/vendor/symfony/var-dumper/Cloner/AbstractCloner.php +++ b/redaxo/src/core/vendor/symfony/var-dumper/Cloner/AbstractCloner.php @@ -28,6 +28,7 @@ abstract class AbstractCloner implements ClonerInterface 'Symfony\Component\VarDumper\Caster\CutArrayStub' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'castCutArray'], 'Symfony\Component\VarDumper\Caster\ConstStub' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'castStub'], 'Symfony\Component\VarDumper\Caster\EnumStub' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'castEnum'], + 'Symfony\Component\VarDumper\Caster\ScalarStub' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'castScalar'], 'Fiber' => ['Symfony\Component\VarDumper\Caster\FiberCaster', 'castFiber'], @@ -94,6 +95,7 @@ abstract class AbstractCloner implements ClonerInterface 'Symfony\Component\VarDumper\Caster\TraceStub' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castTraceStub'], 'Symfony\Component\VarDumper\Caster\FrameStub' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castFrameStub'], 'Symfony\Component\VarDumper\Cloner\AbstractCloner' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'], + 'Symfony\Component\ErrorHandler\Exception\FlattenException' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castFlattenException'], 'Symfony\Component\ErrorHandler\Exception\SilencedErrorContext' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castSilencedErrorContext'], 'Imagine\Image\ImageInterface' => ['Symfony\Component\VarDumper\Caster\ImagineCaster', 'castImage'], @@ -125,9 +127,11 @@ abstract class AbstractCloner implements ClonerInterface 'SplObjectStorage' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castObjectStorage'], 'SplPriorityQueue' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castHeap'], 'OuterIterator' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castOuterIterator'], + 'WeakMap' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castWeakMap'], 'WeakReference' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castWeakReference'], 'Redis' => ['Symfony\Component\VarDumper\Caster\RedisCaster', 'castRedis'], + 'Relay\Relay' => ['Symfony\Component\VarDumper\Caster\RedisCaster', 'castRedis'], 'RedisArray' => ['Symfony\Component\VarDumper\Caster\RedisCaster', 'castRedisArray'], 'RedisCluster' => ['Symfony\Component\VarDumper\Caster\RedisCaster', 'castRedisCluster'], @@ -229,6 +233,8 @@ public function __construct(array $casters = null) * see e.g. static::$defaultCasters. * * @param callable[] $casters A map of casters + * + * @return void */ public function addCasters(array $casters) { @@ -239,6 +245,8 @@ public function addCasters(array $casters) /** * Sets the maximum number of items to clone past the minimum depth in nested structures. + * + * @return void */ public function setMaxItems(int $maxItems) { @@ -247,6 +255,8 @@ public function setMaxItems(int $maxItems) /** * Sets the maximum cloned length for strings. + * + * @return void */ public function setMaxString(int $maxString) { @@ -256,6 +266,8 @@ public function setMaxString(int $maxString) /** * Sets the minimum tree depth where we are guaranteed to clone all the items. After this * depth is reached, only setMaxItems items will be cloned. + * + * @return void */ public function setMinDepth(int $minDepth) { diff --git a/redaxo/src/core/vendor/symfony/var-dumper/Cloner/Data.php b/redaxo/src/core/vendor/symfony/var-dumper/Cloner/Data.php index 6ecb883e83..928f72d7a8 100644 --- a/redaxo/src/core/vendor/symfony/var-dumper/Cloner/Data.php +++ b/redaxo/src/core/vendor/symfony/var-dumper/Cloner/Data.php @@ -211,6 +211,11 @@ public function withContext(array $context): static return $data; } + public function getContext(): array + { + return $this->context; + } + /** * Seeks to a specific key in nested data structures. */ @@ -257,21 +262,21 @@ public function seek(string|int $key): ?static /** * Dumps data with a DumperInterface dumper. + * + * @return void */ public function dump(DumperInterface $dumper) { $refs = [0]; $cursor = new Cursor(); + $cursor->hashType = -1; + $cursor->attr = $this->context[SourceContextProvider::class] ?? []; + $label = $this->context['label'] ?? ''; - if ($cursor->attr = $this->context[SourceContextProvider::class] ?? []) { - $cursor->attr['if_links'] = true; - $cursor->hashType = -1; - $dumper->dumpScalar($cursor, 'default', '^'); - $cursor->attr = ['if_links' => true]; - $dumper->dumpScalar($cursor, 'default', ' '); - $cursor->hashType = 0; + if ($cursor->attr || '' !== $label) { + $dumper->dumpScalar($cursor, 'label', $label); } - + $cursor->hashType = 0; $this->dumpItem($dumper, $cursor, $refs, $this->data[$this->position][$this->key]); } @@ -280,7 +285,7 @@ public function dump(DumperInterface $dumper) * * @param mixed $item A Stub object or the original value being dumped */ - private function dumpItem(DumperInterface $dumper, Cursor $cursor, array &$refs, mixed $item) + private function dumpItem(DumperInterface $dumper, Cursor $cursor, array &$refs, mixed $item): void { $cursor->refIndex = 0; $cursor->softRefTo = $cursor->softRefHandle = $cursor->softRefCount = 0; @@ -362,6 +367,10 @@ private function dumpItem(DumperInterface $dumper, Cursor $cursor, array &$refs, $dumper->leaveHash($cursor, $item->type, $item->class, $withChildren, $cut); break; + case Stub::TYPE_SCALAR: + $dumper->dumpScalar($cursor, 'default', $item->attr['value']); + break; + default: throw new \RuntimeException(sprintf('Unexpected Stub type: "%s".', $item->type)); } @@ -402,7 +411,7 @@ private function dumpChildren(DumperInterface $dumper, Cursor $parentCursor, arr return $hashCut; } - private function getStub(mixed $item) + private function getStub(mixed $item): mixed { if (!$item || !\is_array($item)) { return $item; diff --git a/redaxo/src/core/vendor/symfony/var-dumper/Cloner/DumperInterface.php b/redaxo/src/core/vendor/symfony/var-dumper/Cloner/DumperInterface.php index 61d02d2406..4c5b315b60 100644 --- a/redaxo/src/core/vendor/symfony/var-dumper/Cloner/DumperInterface.php +++ b/redaxo/src/core/vendor/symfony/var-dumper/Cloner/DumperInterface.php @@ -20,6 +20,8 @@ interface DumperInterface { /** * Dumps a scalar value. + * + * @return void */ public function dumpScalar(Cursor $cursor, string $type, string|int|float|bool|null $value); @@ -29,6 +31,8 @@ public function dumpScalar(Cursor $cursor, string $type, string|int|float|bool|n * @param string $str The string being dumped * @param bool $bin Whether $str is UTF-8 or binary encoded * @param int $cut The number of characters $str has been cut by + * + * @return void */ public function dumpString(Cursor $cursor, string $str, bool $bin, int $cut); @@ -38,6 +42,8 @@ public function dumpString(Cursor $cursor, string $str, bool $bin, int $cut); * @param int $type A Cursor::HASH_* const for the type of hash * @param string|int|null $class The object class, resource type or array count * @param bool $hasChild When the dump of the hash has child item + * + * @return void */ public function enterHash(Cursor $cursor, int $type, string|int|null $class, bool $hasChild); @@ -48,6 +54,8 @@ public function enterHash(Cursor $cursor, int $type, string|int|null $class, boo * @param string|int|null $class The object class, resource type or array count * @param bool $hasChild When the dump of the hash has child item * @param int $cut The number of items the hash has been cut by + * + * @return void */ public function leaveHash(Cursor $cursor, int $type, string|int|null $class, bool $hasChild, int $cut); } diff --git a/redaxo/src/core/vendor/symfony/var-dumper/Cloner/Stub.php b/redaxo/src/core/vendor/symfony/var-dumper/Cloner/Stub.php index 1c5b887120..0c2a4b9d0a 100644 --- a/redaxo/src/core/vendor/symfony/var-dumper/Cloner/Stub.php +++ b/redaxo/src/core/vendor/symfony/var-dumper/Cloner/Stub.php @@ -23,6 +23,7 @@ class Stub public const TYPE_ARRAY = 3; public const TYPE_OBJECT = 4; public const TYPE_RESOURCE = 5; + public const TYPE_SCALAR = 6; public const STRING_BINARY = 1; public const STRING_UTF8 = 2; diff --git a/redaxo/src/core/vendor/symfony/var-dumper/Cloner/VarCloner.php b/redaxo/src/core/vendor/symfony/var-dumper/Cloner/VarCloner.php index 4068c7c386..e168d0d3b7 100644 --- a/redaxo/src/core/vendor/symfony/var-dumper/Cloner/VarCloner.php +++ b/redaxo/src/core/vendor/symfony/var-dumper/Cloner/VarCloner.php @@ -16,7 +16,6 @@ */ class VarCloner extends AbstractCloner { - private static string $gid; private static array $arrayCache = []; protected function doClone(mixed $var): array @@ -41,7 +40,6 @@ protected function doClone(mixed $var): array $stub = null; // Stub capturing the main properties of an original item value // or null if the original value is used directly - $gid = self::$gid ??= md5(random_bytes(6)); // Unique string used to detect the special $GLOBALS variable $arrayStub = new Stub(); $arrayStub->type = Stub::TYPE_ARRAY; $fromObjCast = false; diff --git a/redaxo/src/core/vendor/symfony/var-dumper/Command/ServerDumpCommand.php b/redaxo/src/core/vendor/symfony/var-dumper/Command/ServerDumpCommand.php index 1b06e694f7..b64a884b99 100644 --- a/redaxo/src/core/vendor/symfony/var-dumper/Command/ServerDumpCommand.php +++ b/redaxo/src/core/vendor/symfony/var-dumper/Command/ServerDumpCommand.php @@ -54,7 +54,7 @@ public function __construct(DumpServer $server, array $descriptors = []) parent::__construct(); } - protected function configure() + protected function configure(): void { $this ->addOption('format', null, InputOption::VALUE_REQUIRED, sprintf('The output format (%s)', implode(', ', $this->getAvailableFormats())), 'cli') diff --git a/redaxo/src/core/vendor/symfony/var-dumper/Dumper/AbstractDumper.php b/redaxo/src/core/vendor/symfony/var-dumper/Dumper/AbstractDumper.php index 2740b879ed..053a90972b 100644 --- a/redaxo/src/core/vendor/symfony/var-dumper/Dumper/AbstractDumper.php +++ b/redaxo/src/core/vendor/symfony/var-dumper/Dumper/AbstractDumper.php @@ -155,6 +155,8 @@ public function dump(Data $data, $output = null): ?string * * @param int $depth The recursive depth in the dumped structure for the line being dumped, * or -1 to signal the end-of-dump to the line dumper callable + * + * @return void */ protected function dumpLine(int $depth) { @@ -164,6 +166,8 @@ protected function dumpLine(int $depth) /** * Generic line dumper callback. + * + * @return void */ protected function echoLine(string $line, int $depth, string $indentPad) { diff --git a/redaxo/src/core/vendor/symfony/var-dumper/Dumper/CliDumper.php b/redaxo/src/core/vendor/symfony/var-dumper/Dumper/CliDumper.php index 660ca321a5..c155d4c79a 100644 --- a/redaxo/src/core/vendor/symfony/var-dumper/Dumper/CliDumper.php +++ b/redaxo/src/core/vendor/symfony/var-dumper/Dumper/CliDumper.php @@ -51,6 +51,7 @@ class CliDumper extends AbstractDumper "\r" => '\r', "\033" => '\e', ]; + protected static $unicodeCharsRx = "/[\u{00A0}\u{00AD}\u{034F}\u{061C}\u{115F}\u{1160}\u{17B4}\u{17B5}\u{180E}\u{2000}-\u{200F}\u{202F}\u{205F}\u{2060}-\u{2064}\u{206A}-\u{206F}\u{3000}\u{2800}\u{3164}\u{FEFF}\u{FFA0}\u{1D159}\u{1D173}-\u{1D17A}]/u"; protected $collapseNextHash = false; protected $expandNextHash = false; @@ -85,6 +86,8 @@ public function __construct($output = null, string $charset = null, int $flags = /** * Enables/disables colored output. + * + * @return void */ public function setColors(bool $colors) { @@ -93,6 +96,8 @@ public function setColors(bool $colors) /** * Sets the maximum number of characters per line for dumped strings. + * + * @return void */ public function setMaxStringWidth(int $maxStringWidth) { @@ -103,6 +108,8 @@ public function setMaxStringWidth(int $maxStringWidth) * Configures styles. * * @param array $styles A map of style names to style definitions + * + * @return void */ public function setStyles(array $styles) { @@ -113,12 +120,17 @@ public function setStyles(array $styles) * Configures display options. * * @param array $displayOptions A map of display options to customize the behavior + * + * @return void */ public function setDisplayOptions(array $displayOptions) { $this->displayOptions = $displayOptions + $this->displayOptions; } + /** + * @return void + */ public function dumpScalar(Cursor $cursor, string $type, string|int|float|bool|null $value) { $this->dumpKey($cursor); @@ -131,6 +143,11 @@ public function dumpScalar(Cursor $cursor, string $type, string|int|float|bool|n $style = 'default'; break; + case 'label': + $this->styles += ['label' => $this->styles['default']]; + $style = 'label'; + break; + case 'integer': $style = 'num'; @@ -174,6 +191,9 @@ public function dumpScalar(Cursor $cursor, string $type, string|int|float|bool|n $this->endValue($cursor); } + /** + * @return void + */ public function dumpString(Cursor $cursor, string $str, bool $bin, int $cut) { $this->dumpKey($cursor); @@ -262,6 +282,9 @@ public function dumpString(Cursor $cursor, string $str, bool $bin, int $cut) } } + /** + * @return void + */ public function enterHash(Cursor $cursor, int $type, string|int|null $class, bool $hasChild) { $this->colors ??= $this->supportsColors(); @@ -298,6 +321,9 @@ public function enterHash(Cursor $cursor, int $type, string|int|null $class, boo } } + /** + * @return void + */ public function leaveHash(Cursor $cursor, int $type, string|int|null $class, bool $hasChild, int $cut) { if (empty($cursor->attr['cut_hash'])) { @@ -313,6 +339,8 @@ public function leaveHash(Cursor $cursor, int $type, string|int|null $class, boo * * @param bool $hasChild When the dump of the hash has child item * @param int $cut The number of items the hash has been cut by + * + * @return void */ protected function dumpEllipsis(Cursor $cursor, bool $hasChild, int $cut) { @@ -329,6 +357,8 @@ protected function dumpEllipsis(Cursor $cursor, bool $hasChild, int $cut) /** * Dumps a key in a hash structure. + * + * @return void */ protected function dumpKey(Cursor $cursor) { @@ -454,7 +484,15 @@ protected function style(string $style, string $value, array $attr = []): string return $s.$endCchr; }, $value, -1, $cchrCount); - if ($this->colors) { + if (!($attr['binary'] ?? false)) { + $value = preg_replace_callback(static::$unicodeCharsRx, function ($c) use (&$cchrCount, $startCchr, $endCchr) { + ++$cchrCount; + + return $startCchr.'\u{'.strtoupper(dechex(mb_ord($c[0]))).'}'.$endCchr; + }, $value); + } + + if ($this->colors && '' !== $value) { if ($cchrCount && "\033" === $value[0]) { $value = substr($value, \strlen($startCchr)); } else { @@ -477,10 +515,15 @@ protected function style(string $style, string $value, array $attr = []): string } } if (isset($attr['href'])) { + if ('label' === $style) { + $value .= '^'; + } $value = "\033]8;;{$attr['href']}\033\\{$value}\033]8;;\033\\"; } - } elseif ($attr['if_links'] ?? false) { - return ''; + } + + if ('label' === $style && '' !== $value) { + $value .= ' '; } return $value; @@ -525,6 +568,9 @@ protected function supportsColors(): bool return static::$defaultColors = $this->hasColorSupport($h); } + /** + * @return void + */ protected function dumpLine(int $depth, bool $endOfValue = false) { if ($this->colors) { @@ -533,6 +579,9 @@ protected function dumpLine(int $depth, bool $endOfValue = false) parent::dumpLine($depth); } + /** + * @return void + */ protected function endValue(Cursor $cursor) { if (-1 === $cursor->hashType) { @@ -609,7 +658,7 @@ private function isWindowsTrueColor(): bool return $result; } - private function getSourceLink(string $file, int $line) + private function getSourceLink(string $file, int $line): string|false { if ($fmt = $this->displayOptions['fileLinkFormat']) { return \is_string($fmt) ? strtr($fmt, ['%f' => $file, '%l' => $line]) : ($fmt->format($file, $line) ?: 'file://'.$file.'#L'.$line); diff --git a/redaxo/src/core/vendor/symfony/var-dumper/Dumper/ContextualizedDumper.php b/redaxo/src/core/vendor/symfony/var-dumper/Dumper/ContextualizedDumper.php index 1ba803d813..84cfb42595 100644 --- a/redaxo/src/core/vendor/symfony/var-dumper/Dumper/ContextualizedDumper.php +++ b/redaxo/src/core/vendor/symfony/var-dumper/Dumper/ContextualizedDumper.php @@ -31,13 +31,16 @@ public function __construct(DataDumperInterface $wrappedDumper, array $contextPr $this->contextProviders = $contextProviders; } + /** + * @return string|null + */ public function dump(Data $data) { - $context = []; + $context = $data->getContext(); foreach ($this->contextProviders as $contextProvider) { $context[$contextProvider::class] = $contextProvider->getContext(); } - $this->wrappedDumper->dump($data->withContext($context)); + return $this->wrappedDumper->dump($data->withContext($context)); } } diff --git a/redaxo/src/core/vendor/symfony/var-dumper/Dumper/DataDumperInterface.php b/redaxo/src/core/vendor/symfony/var-dumper/Dumper/DataDumperInterface.php index b173bccf38..df05b6af57 100644 --- a/redaxo/src/core/vendor/symfony/var-dumper/Dumper/DataDumperInterface.php +++ b/redaxo/src/core/vendor/symfony/var-dumper/Dumper/DataDumperInterface.php @@ -20,5 +20,8 @@ */ interface DataDumperInterface { + /** + * @return string|null + */ public function dump(Data $data); } diff --git a/redaxo/src/core/vendor/symfony/var-dumper/Dumper/HtmlDumper.php b/redaxo/src/core/vendor/symfony/var-dumper/Dumper/HtmlDumper.php index c818c919c4..8a2570b2c4 100644 --- a/redaxo/src/core/vendor/symfony/var-dumper/Dumper/HtmlDumper.php +++ b/redaxo/src/core/vendor/symfony/var-dumper/Dumper/HtmlDumper.php @@ -82,12 +82,18 @@ public function __construct($output = null, string $charset = null, int $flags = $this->styles = static::$themes['dark'] ?? self::$themes['dark']; } + /** + * @return void + */ public function setStyles(array $styles) { $this->headerIsDumped = false; $this->styles = $styles + $this->styles; } + /** + * @return void + */ public function setTheme(string $themeName) { if (!isset(static::$themes[$themeName])) { @@ -101,6 +107,8 @@ public function setTheme(string $themeName) * Configures display options. * * @param array $displayOptions A map of display options to customize the behavior + * + * @return void */ public function setDisplayOptions(array $displayOptions) { @@ -110,6 +118,8 @@ public function setDisplayOptions(array $displayOptions) /** * Sets an HTML header that will be dumped once in the output stream. + * + * @return void */ public function setDumpHeader(?string $header) { @@ -118,6 +128,8 @@ public function setDumpHeader(?string $header) /** * Sets an HTML prefix and suffix that will encapse every single dump. + * + * @return void */ public function setDumpBoundaries(string $prefix, string $suffix) { @@ -136,6 +148,8 @@ public function dump(Data $data, $output = null, array $extraDisplayOptions = [] /** * Dumps the HTML header. + * + * @return string */ protected function getDumpHeader() { @@ -149,19 +163,15 @@ protected function getDumpHeader() '.$this->dumpHeader; } + /** + * @return void + */ public function dumpString(Cursor $cursor, string $str, bool $bin, int $cut) { if ('' === $str && isset($cursor->attr['img-data'], $cursor->attr['content-type'])) { @@ -788,6 +802,9 @@ public function dumpString(Cursor $cursor, string $str, bool $bin, int $cut) } } + /** + * @return void + */ public function enterHash(Cursor $cursor, int $type, string|int|null $class, bool $hasChild) { if (Cursor::HASH_OBJECT === $type) { @@ -816,6 +833,9 @@ public function enterHash(Cursor $cursor, int $type, string|int|null $class, boo } } + /** + * @return void + */ public function leaveHash(Cursor $cursor, int $type, string|int|null $class, bool $hasChild, int $cut) { $this->dumpEllipsis($cursor, $hasChild, $cut); @@ -827,7 +847,7 @@ public function leaveHash(Cursor $cursor, int $type, string|int|null $class, boo protected function style(string $style, string $value, array $attr = []): string { - if ('' === $value) { + if ('' === $value && ('label' !== $style || !isset($attr['file']) && !isset($attr['href']))) { return ''; } @@ -862,7 +882,6 @@ protected function style(string $style, string $value, array $attr = []): string } elseif ('private' === $style) { $style .= sprintf(' title="Private property defined in class: `%s`"', esc($this->utf8Encode($attr['class']))); } - $map = static::$controlCharsMap; if (isset($attr['ellipsis'])) { $class = 'sf-dump-ellipsis'; @@ -881,6 +900,7 @@ protected function style(string $style, string $value, array $attr = []): string } } + $map = static::$controlCharsMap; $v = "".preg_replace_callback(static::$controlCharsRx, function ($c) use ($map) { $s = $b = '%s', esc($this->utf8Encode($attr['href'])), $target, $v); } if (isset($attr['lang'])) { $v = sprintf('%s', esc($attr['lang']), $v); } + if ('label' === $style) { + $v .= ' '; + } return $v; } + /** + * @return void + */ protected function dumpLine(int $depth, bool $endOfValue = false) { if (-1 === $this->lastDepth) { @@ -944,7 +979,7 @@ protected function dumpLine(int $depth, bool $endOfValue = false) AbstractDumper::dumpLine($depth); } - private function getSourceLink(string $file, int $line) + private function getSourceLink(string $file, int $line): string|false { $options = $this->extraDisplayOptions + $this->displayOptions; @@ -956,7 +991,7 @@ private function getSourceLink(string $file, int $line) } } -function esc(string $str) +function esc(string $str): string { return htmlspecialchars($str, \ENT_QUOTES, 'UTF-8'); } diff --git a/redaxo/src/core/vendor/symfony/var-dumper/Dumper/ServerDumper.php b/redaxo/src/core/vendor/symfony/var-dumper/Dumper/ServerDumper.php index f2c891b6a1..98c2149330 100644 --- a/redaxo/src/core/vendor/symfony/var-dumper/Dumper/ServerDumper.php +++ b/redaxo/src/core/vendor/symfony/var-dumper/Dumper/ServerDumper.php @@ -41,10 +41,15 @@ public function getContextProviders(): array return $this->connection->getContextProviders(); } + /** + * @return string|null + */ public function dump(Data $data) { if (!$this->connection->write($data) && $this->wrappedDumper) { - $this->wrappedDumper->dump($data); + return $this->wrappedDumper->dump($data); } + + return null; } } diff --git a/redaxo/src/core/vendor/symfony/var-dumper/Resources/functions/dump.php b/redaxo/src/core/vendor/symfony/var-dumper/Resources/functions/dump.php index 6221a4d182..a0e5addff1 100644 --- a/redaxo/src/core/vendor/symfony/var-dumper/Resources/functions/dump.php +++ b/redaxo/src/core/vendor/symfony/var-dumper/Resources/functions/dump.php @@ -9,40 +9,52 @@ * file that was distributed with this source code. */ +use Symfony\Component\VarDumper\Caster\ScalarStub; use Symfony\Component\VarDumper\VarDumper; if (!function_exists('dump')) { /** * @author Nicolas Grekas + * @author Alexandre Daubois */ - function dump(mixed $var, mixed ...$moreVars): mixed + function dump(mixed ...$vars): mixed { - VarDumper::dump($var); + if (!$vars) { + VarDumper::dump(new ScalarStub('🐛')); - foreach ($moreVars as $v) { - VarDumper::dump($v); + return null; } - if (1 < func_num_args()) { - return func_get_args(); + if (array_key_exists(0, $vars) && 1 === count($vars)) { + VarDumper::dump($vars[0]); + $k = 0; + } else { + foreach ($vars as $k => $v) { + VarDumper::dump($v, is_int($k) ? 1 + $k : $k); + } } - return $var; + if (1 < count($vars)) { + return $vars; + } + + return $vars[$k]; } } if (!function_exists('dd')) { - /** - * @return never - */ - function dd(...$vars): void + function dd(mixed ...$vars): never { if (!in_array(\PHP_SAPI, ['cli', 'phpdbg'], true) && !headers_sent()) { header('HTTP/1.1 500 Internal Server Error'); } - foreach ($vars as $v) { - VarDumper::dump($v); + if (array_key_exists(0, $vars) && 1 === count($vars)) { + VarDumper::dump($vars[0]); + } else { + foreach ($vars as $k => $v) { + VarDumper::dump($v, is_int($k) ? 1 + $k : $k); + } } exit(1); diff --git a/redaxo/src/core/vendor/symfony/var-dumper/Server/Connection.php b/redaxo/src/core/vendor/symfony/var-dumper/Server/Connection.php index c68408678f..3c0f36864f 100644 --- a/redaxo/src/core/vendor/symfony/var-dumper/Server/Connection.php +++ b/redaxo/src/core/vendor/symfony/var-dumper/Server/Connection.php @@ -62,7 +62,7 @@ public function write(Data $data): bool $context = array_filter($context); $encodedPayload = base64_encode(serialize([$data, $context]))."\n"; - set_error_handler([self::class, 'nullErrorHandler']); + set_error_handler(fn () => true); try { if (-1 !== stream_socket_sendto($this->socket, $encodedPayload)) { return true; @@ -82,16 +82,14 @@ public function write(Data $data): bool return false; } - private static function nullErrorHandler(int $t, string $m) - { - // no-op - } - + /** + * @return resource|null + */ private function createSocket() { - set_error_handler([self::class, 'nullErrorHandler']); + set_error_handler(fn () => true); try { - return stream_socket_client($this->host, $errno, $errstr, 3); + return stream_socket_client($this->host, $errno, $errstr, 3) ?: null; } finally { restore_error_handler(); } diff --git a/redaxo/src/core/vendor/symfony/var-dumper/VarDumper.php b/redaxo/src/core/vendor/symfony/var-dumper/VarDumper.php index 840bfd6496..2e1dad116c 100644 --- a/redaxo/src/core/vendor/symfony/var-dumper/VarDumper.php +++ b/redaxo/src/core/vendor/symfony/var-dumper/VarDumper.php @@ -37,13 +37,19 @@ class VarDumper */ private static $handler; - public static function dump(mixed $var) + /** + * @param string|null $label + * + * @return mixed + */ + public static function dump(mixed $var/* , string $label = null */) { + $label = 2 <= \func_num_args() ? func_get_arg(1) : null; if (null === self::$handler) { self::register(); } - return (self::$handler)($var); + return (self::$handler)($var, $label); } public static function setHandler(callable $callable = null): ?callable @@ -90,8 +96,14 @@ private static function register(): void $dumper = new ContextualizedDumper($dumper, [new SourceContextProvider()]); } - self::$handler = function ($var) use ($cloner, $dumper) { - $dumper->dump($cloner->cloneVar($var)); + self::$handler = function ($var, string $label = null) use ($cloner, $dumper) { + $var = $cloner->cloneVar($var); + + if (null !== $label) { + $var = $var->withContext(['label' => $label]); + } + + $dumper->dump($var); }; } diff --git a/redaxo/src/core/vendor/symfony/var-dumper/composer.json b/redaxo/src/core/vendor/symfony/var-dumper/composer.json index 71ec64c0de..e9967f0e52 100644 --- a/redaxo/src/core/vendor/symfony/var-dumper/composer.json +++ b/redaxo/src/core/vendor/symfony/var-dumper/composer.json @@ -27,14 +27,8 @@ "twig/twig": "^2.13|^3.0.4" }, "conflict": { - "phpunit/phpunit": "<5.4.3", "symfony/console": "<5.4" }, - "suggest": { - "ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).", - "ext-intl": "To show region name in time zone dump", - "symfony/console": "To use the ServerDumpCommand and/or the bin/var-dump-server script" - }, "autoload": { "files": [ "Resources/functions/dump.php" ], "psr-4": { "Symfony\\Component\\VarDumper\\": "" }, diff --git a/redaxo/src/core/vendor/symfony/yaml/Command/LintCommand.php b/redaxo/src/core/vendor/symfony/yaml/Command/LintCommand.php index 19a0af08c1..95352ac174 100644 --- a/redaxo/src/core/vendor/symfony/yaml/Command/LintCommand.php +++ b/redaxo/src/core/vendor/symfony/yaml/Command/LintCommand.php @@ -50,11 +50,14 @@ public function __construct(string $name = null, callable $directoryIteratorProv $this->isReadableProvider = null === $isReadableProvider ? null : $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, 'The output format') + ->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(<<format = $input->getOption('format'); $flags = $input->getOption('parse-tags'); - if ('github' === $this->format && !class_exists(GithubActionReporter::class)) { - throw new \InvalidArgumentException('The "github" format is only available since "symfony/console" >= 5.3.'); - } - if (null === $this->format) { // Autodetect format according to CI environment $this->format = class_exists(GithubActionReporter::class) && GithubActionReporter::isGithubActionEnvironment() ? 'github' : 'txt'; @@ -128,7 +127,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int return $this->display($io, $filesInfo); } - private function validate(string $content, int $flags, string $file = null) + 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) { @@ -155,7 +154,7 @@ private function display(SymfonyStyle $io, array $files): int 'txt' => $this->displayTxt($io, $files), 'json' => $this->displayJson($io, $files), 'github' => $this->displayTxt($io, $files, true), - default => throw new InvalidArgumentException(sprintf('The format "%s" is not supported.', $this->format)), + default => throw new InvalidArgumentException(sprintf('Supported formats are "%s".', implode('", "', $this->getAvailableFormatOptions()))), }; } @@ -240,12 +239,10 @@ private function getParser(): 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 - ); - }; + $default = fn ($directory) => new \RecursiveIteratorIterator( + new \RecursiveDirectoryIterator($directory, \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS), + \RecursiveIteratorIterator::LEAVES_ONLY + ); if (null !== $this->directoryIteratorProvider) { return ($this->directoryIteratorProvider)($directory, $default); @@ -256,9 +253,7 @@ private function getDirectoryIterator(string $directory): iterable private function isReadable(string $fileOrDirectory): bool { - $default = function ($fileOrDirectory) { - return is_readable($fileOrDirectory); - }; + $default = is_readable(...); if (null !== $this->isReadableProvider) { return ($this->isReadableProvider)($fileOrDirectory, $default); @@ -270,7 +265,12 @@ private function isReadable(string $fileOrDirectory): bool public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void { if ($input->mustSuggestOptionValuesFor('format')) { - $suggestions->suggestValues(['txt', 'json', 'github']); + $suggestions->suggestValues($this->getAvailableFormatOptions()); } } + + private function getAvailableFormatOptions(): array + { + return ['txt', 'json', 'github']; + } } diff --git a/redaxo/src/core/vendor/symfony/yaml/Dumper.php b/redaxo/src/core/vendor/symfony/yaml/Dumper.php index 9249d21d75..04646c5cdd 100644 --- a/redaxo/src/core/vendor/symfony/yaml/Dumper.php +++ b/redaxo/src/core/vendor/symfony/yaml/Dumper.php @@ -66,6 +66,10 @@ public function dump(mixed $input, int $inline = 0, int $indent = 0, int $flags $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) && str_contains($value, "\n") && !str_contains($value, "\r")) { $blockIndentationIndicator = $this->getBlockIndentationIndicator($value); diff --git a/redaxo/src/core/vendor/symfony/yaml/Exception/ParseException.php b/redaxo/src/core/vendor/symfony/yaml/Exception/ParseException.php index 07c59b9668..c1a77ad157 100644 --- a/redaxo/src/core/vendor/symfony/yaml/Exception/ParseException.php +++ b/redaxo/src/core/vendor/symfony/yaml/Exception/ParseException.php @@ -51,6 +51,8 @@ public function getSnippet(): string /** * Sets the snippet of code near the error. + * + * @return void */ public function setSnippet(string $snippet) { @@ -71,6 +73,8 @@ public function getParsedFile(): string /** * Sets the filename where the error occurred. + * + * @return void */ public function setParsedFile(string $parsedFile) { @@ -89,6 +93,8 @@ public function getParsedLine(): int /** * Sets the line where the error occurred. + * + * @return void */ public function setParsedLine(int $parsedLine) { @@ -97,7 +103,7 @@ public function setParsedLine(int $parsedLine) $this->updateRepr(); } - private function updateRepr() + private function updateRepr(): void { $this->message = $this->rawMessage; diff --git a/redaxo/src/core/vendor/symfony/yaml/Inline.php b/redaxo/src/core/vendor/symfony/yaml/Inline.php index 127e50e84a..c2a93bab6c 100644 --- a/redaxo/src/core/vendor/symfony/yaml/Inline.php +++ b/redaxo/src/core/vendor/symfony/yaml/Inline.php @@ -34,7 +34,7 @@ class Inline private static bool $objectForMap = false; private static bool $constantSupport = false; - public static function initialize(int $flags, int $parsedLineNumber = null, string $parsedFilename = null) + 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); @@ -110,7 +110,11 @@ public static function dump(mixed $value, int $flags = 0): string return self::dumpNull($flags); case $value instanceof \DateTimeInterface: - return $value->format('c'); + return $value->format(match (true) { + !$length = \strlen(rtrim($value->format('u'), '0')) => 'c', + $length < 4 => 'Y-m-d\TH:i:s.vP', + default => 'Y-m-d\TH:i:s.uP', + }); case $value instanceof \UnitEnum: return sprintf('!php/const %s::%s', $value::class, $value->name); case \is_object($value): @@ -239,6 +243,10 @@ private static function dumpHashArray(array|\ArrayObject|\stdClass $value, int $ { $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)); } @@ -708,6 +716,10 @@ private static function evaluateScalar(string $scalar, int $flags, array &$refer return $time; } + if ('' !== rtrim($time->format('u'), '0')) { + return (float) $time->format('U.u'); + } + try { if (false !== $scalar = $time->getTimestamp()) { return $scalar; diff --git a/redaxo/src/core/vendor/symfony/yaml/Parser.php b/redaxo/src/core/vendor/symfony/yaml/Parser.php index 32eb429f5a..ddfbcfd83a 100644 --- a/redaxo/src/core/vendor/symfony/yaml/Parser.php +++ b/redaxo/src/core/vendor/symfony/yaml/Parser.php @@ -99,7 +99,7 @@ public function parse(string $value, int $flags = 0): mixed return $data; } - private function doParse(string $value, int $flags) + private function doParse(string $value, int $flags): mixed { $this->currentLineNb = -1; $this->currentLine = ''; @@ -503,7 +503,7 @@ private function doParse(string $value, int $flags) return empty($data) ? null : $data; } - private function parseBlock(int $offset, string $yaml, int $flags) + private function parseBlock(int $offset, string $yaml, int $flags): mixed { $skippedLineNumbers = $this->skippedLineNumbers; @@ -844,8 +844,8 @@ private function parseBlockScalar(string $style, string $chomping = '', int $ind while ( $notEOF && ( - $isCurrentLineBlank || - self::preg_match($pattern, $this->currentLine, $matches) + $isCurrentLineBlank + || self::preg_match($pattern, $this->currentLine, $matches) ) ) { if ($isCurrentLineBlank && \strlen($this->currentLine) > $indentation) { diff --git a/redaxo/src/core/vendor/symfony/yaml/Tag/TaggedValue.php b/redaxo/src/core/vendor/symfony/yaml/Tag/TaggedValue.php index c7946c27ec..3e09b93ee0 100644 --- a/redaxo/src/core/vendor/symfony/yaml/Tag/TaggedValue.php +++ b/redaxo/src/core/vendor/symfony/yaml/Tag/TaggedValue.php @@ -31,7 +31,7 @@ public function getTag(): string return $this->tag; } - public function getValue() + public function getValue(): mixed { return $this->value; } diff --git a/redaxo/src/core/vendor/symfony/yaml/Unescaper.php b/redaxo/src/core/vendor/symfony/yaml/Unescaper.php index 2238210d93..9e640ff248 100644 --- a/redaxo/src/core/vendor/symfony/yaml/Unescaper.php +++ b/redaxo/src/core/vendor/symfony/yaml/Unescaper.php @@ -45,9 +45,7 @@ public function unescapeSingleQuotedString(string $value): string */ public function unescapeDoubleQuotedString(string $value): string { - $callback = function ($match) { - return $this->unescapeCharacter($match[0]); - }; + $callback = fn ($match) => $this->unescapeCharacter($match[0]); // evaluate the string return preg_replace_callback('/'.self::REGEX_ESCAPED_CHARACTER.'/u', $callback, $value); diff --git a/redaxo/src/core/vendor/symfony/yaml/Yaml.php b/redaxo/src/core/vendor/symfony/yaml/Yaml.php index 49784216e9..e2d2af7310 100644 --- a/redaxo/src/core/vendor/symfony/yaml/Yaml.php +++ b/redaxo/src/core/vendor/symfony/yaml/Yaml.php @@ -34,6 +34,7 @@ class Yaml 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. diff --git a/redaxo/src/core/vendor/symfony/yaml/composer.json b/redaxo/src/core/vendor/symfony/yaml/composer.json index 839314bf51..019776cef9 100644 --- a/redaxo/src/core/vendor/symfony/yaml/composer.json +++ b/redaxo/src/core/vendor/symfony/yaml/composer.json @@ -25,9 +25,6 @@ "conflict": { "symfony/console": "<5.4" }, - "suggest": { - "symfony/console": "For validating YAML files using the lint command" - }, "autoload": { "psr-4": { "Symfony\\Component\\Yaml\\": "" }, "exclude-from-classmap": [ From 70b3ede909f4ee34a4dea0a59043b11d9f279cf7 Mon Sep 17 00:00:00 2001 From: Tobias Krais Date: Sat, 1 Jul 2023 12:17:58 +0200 Subject: [PATCH 3/3] =?UTF-8?q?L=C3=B6schen=20von=20Medien:=20Verwendungsc?= =?UTF-8?q?heck=20bzgl=20Artikel/Kategorien=20korrigiert=20(#5735)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../metainfo/lib/handler/media_handler.php | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/redaxo/src/addons/metainfo/lib/handler/media_handler.php b/redaxo/src/addons/metainfo/lib/handler/media_handler.php index 60006f7900..5408880f20 100644 --- a/redaxo/src/addons/metainfo/lib/handler/media_handler.php +++ b/redaxo/src/addons/metainfo/lib/handler/media_handler.php @@ -42,6 +42,8 @@ public static function isMediaInUse(rex_extension_point $ep) $key = 'media'; } elseif (rex_metainfo_clang_handler::PREFIX === $prefix) { $key = 'clangs'; + } elseif (rex_metainfo_category_handler::PREFIX === $prefix) { + $key = 'categories'; } else { $key = 'articles'; } @@ -54,22 +56,28 @@ public static function isMediaInUse(rex_extension_point $ep) } $articles = ''; - $categories = ''; if (!empty($where['articles'])) { $items = $sql->getArray('SELECT id, clang_id, parent_id, name, catname, startarticle FROM ' . rex::getTablePrefix() . 'article WHERE ' . implode(' OR ', $where['articles'])); foreach ($items as $artArr) { $aid = (int) $artArr['id']; $clang = (int) $artArr['clang_id']; $parentId = (int) $artArr['parent_id']; - if ($artArr['startarticle']) { - $categories .= '
  • ' . (string) $artArr['catname'] . '
  • '; - } else { - $articles .= '
  • ' . (string) $artArr['name'] . '
  • '; - } + $articles .= '
  • ' . (string) $artArr['name'] . '
  • '; } if ('' != $articles) { $warning[] = rex_i18n::msg('minfo_media_in_use_art') . '
      ' . $articles . '
    '; } + } + + $categories = ''; + if (!empty($where['categories'])) { + $items = $sql->getArray('SELECT id, clang_id, parent_id, name, catname, startarticle FROM ' . rex::getTablePrefix() . 'article WHERE ' . implode(' OR ', $where['categories'])); + foreach ($items as $artArr) { + $aid = (int) $artArr['id']; + $clang = (int) $artArr['clang_id']; + $parentId = (int) $artArr['parent_id']; + $categories .= '
  • ' . (string) $artArr['catname'] . '
  • '; + } if ('' != $categories) { $warning[] = rex_i18n::msg('minfo_media_in_use_cat') . '
      ' . $categories . '
    '; }