from comment #19 of #1567428: Active trail tests, in order to handle static variables in Drupal 8 we should convert every use of statics to instead by properties of proper objects. The result of this effort will be that we properly register objects into the Dependency Injection Container and perhaps do away with drupal_static() and drupal_static_reset().

Comments

Issue tags:+MN code sprint

This isn't a task unto itself per se, I think, but rather a side-effect of other work. Eg, the menu system needs to be turned into a proper set of objects (after routing it ripped out), and the statics eliminated as part of that. Simply creating objects somewhere that hold statics instead of them being inside functions buys us nothing.

Title:Convert all statics to Object Properties[meta] Remove all drupal_static()s + drupal_static() itself
Issue summary:View changes
Issue tags:-MN code sprint+@deprecated, +DIE

HEAD has 93 calls to drupal_static()

Most of them in legacy procedural code that is actively being converted into service classes right now. In essence, those calls should "magically vanish" ;-)

However, for some strange reason, some drupal_static()s were taken over as-is into object-oriented code that is clean otherwise. For example, Drupal\Core\Cache\DatabaseBackend still maintains the state of cache tags via drupal_static().

In any case, these drupal_static()s (1) prevent us from properly using and leveraging the kernel and (2) harm tests.