Skip to content

[VarDumper] enhance dumping refs #12202

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

Merged
merged 1 commit into from
Oct 17, 2014
Merged

Conversation

nicolas-grekas
Copy link
Member

Q A
Bug fix? yes
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets nicolas-grekas/Patchwork-Dumper#39
License MIT
Doc PR -

This makes dumps prettier:

  • VarCloner now exposes the "isref" state of a PHP variable
  • on hard refs, #n suffix is replaced by &n prefix
  • #n/@n (object/resource refs) are moved inside the { }
  • all repetitive dumps of the same object are toggle-able
  • all repetitive dumps of the same object / hard ref are visually identical
  • dumps expose local ref counts and object's handle

I also simplified the Cloner\DumperInterface.

For the same (circumvoluted) variable:

Before:
before

After:
after

@nicolas-grekas nicolas-grekas force-pushed the better-refs branch 7 times, most recently from c048c52 to 8738242 Compare October 16, 2014 09:58
@nicolas-grekas
Copy link
Member Author

Fabbot has only false positives and tests fail because master fails.
This PR is ready for review/merge, thanks!

@fabpot
Copy link
Member

fabpot commented Oct 17, 2014

Thank you @nicolas-grekas.

@fabpot fabpot merged commit 3c401af into symfony:master Oct 17, 2014
fabpot added a commit that referenced this pull request Oct 17, 2014
This PR was merged into the 2.6-dev branch.

Discussion
----------

[VarDumper] enhance dumping refs

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | nicolas-grekas/Patchwork-Dumper#39
| License       | MIT
| Doc PR        | -

This makes dumps prettier:
- VarCloner now exposes the "isref" state of a PHP variable
- on hard refs, `#n` suffix is replaced by `&n` prefix
- `#n`/`@n` (object/resource refs) are moved inside the `{ }`
- all repetitive dumps of the same object are toggle-able
- all repetitive dumps of the same object / hard ref are *visually* identical
- dumps expose local ref counts and object's handle

I also simplified the `Cloner\DumperInterface`.

For the same (circumvoluted) variable:

Before:
![before](https://cloud.githubusercontent.com/assets/243674/4595026/f6b2a98c-5094-11e4-9fe0-dc6d24da3f14.png)

After:
![after](https://cloud.githubusercontent.com/assets/243674/4595035/07e04980-5095-11e4-9e45-54a1e7453547.png)

Commits
-------

3c401af [VarDumper] enhance dumping refs
@nicolas-grekas nicolas-grekas deleted the better-refs branch October 22, 2014 09:19
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.

2 participants