Skip to content

Commit 60d39f0

Browse files
[4.x] Remove redundant $streamName property and default to php://stderr in View classes
1 parent f328205 commit 60d39f0

4 files changed

Lines changed: 1 addition & 9 deletions

File tree

src/View/LineView.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66

77
class LineView extends View
88
{
9-
protected string $streamName = 'php://stdout';
10-
119
public function newLine(int $count = 1): void
1210
{
1311
for ($i = 0; $i < $count; $i++) {

src/View/ProgressBarView.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ class ProgressBarView extends View
1616

1717
protected int $total = 100;
1818

19-
protected string $streamName = 'php://stderr';
20-
2119
public function create(int $total): static
2220
{
2321
$this->total = max(1, $total);

src/View/TableView.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414

1515
class TableView extends View
1616
{
17-
protected string $streamName = 'php://stdout';
18-
1917
public function show(array $data): void
2018
{
2119
$headers = $this->headers($data);

src/View/View.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ abstract class View
1212
/** @var resource|null */
1313
protected static mixed $stream = null;
1414

15-
protected string $streamName;
16-
1715
protected function writeLine(string $line): void
1816
{
1917
fwrite($this->stream(), $line . PHP_EOL);
@@ -29,6 +27,6 @@ protected function write(string $line): void
2927
*/
3028
protected function stream()
3129
{
32-
return static::$stream ??= fopen($this->streamName, 'wb');
30+
return static::$stream ??= fopen('php://stderr', 'wb');
3331
}
3432
}

0 commit comments

Comments
 (0)