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
+17-21Lines changed: 17 additions & 21 deletions
Original file line number
Diff line number
Diff line change
@@ -87,7 +87,6 @@ private function synchronizeComponents(Kit $kit): void
87
87
$component = newComponent(
88
88
name: $componentName,
89
89
files: [newFile(
90
-
type: FileType::Twig,
91
90
relativePathNameToKit: $relativePathNameToKit,
92
91
relativePathName: $relativePathName,
93
92
)],
@@ -124,30 +123,28 @@ private function resolveComponentDependencies(Kit $kit, Component $component): v
124
123
125
124
$fileContent = file_get_contents($filePath);
126
125
127
-
if (FileType::Twig === $file->type) {
128
-
if (str_contains($fileContent, '<twig:') && preg_match_all(self::RE_TWIG_COMPONENT_REFERENCES, $fileContent, $matches)) {
129
-
foreach ($matches[1] as$componentReferenceName) {
130
-
if ($componentReferenceName === $component->name) {
131
-
continue;
132
-
}
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
+
}
133
131
134
-
if (null !== $package = self::UX_COMPONENTS_PACKAGES[strtolower($componentReferenceName)] ?? null) {
135
-
if (!$component->hasDependency(newPhpPackageDependency($package))) {
136
-
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) {
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));
$this->expectExceptionMessage(\sprintf('The relative path name "%s" must be a subpath of the relative path to the kit "%s".', 'foo/bar/Button.html.twig', 'templates/components/Button.html.twig'));
0 commit comments