Skip to content
/ config Public

Commit 5254855

Browse files
ranpafinnicolas-grekas
authored andcommitted
[Form] Add resource tracking for type extension classes in FormPass
When a form type extension uses getExtendedTypes() without the extended_type tag, FormPass calls the static method at build time but does not track the class as a container resource. This means the cache is not invalidated when the method is edited. Call $container->getReflectionClass() before accessing getExtendedTypes() so that the class is automatically registered as a ReflectionClassResource, the same pattern used by RegisterListenersPass in the EventDispatcher component.
1 parent d445bad commit 5254855

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Resource/ReflectionClassResource.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\Config\Resource;
1313

1414
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
15+
use Symfony\Component\Form\FormTypeExtensionInterface;
1516
use Symfony\Component\Messenger\Handler\MessageSubscriberInterface;
1617
use Symfony\Contracts\Service\ServiceSubscriberInterface;
1718

@@ -212,5 +213,12 @@ private function generateSignature(\ReflectionClass $class): iterable
212213
yield ServiceSubscriberInterface::class;
213214
yield print_r($class->name::getSubscribedServices(), true);
214215
}
216+
217+
if (interface_exists(FormTypeExtensionInterface::class, false) && $class->isSubclassOf(FormTypeExtensionInterface::class)) {
218+
yield FormTypeExtensionInterface::class;
219+
foreach ($class->name::getExtendedTypes() as $key => $value) {
220+
yield $key.print_r($value, true);
221+
}
222+
}
215223
}
216224
}

0 commit comments

Comments
 (0)