Use container builder to track and reuse reflection classes in compiler passes

Created on 2 March 2025, about 2 months ago

Problem/Motivation

From πŸ“Œ Investigate possibilities to parse attributes without reflection Active comment #16:

For hooks, a performance improvement would be to pass down the container as far as getHookAttributesInClass and use $container->getReflectionClass() to save on reflecting the classes twice -- ContainerBuilder keeps the reflections in a property.

Btw the same is true for TwigExtensionPass it's just even simpler I will include it because it shows what I am talking about:

     $class_name = $container->getDefinition($service_id)->getClass();
      $reflection = new \ReflectionClass($class_name);
  

change to

      $class_name = $container->getDefinition($service_id)->getClass();
      $reflection = $container->getReflectionClass($class_name);
  

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

πŸ“Œ Task
Status

Active

Version

11.0 πŸ”₯

Component

base system

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024