Skip to content

Commit

Permalink
Add str_contains in nested method
Browse files Browse the repository at this point in the history
  • Loading branch information
smnandre committed Nov 3, 2024
1 parent 9f7c9c8 commit cb7809f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/TwigComponent/src/ComponentAttributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down

0 comments on commit cb7809f

Please # to comment.