-
-
Notifications
You must be signed in to change notification settings - Fork 11
Adds the source file and line number to dd()
output
#134
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@anabeto93 hey! is it possible to add dd() to browser output? |
@proilyxa you raise a great point and unfortunately no. The html dumper is actually supposed to enhance this, but the problem does not originate from hypervel but actually from the hyperf framework that this is based on. Once you call a Works without using
|
* | ||
* @var array<string, string> | ||
*/ | ||
protected $editorHrefs = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add type declarations for class properties if possible
* | ||
* @return null|void|array{0: string, 1: string, 2: int|null} | ||
*/ | ||
public function resolveDumpSource() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add declarations for return type
*/ | ||
protected static $adjustableTraces = [ | ||
'symfony/var-dumper/Resources/functions/dump.php' => 1, | ||
'Illuminate/Collections/Traits/EnumeratesValues.php' => 4, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be adjusted to Hypervel namespace
* | ||
* @var null|(callable(): (array{0: string, 1: string, 2: int|null}|null))|false | ||
*/ | ||
protected static $dumpSourceResolver; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add type declaration and default value
* @param string $basePath | ||
* @param string $compiledViewPath | ||
*/ | ||
public function __construct($output, $basePath, $compiledViewPath) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use constructor property promotion here
'cli' == $format => CliDumper::register($basePath, $compiledViewPath), | ||
'server' == $format => null, | ||
$format && 'tcp' == parse_url($format, PHP_URL_SCHEME) => null, | ||
default => in_array(PHP_SAPI, ['cli', 'phpdbg']) ? CliDumper::register($basePath, $compiledViewPath) : HtmlDumper::register($basePath, $compiledViewPath), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PHP_SAPI
in Hypervel should always be cli
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm back. In that case, we wouldn't need the HtmlDumper
Hi @anabeto93 , thanks for your contribution! I left some comments mainly about coding styles and rules to make them fit with Hypervel framework. Could you please adjust them if possible? |
On a hypervel app, the details below from running
php artisan about
php artisan about Environment ...................................... Application Name ................... Campaigns_API Hypervel Version ........................... 0.2.6 PHP Version ................................ 8.4.8 Swoole Version ............................. 6.0.2 Composer Version ........................... 2.8.9 Environment ................................ local Debug Mode ............................... ENABLED URL .................................... localhost Timezone ..................................... UTC
compared to a laravel app with the following details running the same
php artisan about
php artisan about Environment ...................................... Application Name ......................... MTN_API Laravel Version .......................... 12.19.3 PHP Version ................................ 8.4.8 Composer Version ........................... 2.8.9 Environment ................................ local Debug Mode ............................... ENABLED URL ...................................... mtn-api Maintenance Mode ............................. OFF Timezone ..................................... UTC Locale ........................................ en
When you do a
dd()
you get two different outputs one being much more detailed.A simple dd() of an array in Laravel
A simple dd() of an array in Hypervel
Given the impressive work @nunomaduro did on Laravel, this PR brings that additional experience from laravel where the
dd()
functiion method output includes the source file and the line number where it originates.You can learn more about this here https://laravel-news.com/history-dd
Run of the Tests