Class not found in drush command definition In the drush command definition hook for the Node Revision Delete project I have the following code:

use Drupal\node_revision_delete\Utility\Time;

...

function node_revision_delete_drush_command() {
  $values = array_keys(Time::convertWordToTime());


The namespace exists and is in the correct place but once I use drush cr I got this error:

Error: Uncaught Error: Class 'Drupal\node_revision_delete\Utility\Time' not found in /Users/adriancid/Sites/drupal84-test/modules/drupal.org/node_revision_delete/node_revision_delete.drush.inc:34


It's weird because I call the same function in the line 179 for the drush nrd-st command and is working fine:

Time::convertWordToTime();


Trying to understand what happens I tried to use an Utility function from the Core in the drush definition command hook and works fine without problem, but with my function call it doesn't works.

Any idea about class not found problem?
As @Berdir says it seems Drupal is not fully bootstrapped when the hook_drush_command() is called as I tried to use a service defined in a custom module and I get the following error:

\Drupal::$container is not initialized yet. 


So the solution for the moment is hardcode the values that should be returned by the function.