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 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 add-support-for-debuginfo-method branch from 903349d to 50eb08b Compare Feb 21, 2018
@JanTvrdik
Copy link
Contributor

@JanTvrdik JanTvrdik commented Feb 21, 2018

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

@JanTvrdik
Copy link
Contributor

@JanTvrdik 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 add-support-for-debuginfo-method branch from 50eb08b to 23c54f5 Compare Feb 21, 2018
@sallyx
Copy link
Contributor Author

@sallyx 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 add-support-for-debuginfo-method branch from 23c54f5 to a0ece90 Compare Feb 21, 2018
@milo
Copy link
Member

@milo 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
Copy link
Contributor Author

@sallyx sallyx commented Feb 21, 2018

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

@dg dg force-pushed the master branch 4 times, most recently from d13a9ce to 7f24887 Compare Feb 25, 2018
@dg dg force-pushed the master branch 8 times, most recently from 427177a to 7ac33a2 Compare Mar 26, 2018
dg pushed a commit that referenced this issue Apr 2, 2018
dg pushed a commit that referenced this issue Apr 3, 2018
dg pushed a commit that referenced this issue Apr 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants