Skip to content

[11.x] No need to redeclare variables#53887

Merged
taylorotwell merged 1 commit into
laravel:11.xfrom
lucasmichot:11x-serve-command
Dec 13, 2024
Merged

[11.x] No need to redeclare variables#53887
taylorotwell merged 1 commit into
laravel:11.xfrom
lucasmichot:11x-serve-command

Conversation

@lucasmichot

Copy link
Copy Markdown
Contributor

This PR refactors the ServeCommand class by eliminating redundant redeclarations of variables, such as repeated instantiations of Stringable. Instead, a single $stringable variable is reused throughout the method. This change simplifies the code, improves readability, and slightly optimizes performance by avoiding repeated object creation.

@taylorotwell taylorotwell merged commit 69284e3 into laravel:11.x Dec 13, 2024
@lucasmichot lucasmichot deleted the 11x-serve-command branch December 13, 2024 15:41
crynobone added a commit that referenced this pull request Dec 17, 2024
taylorotwell pushed a commit that referenced this pull request Dec 17, 2024
@kerwin-wildsea

Copy link
Copy Markdown

I wanted to create a Pull Request which would add a test to cover the error occurred in the Serve command. In this case, when a line unrelated to the port was in the outputBuffer. But looking at the existing tests in: ServeCommandLogParserTest.php only the function static::getRequestPortFromLine($line) is covered. Not the behaviour around it.

I don't really see how to easily add a test for this behaviour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants