Skip to content

Commit

Permalink
Revert "[11.x] No need to redeclare variables (#53887)" (#53954)
Browse files Browse the repository at this point in the history
This reverts commit 69284e3.
  • Loading branch information
crynobone authored Dec 17, 2024
1 parent 17c0416 commit 3946000
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions src/Illuminate/Foundation/Console/ServeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,7 @@ protected function flushOutputBuffer()
->map(fn ($line) => trim($line))
->filter()
->each(function ($line) {
$stringable = new Stringable($line);

if ($stringable->contains('Development Server (http')) {
if ((new Stringable($line))->contains('Development Server (http')) {
if ($this->serverRunningHasBeenDisplayed === false) {
$this->serverRunningHasBeenDisplayed = true;

Expand All @@ -295,19 +293,23 @@ protected function flushOutputBuffer()
return;
}

$requestPort = static::getRequestPortFromLine($line);
if ((new Stringable($line))->contains(' Accepted')) {
$requestPort = static::getRequestPortFromLine($line);

if ($stringable->contains(' Accepted')) {
$this->requestsPool[$requestPort] = [
$this->getDateFromLine($line),
$this->requestsPool[$requestPort][1] ?? false,
microtime(true),
];
} elseif ($stringable->contains([' [200]: GET '])) {
} elseif ((new Stringable($line))->contains([' [200]: GET '])) {
$requestPort = static::getRequestPortFromLine($line);

$this->requestsPool[$requestPort][1] = trim(explode('[200]: GET', $line)[1]);
} elseif ($stringable->contains('URI:')) {
} elseif ((new Stringable($line))->contains('URI:')) {
$requestPort = static::getRequestPortFromLine($line);

$this->requestsPool[$requestPort][1] = trim(explode('URI: ', $line)[1]);
} elseif ($stringable->contains(' Closing')) {
} elseif ((new Stringable($line))->contains(' Closing')) {
$requestPort = static::getRequestPortFromLine($line);

if (empty($this->requestsPool[$requestPort])) {
Expand Down Expand Up @@ -338,11 +340,11 @@ protected function flushOutputBuffer()

$this->output->write(' '.str_repeat('<fg=gray>.</>', $dots));
$this->output->writeln(" <fg=gray>~ {$runTime}</>");
} elseif ($stringable->contains(['Closed without sending a request', 'Failed to poll event'])) {
} elseif ((new Stringable($line))->contains(['Closed without sending a request', 'Failed to poll event'])) {
// ...
} elseif (! empty($line)) {
if ($stringable->startsWith('[')) {
$line = $stringable->after('] ');
if ((new Stringable($line))->startsWith('[')) {
$line = (new Stringable($line))->after('] ');
}

$this->output->writeln(" <fg=gray>$line</>");
Expand Down

0 comments on commit 3946000

Please sign in to comment.