-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Closed
Closed
Copy link
Description
Symfony version(s) affected
7.3.3
Description
When validating a form on a DoctrineMongoDB ODM Document with many Collection fields, the TypeContextFactory::createFromClassName() method is called several times to parse:
It uses PHPStan Property extractor to parse the docblocks. UnitOfWork and ClassMetadata docblocks are huge. This slows the form validation.
How to reproduce
Call:
for($i=0; $i < 20; $i++) {
$this->typeContextFactory->createFromClassName("Doctrine\ODM\MongoDB\PersistentCollection","Doctrine\ODM\MongoDB\PersistentCollection\PersistentCollectionTrait");
}Possible Solution
Please add a cache to TypeContextFactory::createFromClassName() to limit resource usage due to running PHPStan property extractor on already parsed classes.
Additional Context
PHPStan Property extractor also has a resource issue when parsing type declarations with < (arrays, generics, collections). It always tries to determine if its an HTML tag, regardless of the type declaration context.