-
-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature #48432 [VarDumper] Add support of named arguments to
dd()
a…
…nd `dump()` to display a label (alexandre-daubois) This PR was merged into the 6.3 branch. Discussion ---------- [VarDumper] Add support of named arguments to `dd()` and `dump()` to display a label | Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | _N/A_ | License | MIT | Doc PR | _Todo_ Following an idea from `@nicolas`-grekas, the goal here is to ease debugging with `dd()` and `dump()` by supporting named arguments passed to them. This will display a label, helping understand the goal/meaning of a dump. **Example in web browser:** ![image](https://user-images.githubusercontent.com/2144837/205279233-7c250d07-4616-4ed8-907e-b1b3cac9a3f2.png) **Example in CLI:** ![image](https://user-images.githubusercontent.com/2144837/205122796-79427c98-48fe-4f11-b2c5-58b51a2fbbf6.png) The above example is clickable and points to `file:///home/alexandredaubois/PhpstormProjects/dummy_project/src/Command/TestCommand.php#L15`. No more `dd("First one", $var1, "Second var", $var2);`! Commits ------- 2519c5c830 [VarDumper] Add support of named arguments to `dd()` and `dump()` to display the argument name
- Loading branch information
Showing
11 changed files
with
144 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\VarDumper\Caster; | ||
|
||
use Symfony\Component\VarDumper\Cloner\Stub; | ||
|
||
/** | ||
* Represents any arbitrary value. | ||
* | ||
* @author Alexandre Daubois <alex.daubois@gmail.com> | ||
*/ | ||
class ScalarStub extends Stub | ||
{ | ||
public function __construct(mixed $value) | ||
{ | ||
$this->value = $value; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters