I recently ran :call phpactor#Update()
in my VIM.
I'm trying to use Extract Method and I get this error:
Phpactor returned an error: PHP Fatal error: Uncaught Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to
load class "ReflectorBuilder" from namespace "Phpactor\WorseReflection".
Did you forget a "use" statement for another namespace? in /home/james/.vim/bundle/phpactor/lib/Container/WorseReflectionExten
sion.php:25
Stack trace:
#0 /home/james/.vim/bundle/phpactor/vendor/phpbench/container/lib/Container.php(118): Phpactor\Container\WorseReflectionExtens
ion->Phpactor\Container\{closure}(Object(Phpactor\Container\ApplicationContainer))
#1 /home/james/.vim/bundle/phpactor/lib/Container/CodeTransformExtension.php(141): PhpBench\DependencyInjection\Container->get
('reflection.refl...')
#2 /home/james/.vim/bundle/phpactor/vendor/phpbench/container/lib/Container.php(118): Phpactor\Container\CodeTransformExtensio
n->Phpactor\Container\{closure}(Object(Phpactor\Container\ApplicationContainer))
#3 /home/james/.vim/bundle/phpactor/lib/Container/CodeTransformExtension.php(129): PhpBench\DependencyInjection\Container->get
('code_transform....')
#4 /ho in /home/james/.vim/bundle/phpactor/lib/Container/WorseReflectionExtension.php on line 25
I also get this error when trying to use omnicompletion, UseAdd(), ClassExpand(), etc.
Here is /home/james/.vim/bundle/phpactor/lib/Container/WorseReflectionExtension.php
which clearly shows the use statement exists:
<?php
namespace Phpactor\Container;
use PhpBench\DependencyInjection\Container;
use Phpactor\WorseReflection\Reflector;
use Phpactor\WorseReflection\Bridge\PsrLog\PsrLogger;
use Phpactor\WorseReflection\Core\SourceCodeLocator\StubSourceLocator;
use PhpBench\DependencyInjection\ExtensionInterface;
use Phpactor\WorseReflection\Bridge\Phpactor\ClassToFileSourceLocator;
use Phpactor\WorseReflection\ReflectorBuilder;
class WorseReflectionExtension implements ExtensionInterface
{
public function getDefaultConfig()
{
return [
'reflection.stub_directory' => __DIR__ . '/../../vendor/jetbrains/phpstorm-stubs',
];
}
public function load(Container $container)
{
$container->register('reflection.reflector', function (Container $container) {
$builder = ReflectorBuilder::create()
->enableCache()
->enableContextualSourceLocation();
foreach (array_keys($container->getServiceIdsForTag('reflection.source_locator')) as $locatorId) {
$builder->addLocator($container->get($locatorId));
}
$builder->withLogger(new PsrLogger($container->get('monolog.logger')));
return $builder->build();
});
$container->register('reflection.locator.stub', function (Container $container) {
return new StubSourceLocator(
ReflectorBuilder::create()->build(),
$container->getParameter('reflection.stub_directory'),
$container->getParameter('cache_dir')
);
}, [ 'reflection.source_locator' => []]);
$container->register('reflection.locator.worse', function (Container $container) {
return new ClassToFileSourceLocator($container->get('class_to_file.class_to_file'));
}, [ 'reflection.source_locator' => []]);
}
}