diff --git a/examples/DebugMenu.php b/examples/DebugMenu.php index 8685ea2..651b0dc 100644 --- a/examples/DebugMenu.php +++ b/examples/DebugMenu.php @@ -40,8 +40,8 @@ }], '9' => ['label' => 'Exception (tp($throwable))', 'run' => function () { try { - throw new \RuntimeException('Something went wrong while processing the request'); - } catch (\Throwable $e) { + throw new RuntimeException('Something went wrong while processing the request'); + } catch (Throwable $e) { tp($e); } }], @@ -76,7 +76,7 @@ try { $scenarios[$choice]['run'](); echo "Sent.\n"; - } catch (\Throwable $e) { + } catch (Throwable $e) { echo 'Error: '.$e->getMessage()."\n"; echo "Is `php bin/tapper` running?\n"; } diff --git a/src/Console/main.php b/src/Console/main.php index f1e27b6..be650a8 100644 --- a/src/Console/main.php +++ b/src/Console/main.php @@ -2,6 +2,7 @@ declare(strict_types=1); +use DI\ContainerBuilder; use PhpTui\Term\Terminal; use PhpTui\Tui\Bridge\PhpTerm\PhpTermBackend; use PhpTui\Tui\Display\Display; @@ -10,7 +11,7 @@ use React\EventLoop\LoopInterface; use Tapper\Console\Application; -$builder = new \DI\ContainerBuilder; +$builder = new ContainerBuilder; $builder->useAutowiring(true); $builder->useAttributes(true); $builder->addDefinitions([ diff --git a/src/Runtime/Tapper.php b/src/Runtime/Tapper.php index d829d60..2b14332 100644 --- a/src/Runtime/Tapper.php +++ b/src/Runtime/Tapper.php @@ -4,6 +4,7 @@ namespace Tapper\Runtime; +use Composer\Autoload\ClassLoader; use Tapper\Rpc\JsonRpcClient; use Tapper\Rpc\JsonRpcRequest; @@ -104,7 +105,7 @@ private function collectDebugInfo(): void private function findProjectRoot(): ?string { - $composerClassLoader = \Composer\Autoload\ClassLoader::class; + $composerClassLoader = ClassLoader::class; if (! class_exists($composerClassLoader)) { return null; diff --git a/src/Server.php b/src/Server.php index f945734..ca0a371 100644 --- a/src/Server.php +++ b/src/Server.php @@ -7,6 +7,7 @@ use Clue\React\NDJson\Decoder; use Clue\React\NDJson\Encoder; use PhpTui\Term\KeyCode; +use React\Socket\ConnectionInterface; use React\Socket\SocketServer; use Tapper\Console\EventBus; use Tapper\Console\State\AppState; @@ -32,7 +33,7 @@ public function run(): void @unlink($socketPath); $server = new SocketServer('unix://'.$socketPath); - $server->on('connection', function (\React\Socket\ConnectionInterface $conn) { + $server->on('connection', function (ConnectionInterface $conn) { $decoder = new Decoder($conn, true); $encoder = new Encoder($conn, true);