bug #37130 [Console] allow cursor to be used even when STDIN is not defined (xabbuh)
This PR was merged into the 5.1 branch.
Discussion
----------
[Console] allow cursor to be used even when STDIN is not defined
| Q | A
| ------------- | ---
| Branch? | 5.1
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix #37124
| License | MIT
| Doc PR |
This allows to use the `Cursor` class introduced in Symfony 5.1 even when the `STDIN` constant is not defined. We did a similar bugfix in the past in the `QuestionHelper` class in #10798.
Commits
-------
aff1ffaeff
allow cursor to be used even when STDIN is not defined
This commit is contained in:
commit
72ca171dbb
@ -21,10 +21,10 @@ final class Cursor
|
|||||||
private $output;
|
private $output;
|
||||||
private $input;
|
private $input;
|
||||||
|
|
||||||
public function __construct(OutputInterface $output, $input = STDIN)
|
public function __construct(OutputInterface $output, $input = null)
|
||||||
{
|
{
|
||||||
$this->output = $output;
|
$this->output = $output;
|
||||||
$this->input = $input;
|
$this->input = $input ?? (\defined('STDIN') ? STDIN : fopen('php://input', 'r+'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function moveUp(int $lines = 1): self
|
public function moveUp(int $lines = 1): self
|
||||||
|
Reference in New Issue
Block a user