Skip to content
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

[9.x] Add source file to Collection's dd method output #44793

Merged
merged 5 commits into from
Nov 1, 2022

Conversation

AhrimFakhriy
Copy link
Contributor

@AhrimFakhriy AhrimFakhriy commented Oct 31, 2022

This pull request further extends #44211 by @nunomaduro to work on Collection by adding the source file/line to the dd output of the Collection class method.

After using the improved dd, I found it odd that Collection class dd method did not give the same output as the current improved dd function. The workaround was to wrap the collection variable with dd instead of using the built in dd method of Collection class.

@AhrimFakhriy AhrimFakhriy changed the title add source file to Collection's dd function output add source file to Collection's dd method output Oct 31, 2022
@nunomaduro nunomaduro marked this pull request as draft October 31, 2022 13:48
@AhrimFakhriy AhrimFakhriy marked this pull request as ready for review October 31, 2022 13:49
@nunomaduro
Copy link
Member

@AhrimFakhriy you think you can create a static property of the trait, that key value map with (name => traceKey), so we can extend this work to other files?

@AhrimFakhriy AhrimFakhriy marked this pull request as draft October 31, 2022 13:53
@AhrimFakhriy AhrimFakhriy changed the title add source file to Collection's dd method output [9.x] Add source file to Collection's dd method output Oct 31, 2022
@AhrimFakhriy AhrimFakhriy marked this pull request as ready for review October 31, 2022 13:58
@AhrimFakhriy
Copy link
Contributor Author

@nunomaduro will this suffice?

@nunomaduro nunomaduro marked this pull request as draft October 31, 2022 14:27
@AhrimFakhriy AhrimFakhriy marked this pull request as ready for review October 31, 2022 15:21
@nunomaduro nunomaduro marked this pull request as draft October 31, 2022 15:25
*/
protected static $traceNames = [
'symfony/var-dumper/Resources/functions/dump.php' => 1,
'Illuminate/Collections/Traits/EnumeratesValues.php' => 4,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes work on Windows due the different separator?

@AhrimFakhriy AhrimFakhriy marked this pull request as ready for review October 31, 2022 15:46
@nunomaduro
Copy link
Member

@AhrimFakhriy Can you check my question please? I will move this pull request out of draft, once I think is ready.

@nunomaduro nunomaduro marked this pull request as draft October 31, 2022 16:00
@AhrimFakhriy
Copy link
Contributor Author

@nunomaduro Im sorry, I didnt know I'm not supposed to click on the "Ready for review" button myself.
As for your question, I added in a str_replace which replace the slash to DIRECTORY_SEPARATOR in the loops which should make it work for Windows, and I've tried on both Linux & Windows.

@AhrimFakhriy AhrimFakhriy marked this pull request as ready for review November 1, 2022 13:54
@taylorotwell taylorotwell merged commit 5b517e8 into laravel:9.x Nov 1, 2022
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