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

PHPStan\dumpType could support dumping more than one thing #6419

Open
Seldaek opened this issue Jan 19, 2022 · 3 comments
Open

PHPStan\dumpType could support dumping more than one thing #6419

Seldaek opened this issue Jan 19, 2022 · 3 comments

Comments

@Seldaek
Copy link
Contributor

Seldaek commented Jan 19, 2022

Feature request

I keep trying to use it like var_dump and reflexively passing multiple args to it only to get Function PHPStan\dumpType invoked with 2 parameters, 1 required. in the output.

I hope it's not a huge thing to loop over ...$value instead of just accepting $value, but if it is then feel free to ignore me :)

@staabm
Copy link
Contributor

staabm commented Jan 21, 2022

We discussed this in the past in #5537 (comment)

If ondrey still has this opinion it seems like a accepted idea

@Seldaek
Copy link
Contributor Author

Seldaek commented Jan 21, 2022

Heh ok, I can see the value in your proposal too.. could be combined though, if a single arg return it, if multiple args return void? It's a debug function so having a slightly weird API isn't too bad IMO.

@gharlan
Copy link

gharlan commented Aug 30, 2023

could be combined though

symfony's dump function uses this approach:

  • single arg: return it
  • multiple args: return array with all args

But returning void for multiple args also makes sense to me. Or maybe always returning first element.


symfony/var-dumper supports labels for dumped content:
dump(labelForFirstVar: $foo, labelForSecondVar: $bar);
symfony/symfony#48432

That might be useful here too.

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

4 participants