Skip to content

Commit 7f4e71e

Browse files
author
matheo
committed
rename static to anonymous
1 parent 78a576d commit 7f4e71e

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/TwigComponent/src/StaticComponent.php renamed to src/TwigComponent/src/AnonymousComponent.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Symfony\UX\TwigComponent;
44

5-
class StaticComponent
5+
class AnonymousComponent
66
{
77
private array $props = [];
88

src/TwigComponent/src/ComponentFactory.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function metadataFor(string $name): ComponentMetadata
4545
$name = $this->classMap[$name] ?? $name;
4646

4747
if (!$config = $this->config[$name] ?? null) {
48-
if (($template = $this->findStaticComponentTemplate($name)) !== null) {
48+
if (($template = $this->findAnonymousComponentTemplate($name)) !== null) {
4949
return new ComponentMetadata([
5050
'key' => $name,
5151
'template' => $template,
@@ -133,7 +133,7 @@ private function mount(object $component, array &$data): void
133133
return;
134134
}
135135

136-
if ($component instanceof StaticComponent) {
136+
if ($component instanceof AnonymousComponent) {
137137
$component->mount($data);
138138

139139
return;
@@ -164,8 +164,8 @@ private function getComponent(string $name): object
164164
$name = $this->classMap[$name] ?? $name;
165165

166166
if (!$this->components->has($name)) {
167-
if ($this->isStaticComponent($name)) {
168-
return new StaticComponent();
167+
if ($this->isAnonymousComponent($name)) {
168+
return new AnonymousComponent();
169169
}
170170

171171
throw new \InvalidArgumentException(sprintf('Unknown component "%s". The registered components are: %s. And no anonymous component founded', $name, implode(', ', array_keys($this->components->getProvidedServices()))));
@@ -208,12 +208,12 @@ private function postMount(object $component, array $data): array
208208
return $data;
209209
}
210210

211-
private function isStaticComponent(string $name): bool
211+
private function isAnonymousComponent(string $name): bool
212212
{
213-
return null !== $this->findStaticComponentTemplate($name);
213+
return null !== $this->findAnonymousComponentTemplate($name);
214214
}
215215

216-
public function findStaticComponentTemplate(string $name): ?string
216+
public function findAnonymousComponentTemplate(string $name): ?string
217217
{
218218
$loader = $this->environment->getLoader();
219219
$componentPath = rtrim(str_replace(':', '/', $name));

src/TwigComponent/src/ComponentRenderer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ private function preRender(MountedComponent $mounted, array $context = []): PreR
105105

106106
// expose public properties and properties marked with ExposeInTemplate attribute
107107
iterator_to_array($this->exposedVariables($component, $metadata->isPublicPropsExposed())),
108-
$component instanceof StaticComponent ? $component->getProps() : []
108+
$component instanceof AnonymousComponent ? $component->getProps() : []
109109
);
110110
$event = new PreRenderEvent($mounted, $metadata, $variables);
111111

0 commit comments

Comments
 (0)