From cb7809f87387ca5035405a35ec8cd825e67d107a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Andr=C3=A9?= Date: Sun, 3 Nov 2024 15:05:45 +0100 Subject: [PATCH] Add str_contains in nested method --- src/TwigComponent/src/ComponentAttributes.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/TwigComponent/src/ComponentAttributes.php b/src/TwigComponent/src/ComponentAttributes.php index 194acaba94..39213d945f 100644 --- a/src/TwigComponent/src/ComponentAttributes.php +++ b/src/TwigComponent/src/ComponentAttributes.php @@ -222,7 +222,10 @@ public function nested(string $namespace): self $attributes = []; foreach ($this->attributes as $key => $value) { - if (preg_match(self::NESTED_REGEX, $key, $matches) && $namespace === $matches[1]) { + if ( + str_contains($key, ':') + && preg_match(self::NESTED_REGEX, $key, $matches) && $namespace === $matches[1] + ) { $attributes[$matches[2]] = $value; } }