Skip to content

Commit bb903c2

Browse files
committed
bug #1911 [TwigComponent][Fix] Revert throwing exception when public property is unitialized (smnandre)
This PR was merged into the 2.x branch. Discussion ---------- [TwigComponent][Fix] Revert throwing exception when public property is unitialized | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | Issues | Fix #1909 | License | MIT Revert #1780 If someone want to give another go at the original problem i'd appreciate. Commits ------- bf5959f [Fix] Revert throwing exception when public property is unitialized
2 parents 7a84975 + bf5959f commit bb903c2

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/TwigComponent/src/ComponentRenderer.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,7 @@ private function preRender(MountedComponent $mounted, array $context = []): PreR
142142
private function exposedVariables(object $component, bool $exposePublicProps): \Iterator
143143
{
144144
if ($exposePublicProps) {
145-
$publicProps = get_object_vars($component);
146-
if ($uninitializedProps = array_diff_key(get_class_vars($component::class), $publicProps)) {
147-
throw new \LogicException(sprintf('Cannot expose uninitialized property "$%s" from "%s".', array_keys($uninitializedProps)[0], $component::class));
148-
}
149-
yield from $publicProps;
145+
yield from get_object_vars($component);
150146
}
151147

152148
$class = new \ReflectionClass($component);

0 commit comments

Comments
 (0)