Skip to content

DependencyChecker tries to load a class that should not be loaded #124

@enumag

Description

@enumag

It's probably best to show this on the real case:

  • Kdyby\Events\EventsManager::setPanel() needs argument of Kdyby\Events\Diagnostics\Panel
  • Kdyby\Events\Diagnostics\Panel implements Tracy\IBarPanel
  • kdyby/events has tracy/tracy as an optional dependency
  • => Tracy\IBarPanel may not exist
  • but that does not matter because Kdyby\Events\Diagnostics\Panel is never loaded at all

The problem is that DependencyChecker is still trying to load the Kdyby\Events\Diagnostics\Panel class:

  • DependencyChecker::calculateHash() iterates over all public methods of Kdyby\Events\EventsManager which of course includes the setPanel method
  • calculateHash calls DependencyChecker::hashParameters() which iterates over all parameters of the setPanel() method (which is only the panel parameters).
  • hashParameters calls PhpReflection::getParameterType($param)
  • getParameterType calls) $param->getClass()
  • that will try to autoload the Kdyby\Events\Diagnostics\Panel class
  • which of course fail with Fatal error: Interface 'Tracy\IBarPanel' not found
  • (no ReflectionException to catch, just fatal error)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions