Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.6k
[VarDumper] Add functional test forServerDumpCommand
#53737
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:7.4
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -12,6 +12,7 @@ | ||
namespace Symfony\Component\VarDumper\Server; | ||
use Psr\Log\LoggerInterface; | ||
use Symfony\Component\Console\Input\StreamableInputInterface; | ||
use Symfony\Component\VarDumper\Cloner\Data; | ||
use Symfony\Component\VarDumper\Cloner\Stub; | ||
@@ -49,33 +50,20 @@ public function start(): void | ||
} | ||
} | ||
public function listen(callable $callback, ?StreamableInputInterface $streamInput = null): void | ||
{ | ||
$inputStream = null; | ||
if ($streamInput instanceof StreamableInputInterface && $stream = $streamInput->getStream()) { | ||
$inputStream = $stream; | ||
} elseif (null === $this->socket) { | ||
$this->start(); | ||
} | ||
foreach ($this->getMessages($inputStream) as $clientId => $message) { | ||
$this->logger?->info('Received a payload from client {clientId}', ['clientId' => $clientId]); | ||
$callback($clientId, $message); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. that's a BC break as this changes the contract of the callback. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. I did this followingyour comment in the PR#53518. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. I'm sorry we should try to keep the existing signature callback. | ||
} | ||
} | ||
@@ -84,8 +72,20 @@ public function getHost(): string | ||
return $this->host; | ||
} | ||
/** | ||
* @param ?resource | ||
*/ | ||
private function getMessages($inputStream): iterable | ||
{ | ||
if (null !== $inputStream) { | ||
while (!feof($inputStream)) { | ||
$stream = fgets($inputStream); | ||
yield (int) $stream => $stream; | ||
} | ||
return; | ||
} | ||
$sockets = [(int) $this->socket => $this->socket]; | ||
$write = []; | ||