Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- refactor: share captured URL-to-path display conversion through `Text::urlToPath()` while retaining original diagnostic URLs and adapter-owned presentation models.
- feat(events): add the shared execution inspector, stable chronology, grouped filters, bounded optional context and traces, and explicit lifecycle correlation.
- refactor: centralize exception messages and panel titles in typed enums while preserving diagnostics, labels, and configurable names.
- refactor: use shared `PanelIcon` enum values for built-in panel SVG keys.
88 changes: 88 additions & 0 deletions src/Panel/PanelIcon.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<?php

declare(strict_types=1);

namespace PHPForge\Debug\Panel;

/**
* Shared SVG keys for built-in debugger panels.
*
* Use the backed value with string-based toolbar contracts and the shared icon renderer.
*/
enum PanelIcon: string
{
/**
* Icon key for the Asset Bundles panel.
*/
case ASSETS = 'asset';

/**
* Icon key for the Configuration panel.
*/
case CONFIGURATION = 'config';

/**
* Icon key for the Database panel.
*/
case DATABASE = 'db';

/**
* Icon key for the Dump and fallback JSON panels.
*/
case DUMP = 'dump';

/**
* Icon key for the Events panel.
*/
case EVENTS = 'events';

/**
* Icon key for the Inertia panel.
*/
case INERTIA = 'inertia';

/**
* Icon key for the Logs panel.
*/
case LOGS = 'logs';

/**
* Icon key for the Mail panel.
*/
case MAIL = 'mail';

/**
* Icon key for the Profiling panel.
*/
case PROFILING = 'profiling';

/**
* Icon key for the Queue panel.
*/
case QUEUE = 'queue';

/**
* Icon key for the Request panel.
*/
case REQUEST = 'request';

/**
* Icon key for the Router panel.
*/
case ROUTER = 'router';

/**
* Icon key for the Timeline panel.
*/
case TIMELINE = 'timeline';

/**
* Icon key for the User panel.
*/
case USER = 'user';

/**
* Icon key for the Vite panel.
*/
case VITE = 'brand-javascript';
}
57 changes: 57 additions & 0 deletions tests/Panel/PanelIconTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?php

declare(strict_types=1);

namespace PHPForge\Debug\Tests\Panel;

use PHPForge\Debug\Helper\Icon;
use PHPForge\Debug\Panel\PanelIcon;
use PHPUnit\Framework\TestCase;

use function count;

/**
* Verifies stable built-in panel icon keys and their bundled SVG resources.
*/
final class PanelIconTest extends TestCase
{
public function testIconKeysPreserveExistingSvgResources(): void
{
$keys = [
'ASSETS' => 'asset',
'CONFIGURATION' => 'config',
'DATABASE' => 'db',
'DUMP' => 'dump',
'EVENTS' => 'events',
'INERTIA' => 'inertia',
'LOGS' => 'logs',
'MAIL' => 'mail',
'PROFILING' => 'profiling',
'QUEUE' => 'queue',
'REQUEST' => 'request',
'ROUTER' => 'router',
'TIMELINE' => 'timeline',
'USER' => 'user',
'VITE' => 'brand-javascript',
];

self::assertCount(
count($keys),
PanelIcon::cases(),
'Every built-in icon must have a stable key assertion.',
);

foreach (PanelIcon::cases() as $icon) {
self::assertSame(
$keys[$icon->name],
$icon->value,
'Existing panel icon keys must remain unchanged.',
);
self::assertStringContainsString(
'<svg',
Icon::render($icon->value),
'Every built-in panel icon must resolve to a bundled SVG.',
);
}
}
}
Loading