You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/Toolkit/src/Kit/KitSynchronizer.php
+25-28Lines changed: 25 additions & 28 deletions
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,6 @@
22
22
useSymfony\UX\Toolkit\File\ComponentMeta;
23
23
useSymfony\UX\Toolkit\File\Doc;
24
24
useSymfony\UX\Toolkit\File\File;
25
-
useSymfony\UX\Toolkit\File\FileType;
26
25
27
26
/**
28
27
* @internal
@@ -86,10 +85,10 @@ private function synchronizeComponents(Kit $kit): void
86
85
87
86
$component = newComponent(
88
87
name: $componentName,
89
-
files: [newFile(
88
+
file: newFile(
90
89
relativePathNameToKit: $relativePathNameToKit,
91
90
relativePathName: $relativePathName,
92
-
)],
91
+
),
93
92
meta: $meta,
94
93
);
95
94
@@ -116,36 +115,34 @@ private function resolveComponentDependencies(Kit $kit, Component $component): v
116
115
}
117
116
118
117
// Find dependencies based on file content
119
-
foreach ($component->filesas$file) {
120
-
if (!$this->filesystem->exists($filePath = Path::join($kit->path, $file->relativePathNameToKit))) {
121
-
thrownew \RuntimeException(\sprintf('File "%s" not found', $filePath));
122
-
}
118
+
if (!$this->filesystem->exists($filePath = Path::join($kit->path, $component->file->relativePathNameToKit))) {
119
+
thrownew \RuntimeException(\sprintf('File "%s" not found', $filePath));
120
+
}
123
121
124
-
$fileContent = file_get_contents($filePath);
122
+
$fileContent = file_get_contents($filePath);
125
123
126
-
if (str_contains($fileContent, '<twig:') && preg_match_all(self::RE_TWIG_COMPONENT_REFERENCES, $fileContent, $matches)) {
127
-
foreach ($matches[1] as$componentReferenceName) {
128
-
if ($componentReferenceName === $component->name) {
129
-
continue;
130
-
}
124
+
if (str_contains($fileContent, '<twig:') && preg_match_all(self::RE_TWIG_COMPONENT_REFERENCES, $fileContent, $matches)) {
125
+
foreach ($matches[1] as$componentReferenceName) {
126
+
if ($componentReferenceName === $component->name) {
127
+
continue;
128
+
}
131
129
132
-
if (null !== $package = self::UX_COMPONENTS_PACKAGES[strtolower($componentReferenceName)] ?? null) {
133
-
if (!$component->hasDependency(newPhpPackageDependency($package))) {
134
-
thrownew \RuntimeException(\sprintf('Component "%s" uses "%s" UX Twig component, but the composer package "%s" is not listed as a dependency in meta file.', $component->name, $componentReferenceName, $package));
thrownew \RuntimeException(\sprintf('Component "%s" not found in component "%s" (file "%s")', $componentReferenceName, $component->name, $file->relativePathNameToKit));
if (null !== $package = self::UX_COMPONENTS_PACKAGES[strtolower($componentReferenceName)] ?? null) {
131
+
if (!$component->hasDependency(newPhpPackageDependency($package))) {
132
+
thrownew \RuntimeException(\sprintf('Component "%s" uses "%s" UX Twig component, but the composer package "%s" is not listed as a dependency in meta file.', $component->name, $componentReferenceName, $package));
thrownew \RuntimeException(\sprintf('Component "%s" not found in component "%s" (file "%s")', $componentReferenceName, $component->name, $component->file->relativePathNameToKit));
0 commit comments