Child pages
  • Allow static code analysis for 3rd party libraries [5.2.2-B1]
Skip to end of metadata
Go to start of metadata

Recently I've stumbled upon https://github.com/goaop/parser-reflection a library, that allows to perform static code analysis. The core difference from other similar solutions is that instead of autoloading classes (memory heavy operation) it uses autoloader to find the file and then tokenizes file manually.

Since In-Portal uses both Composer and it's own auto-loader it isn't possible currently to make use of that library.

Solution

  1. create public "kFactory::findClassFile($class)" method, that will return absolute path to file, where given class/interface/trait is located
  2. create public "kApplication::findClassFile($class)" method, that will call above created method on "$this->Factory" object
  3. create "/tools/class_locator.php" file, that would return closure, that:
    • would accept "$class" argument
    • return result of "kApplication::findClassFile" method, when not "false"
    • return result of "Composer\Autoload\ClassLoader::findFile" method otherwise

Related Discussions

Related Tasks

INP-1570 - Getting issue details... STATUS