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

Added support for __debugInfo() magic method. #282

Closed
wants to merge 1 commit into from

Conversation

@sallyx
Copy link
Contributor

sallyx commented Feb 21, 2018

  • bug fix? no
  • new feature? yes
  • BC break? yes

After this change result from \Tracy\Dumper::dump() will reflect the return value from __debugInfo() magic method (if defined).

As this might change output, I consider it as a BC break.

@sallyx sallyx force-pushed the sallyx:add-support-for-debuginfo-method branch from 903349d to 50eb08b Feb 21, 2018
@JanTvrdik

This comment has been minimized.

Copy link
Contributor

JanTvrdik commented Feb 21, 2018

I'm strongly against using __debugInfo() by default because it hides the actual object state.

@JanTvrdik

This comment has been minimized.

Copy link
Contributor

JanTvrdik commented Feb 21, 2018

Also see #135, you can use

Tracy\Dumper::$objectExporters[NULL] = function ($obj) {
    return method_exists($obj, '__debugInfo') ? $obj->__debugInfo() : (array) $obj;
};
@sallyx sallyx force-pushed the sallyx:add-support-for-debuginfo-method branch from 50eb08b to 23c54f5 Feb 21, 2018
@sallyx

This comment has been minimized.

Copy link
Contributor Author

sallyx commented Feb 21, 2018

Yes, but that's exactly what is __debugInfo() for :-)

I missed that PR. Anyway, thanks for the code example ;-)

@sallyx sallyx force-pushed the sallyx:add-support-for-debuginfo-method branch from 23c54f5 to a0ece90 Feb 21, 2018
@milo

This comment has been minimized.

Copy link
Member

milo commented Feb 21, 2018

@sallyx I trust to my code, so I would accept __debugInfo() on my classes. But when I work with 3rd party code, I really want to see the real content of the object and not the trimmed one.

@sallyx

This comment has been minimized.

Copy link
Contributor Author

sallyx commented Feb 21, 2018

Ok, I could add option [ Dumper::DEBUGINFO => FALSE ] like it was in #135 ...

@dg dg force-pushed the nette:master branch 4 times, most recently from d13a9ce to 7f24887 Feb 25, 2018
@dg dg force-pushed the nette:master branch 8 times, most recently from 427177a to 7ac33a2 Mar 22, 2018
@dg dg closed this in 1e0f246 Apr 2, 2018
dg added a commit that referenced this pull request Apr 2, 2018
…GINFO option [Closes #135][Closes #282]
dg added a commit that referenced this pull request Apr 3, 2018
dg added a commit that referenced this pull request Apr 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.