cli-menu
cli-menu copied to clipboard
PHPStorm - How to debug
Traditionally, this project is debugged using the var_dump() function. If we use xdebug we get an error.
Error reason: The program cannot get terminal parameters from the PHPStorm environment.
I propose a little hack:
diff --git a/src/UnixTerminal.php b/src/UnixTerminal.php
index 879b1a7..2fdc248 100644
--- a/src/UnixTerminal.php
+++ b/src/UnixTerminal.php
@@ -71,12 +71,14 @@ class UnixTerminal implements Terminal
public function getWidth() : int
{
- return $this->width ?: $this->width = (int) exec('tput cols');
+ //return $this->width ?: $this->width = (int) exec('tput cols');
+ return 33; // your terminal width
}
public function getHeight() : int
{
- return $this->height ?: $this->height = (int) exec('tput lines');
+ //return $this->height ?: $this->height = (int) exec('tput lines');
+ return 17; // your terminal height
}
public function getColourSupport() : int
@@ -166,7 +168,8 @@ class UnixTerminal implements Terminal
*/
public function isInteractive() : bool
{
- return $this->input->isInteractive() && $this->output->isInteractive();
+ //return $this->input->isInteractive() && $this->output->isInteractive();
+ return true;
}
/**
Now you can work with the xdebug debugger, set breakpoints, and so on!