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
This PR was merged into the 2.x branch.
Discussion
----------
[Toolkit] Remove `FileType`
| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? | no <!-- please update src/**/CHANGELOG.md files -->
| Docs? | no <!-- required for new features -->
| Issues | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License | MIT
<!--
Replace this notice by a description of your feature/bugfix.
This will help reviewers and should be a good start for the documentation.
Additionally (see https://symfony.com/releases):
- Always add tests and ensure they pass.
- For new features, provide some code snippets to help understand usage.
- Features and deprecations must be submitted against branch main.
- Update/add documentation as required (we can help!)
- Changelog entry should follow https://symfony.com/doc/current/contributing/code/conventions.html#writing-a-changelog-entry
- Never break backward compatibility (see https://symfony.com/bc).
-->
Looks like it wasn't super useful
Commits
-------
c7ccf97 [Toolkit] Remove `FileType`
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