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

Old-style Closure dump format? #218

Closed
bobthecow opened this issue Jul 16, 2015 · 7 comments
Closed

Old-style Closure dump format? #218

bobthecow opened this issue Jul 16, 2015 · 7 comments

Comments

@bobthecow
Copy link
Owner

The new Closure formatting feels less intuitive and easily grokkable than before. Should we re-implement the function-signature-style formatting in terms of VarDumper? I took a look, but didn't get very far. @nicolas-grekas how tough would this be?

@bobthecow
Copy link
Owner Author

/cc @GrahamCampbell

@nicolas-grekas
Copy link
Contributor

you could do this by adding a virtual prop, let's name it "signature", when you generate the signature of the closure in PHP style?

@bobthecow
Copy link
Owner Author

It would be awesome to show less when dumping a Closure, not more :)

Compare:

screen shot 2015-08-23 at 10 27 58 am

screen shot 2015-08-23 at 10 27 55 am

My preference would be to show the old style for most output, and the new style (maybe with the signature as well?) for dump --all and possibly regular dump.

@nicolas-grekas
Copy link
Contributor

nicolas-grekas commented Aug 28, 2015 via email

@nicolas-grekas
Copy link
Contributor

What about this:

=> Closure {#177
    signature: "function ($a) use ($b)",
    use: [
      "$b" => 5,
    ],
    file: "/home/nicolas.grekas/Code/psysh/src/Psy/ExecutionLoop/Loop.php(76) : eval()'d code",
    line: "1 to 2",
}

And in short mode (the default one), we hide everything but the signature?

=> Closure {#177
    signature: "function ($a) use ($b)"
}

I'd like to keep the Closure {#177 info, it's important to still tell the user that an anonymous functions is an object of type Closure imo.

@bobthecow
Copy link
Owner Author

@nicolas-grekas I'm all about removing redundant or obvious information where possible. We probably don't need to tell users that an anonymous function is an object of type Closure because all anonymous functions are objects of type Closure ;)

Is there a straightforward way to render it just like before (or maybe with #177 in between the parens)? If not, that's cool, but I feel like that's the most information dense way to represent anonymous functions and it'd be awesome if we could do it again.

@nicolas-grekas
Copy link
Contributor

Fixed by symfony/symfony#27768

symfony-splitter pushed a commit to symfony/var-dumper that referenced this issue Jun 30, 2018
…s-grekas)

This PR was merged into the 4.2-dev branch.

Discussion
----------

[VarDumper] display the signature of callables

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | bobthecow/psysh#218
| License       | MIT
| Doc PR        | -

E.g.

![capture d ecran de 2018-06-29 12-08-13](https://user-images.githubusercontent.com/243674/42087047-4fdc70d6-7b95-11e8-972c-216651bf7d69.png)

or

![image](https://user-images.githubusercontent.com/243674/42086967-070bc960-7b95-11e8-9470-7e88f8acf12a.png)

Commits
-------

73b4ac78c0 [VarDumper] display the signature of callables
fabpot added a commit to symfony/symfony that referenced this issue Jun 30, 2018
…s-grekas)

This PR was merged into the 4.2-dev branch.

Discussion
----------

[VarDumper] display the signature of callables

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | bobthecow/psysh#218
| License       | MIT
| Doc PR        | -

E.g.

![capture d ecran de 2018-06-29 12-08-13](https://user-images.githubusercontent.com/243674/42087047-4fdc70d6-7b95-11e8-972c-216651bf7d69.png)

or

![image](https://user-images.githubusercontent.com/243674/42086967-070bc960-7b95-11e8-9470-7e88f8acf12a.png)

Commits
-------

73b4ac7 [VarDumper] display the signature of callables
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants