Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 39 additions & 40 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions lib/Container/CodeTransformExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
use Phpactor\CodeTransform\Adapter\WorseReflection\Refactor\WorseOverrideMethod;
use Phpactor\CodeBuilder\Adapter\WorseReflection\WorseBuilderFactory;
use Phpactor\CodeTransform\Adapter\WorseReflection\Refactor\WorseExtractMethod;
use Phpactor\CodeTransform\Domain\Refactor\ImportClass;
use Phpactor\CodeTransform\Adapter\TolerantParser\Refactor\TolerantImportClass;

class CodeTransformExtension implements ExtensionInterface
{
Expand Down Expand Up @@ -257,6 +259,12 @@ private function registerRefactorings(Container $container)
$container->get('code_transform.updater')
);
});

$container->register('code_transform.refactor.class_import', function (Container $container) {
return new TolerantImportClass(
$container->get('code_transform.updater')
);
});
}

private function registerUpdater(Container $container)
Expand Down
12 changes: 11 additions & 1 deletion lib/Container/RpcExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
use Phpactor\Rpc\Handler\OverrideMethodHandler;
use Phpactor\Rpc\Handler\CacheClearHandler;
use Phpactor\Rpc\Handler\ConfigHandler;
use Phpactor\Rpc\Handler\ImportClassHandler;

class RpcExtension implements ExtensionInterface
{
Expand Down Expand Up @@ -188,6 +189,14 @@ private function registerHandlers(Container $container)
);
}, [ 'rpc.handler' => [] ]);

$container->register('rpc.handler.refactor.import_class', function (Container $container) {
return new ImportClassHandler(
$container->get('code_transform.refactor.class_import'),
$container->get('application.class_search'),
$container->getParameter('rpc.class_search.filesystem')
);
}, [ 'rpc.handler' => [] ]);

$container->register('rpc.handler.cache_clear', function (Container $container) {
return new CacheClearHandler(
$container->get('application.cache_clear')
Expand All @@ -200,6 +209,7 @@ private function registerHandlers(Container $container)
$container->configLoader()
);
}, [ 'rpc.handler' => [] ]);

$container->register('rpc.handler.config', function (Container $container) {
return new ConfigHandler($container->getParameters());
}, [ 'rpc.handler' => [] ]);
Expand All @@ -212,7 +222,7 @@ public function getDefaultConfig()
{
return [
'rpc.class_search.filesystem' => SourceCodeFilesystemExtension::FILESYSTEM_COMPOSER,
'rpc.class_move.filesystem' => SourceCodeFilesystemExtension::FILESYSTEM_GIT
'rpc.class_move.filesystem' => SourceCodeFilesystemExtension::FILESYSTEM_GIT,
];
}
}
4 changes: 2 additions & 2 deletions lib/Core/GotoDefinition/GotoDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ public function gotoClass(SymbolContext $symbolContext): GotoDefinitionResult
$path = $class->sourceCode()->path();

if (null === $path) {
throw new GotoDefinitionResult(sprintf(
throw new GotoDefinitionException(sprintf(
'The source code for class "%s" has no path associated with it.',
(string) $containingClass->name()
$class->name()
));
}

Expand Down
Loading