From 041b31c98fc82cb94033171ccf5b29473aa42da7 Mon Sep 17 00:00:00 2001 From: Ghost Of Drupal Past <drupal@negyesi.net> Date: Fri, 14 Feb 2025 23:02:46 +0100 Subject: [PATCH] Support @> as a shorthand for !service_closure in YamlFileLoader --- core/lib/Drupal/Core/DependencyInjection/YamlFileLoader.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/lib/Drupal/Core/DependencyInjection/YamlFileLoader.php b/core/lib/Drupal/Core/DependencyInjection/YamlFileLoader.php index 77ac5cfdcec7..ae3670a79214 100644 --- a/core/lib/Drupal/Core/DependencyInjection/YamlFileLoader.php +++ b/core/lib/Drupal/Core/DependencyInjection/YamlFileLoader.php @@ -528,6 +528,11 @@ private function resolveServices(mixed $value): mixed //return new Expression(substr($value, 2)); throw new InvalidArgumentException(sprintf("'%s' is an Expression, but expressions are not supported.", $value)); } elseif (is_string($value) && str_starts_with($value, '@')) { + if (str_starts_with($value, '@>')) { + $argument = $this->resolveServices(substr_replace($value, '', 1, 1), $file, $isParameter); + + return new ServiceClosureArgument($argument); + } if (str_starts_with($value, '@@')) { $value = substr($value, 1); $invalidBehavior = null; -- GitLab