-
-
Notifications
You must be signed in to change notification settings - Fork 810
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
[3.3.] Nut debug tweaks #6543
[3.3.] Nut debug tweaks #6543
Conversation
src/Nut/DebugEvents.php
Outdated
@@ -21,6 +23,7 @@ protected function configure() | |||
$this | |||
->setName('debug:events') | |||
->setDescription('System events, and target callable debug dumper.') | |||
->addOption('sort-listener', null, InputOption::VALUE_NONE, 'Sort events in order of listener name.') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be better to have a sort
option that can be given values like name
, default
, etc.?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have a look at the three … it only makes sense to give so many sort options, and this way is easy too, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess so. In that case sort-name
makes more sense. Same for service providers command.
src/Nut/DebugRoutes.php
Outdated
'Path matching parameter', | ||
'Method(s)', | ||
[new TableCell('System routes', ['colspan' => 3])], | ||
['Bind Name', 'Path Match Pattern', 'Method(s)'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bind Name
- Maybe just Name
? You call bind()
to set the route name, and "bind" isn't used anywhere else.
Path Match Pattern
- Maybe just Path
? Symfony's referred to the path as pattern, but it is deprecated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Going for "Route Name" and "Path" then
src/Nut/DebugServiceRegistration.php
Outdated
$table->setHeaders([ | ||
'#', | ||
'Provider', | ||
[new TableCell('System service provider registration boot order', ['colspan' => 2])], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about just Service Providers
? You have a lot of extra words in there that don't mean anything :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WFM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh wait, I guess it should be singular, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why, it is the title block for the service providers table.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, you're right nvm.
src/Nut/DebugEvents.php
Outdated
'Listener', | ||
)); | ||
$table->setHeaders([ | ||
[new TableCell('System events, and target callable', ['colspan' => 3])], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
System events
vs other kinds of events?
src/Nut/DebugServiceRegistration.php
Outdated
@@ -22,6 +25,7 @@ protected function configure() | |||
$this | |||
->setName('debug:services') | |||
->setDescription('System service provider registration boot order debug dumper.') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we change the name to debug:providers
or debug:service-providers
? Individual services are not listed here. Also update the class name to match.
Description: Dumps service providers and their order.
src/Nut/DebugServiceRegistration.php
Outdated
'#', | ||
'Provider', | ||
[new TableCell('Service Providers', ['colspan' => 2])], | ||
['Provider Class Name', 'Boot Order'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can Boot Order
be changed to just Order
? Order affects services registered, booted, event subscriptions, and controllers mounted.
src/Nut/DebugEvents.php
Outdated
* @param OutputInterface $output | ||
*/ | ||
private function displayListeners(OutputInterface $output) | ||
private function displayListeners(InputInterface $input, OutputInterface $output) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's with the separate method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gone now … copy/pasta
When we're happy, I'll rebase it all up. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would dump:
be better than debug:
for these?
src/Nut/DebugEvents.php
Outdated
@@ -20,7 +22,8 @@ protected function configure() | |||
{ | |||
$this | |||
->setName('debug:events') | |||
->setDescription('System events, and target callable debug dumper.') | |||
->setDescription('Events, and target callable, debug dumper.') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dumps event listeners
src/Nut/DebugEvents.php
Outdated
@@ -20,7 +22,8 @@ protected function configure() | |||
{ | |||
$this | |||
->setName('debug:events') | |||
->setDescription('System events, and target callable debug dumper.') | |||
->setDescription('Events, and target callable, debug dumper.') | |||
->addOption('sort-callable', null, InputOption::VALUE_NONE, 'Sort events in order of callable name.') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sort-name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The column is the FQCN::method() of the event name being listener to
src/Nut/DebugEvents.php
Outdated
'Listener', | ||
)); | ||
$table->setHeaders([ | ||
[new TableCell('Events, and target callable', ['colspan' => 3])], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Event Listeners
src/Nut/DebugRoutes.php
Outdated
'Bind name', | ||
'Path matching parameter', | ||
'Method(s)', | ||
[new TableCell('System routes', ['colspan' => 3])], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Routes
src/Nut/DebugServiceProviders.php
Outdated
$this | ||
->setName('debug:service-providers') | ||
->setAliases(['debug:providers']) | ||
->setDescription('System service provider registration boot order debug dumper.') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dumps service providers and their order.
src/Nut/DebugServiceProviders.php
Outdated
->setName('debug:service-providers') | ||
->setAliases(['debug:providers']) | ||
->setDescription('System service provider registration boot order debug dumper.') | ||
->addOption('sort-class', null, InputOption::VALUE_NONE, 'Sort by provider class names.') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sort-name
I tossed that over with @bobdenotter, he pointed out that SF use |
->addOption('sort-pattern', null, InputOption::VALUE_NONE, 'Sort in order of URI patterns.') | ||
->addOption('sort-methods', null, InputOption::VALUE_NONE, 'Sort in order of HTTP method grouping allowed.') | ||
->addOption('sort-method', null, InputOption::VALUE_NONE, 'Sort in order of HTTP method grouping allowed.') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is where I was saying it seems to make more sense to have a value here instead of an option for each sorting. --sort name/path/method
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, but was thinking of consistency with the others
src/Nut/DebugEvents.php
Outdated
$rightAligned->setPadType(STR_PAD_LEFT); | ||
$table->setHeaders([ | ||
[new TableCell('Event names, target callable listeners, and their priority', ['colspan' => 3])], | ||
['Event Name', 'Callable', 'Priority'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first header is the exact same info as the second, no?
I think Listener
would be better than Callable
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got to get you to actually use some code one day …
$ ./app/nut debug:events
+-----------------------+---------------------------------------------------------------------------------------+--------------------+
| Event names, target callable listeners, and their priority |
+-----------------------+---------------------------------------------------------------------------------------+--------------------+
| Event Name | Callable | Priority |
+-----------------------+---------------------------------------------------------------------------------------+--------------------+
| kernel.request | Symfony\Component\HttpKernel\EventListener\DebugHandlersListener::configure() | 2048 |
| kernel.request | Symfony\Component\HttpKernel\EventListener\ProfilerListener::onKernelRequest() | 1024 |
| kernel.request | Bolt\EventListener\ConfigListener::onRequestEarly() | 512 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know what it outputs. I meant it conveys the same information
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is "event name", and "callable" (or "listener", which I don't agree with in this case) is conveying the exact same thing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've dropped the (first) title row and changed "Callable" to "Listener" … c.b.f 😉
Even added test coverage! #PR |
Mostly tweaks to allow different sorting, and a cople of table "pretty"