/
Introduce base-class based sub-class discovery [5.3.0-B1]

Introduce base-class based sub-class discovery [5.3.0-B1]

I've made quite a few improvements to the Phabricator tool recently and it uses quite different approach to autoloading:

  • you never register a class specifically or place it under namespace
  • the tokenizer discovers all PHP files in project and records this:
    • what classes/interfaces/traits are created in each file
    • what class/interface/trait extends other class/interface/trait
  • extensively using sub-classing
  • has method to return all class instances that sub-class given class (directly or indirectly)

I believe latter can be a huge win for In-Portal before:

  • you only register class once in unit config and class itself then knows how to integrate with system
  • no need to create several configuration options for thing, e.g. (all things below aren't yet committed):

To make this happen we need to, at class registration time (when unit config cache is rebuilt), also create records that will:

  • record all implemented interfaces (for classes only)
  • record all parent class/interfaces (for classes and interfaces)
  • create method "Factory::getSubClasses($class_name)"

Related Discussions

Related Tasks

INP-1429 - Getting issue details... STATUS