Skip to content

Commit 3946000

Browse files
authored
Revert "[11.x] No need to redeclare variables (#53887)" (#53954)
This reverts commit 69284e3.
1 parent 17c0416 commit 3946000

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

src/Illuminate/Foundation/Console/ServeCommand.php

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -280,9 +280,7 @@ protected function flushOutputBuffer()
280280
->map(fn ($line) => trim($line))
281281
->filter()
282282
->each(function ($line) {
283-
$stringable = new Stringable($line);
284-
285-
if ($stringable->contains('Development Server (http')) {
283+
if ((new Stringable($line))->contains('Development Server (http')) {
286284
if ($this->serverRunningHasBeenDisplayed === false) {
287285
$this->serverRunningHasBeenDisplayed = true;
288286

@@ -295,19 +293,23 @@ protected function flushOutputBuffer()
295293
return;
296294
}
297295

298-
$requestPort = static::getRequestPortFromLine($line);
296+
if ((new Stringable($line))->contains(' Accepted')) {
297+
$requestPort = static::getRequestPortFromLine($line);
299298

300-
if ($stringable->contains(' Accepted')) {
301299
$this->requestsPool[$requestPort] = [
302300
$this->getDateFromLine($line),
303301
$this->requestsPool[$requestPort][1] ?? false,
304302
microtime(true),
305303
];
306-
} elseif ($stringable->contains([' [200]: GET '])) {
304+
} elseif ((new Stringable($line))->contains([' [200]: GET '])) {
305+
$requestPort = static::getRequestPortFromLine($line);
306+
307307
$this->requestsPool[$requestPort][1] = trim(explode('[200]: GET', $line)[1]);
308-
} elseif ($stringable->contains('URI:')) {
308+
} elseif ((new Stringable($line))->contains('URI:')) {
309+
$requestPort = static::getRequestPortFromLine($line);
310+
309311
$this->requestsPool[$requestPort][1] = trim(explode('URI: ', $line)[1]);
310-
} elseif ($stringable->contains(' Closing')) {
312+
} elseif ((new Stringable($line))->contains(' Closing')) {
311313
$requestPort = static::getRequestPortFromLine($line);
312314

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

339341
$this->output->write(' '.str_repeat('<fg=gray>.</>', $dots));
340342
$this->output->writeln(" <fg=gray>~ {$runTime}</>");
341-
} elseif ($stringable->contains(['Closed without sending a request', 'Failed to poll event'])) {
343+
} elseif ((new Stringable($line))->contains(['Closed without sending a request', 'Failed to poll event'])) {
342344
// ...
343345
} elseif (! empty($line)) {
344-
if ($stringable->startsWith('[')) {
345-
$line = $stringable->after('] ');
346+
if ((new Stringable($line))->startsWith('[')) {
347+
$line = (new Stringable($line))->after('] ');
346348
}
347349

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

0 commit comments

Comments
 (0)