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
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ All notable changes to this project will be documented in this file.
The format is based on [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 0.1.4 Under development
## 0.2.0 Under development

- feat(panel-view)!: add typed presenters and factory methods; remove array shapes, JSON serialization, and runtime validation.

## 0.1.3 September 14, 2026

Expand Down
28 changes: 23 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,9 @@ replays a stored capture with no debugger host present.

## Presentation vocabulary

Five types are published: `CollectorInterface`, `Panel`, `PanelView`, `Tone`, and `ColumnStyle`. Everything a panel can
display is a `PanelView` method, so there is no value class to import and no shape to build by hand.
Five types are published for panel authors: `CollectorInterface`, `Panel`, `PanelView`, `Tone`, and `ColumnStyle`.
Everything a panel can display is a `PanelView` method, so an extension imports no value class and builds nothing by
hand.

```php
use PHPForge\Debug\{ColumnStyle, PanelView, Tone};
Expand All @@ -174,9 +175,26 @@ PanelView::create()
```

Plain scalars and `null` become text. `PanelView::text()`, `::strong()`, `::code()`, `::preview()`, `::badge()`, and
`::value()` produce validated inline values accepted wherever a scalar is accepted. Every method validates its
arguments and rejects invalid input with an explicit `InvalidArgumentException`. The host reads the finished
description through `summaryMetrics()`, `toolbarMetrics()`, `blocks()`, and `isActive()`.
`::value()` produce validated inline values accepted wherever a scalar is accepted. Methods with explicit value
validation reject invalid input with an `InvalidArgumentException`; arguments with incompatible declared types raise
PHP's native `TypeError`.

The host reads the finished description through `summaryMetrics()`, `toolbarMetrics()`, `blocks()`, and `isActive()`.
Those accessors return `PHPForge\Debug\Presenter` value objects: `SummaryMetric`, `ToolbarMetric`, and the blocks,
entries, and inline values behind them. A renderer narrows each value with `instanceof` over the sealed `Block` and
`Inline` unions, which static analysis proves exhaustive, and reads its public properties. Inline text carries a
`TextStyle` case and a table carries its `ColumnStyle` cases, so semantics reach the markup without parsing strings.

```php
use PHPForge\Debug\Presenter\{HeadingBlock, ParagraphBlock, TableBlock};

$html = match (true) {
$block instanceof HeadingBlock => $this->heading($block->title, $block->section),
$block instanceof ParagraphBlock => $this->paragraph($block->content, $block->tone),
$block instanceof TableBlock => $this->table($block->headers, $block->rows, $block->styles),
// one arm per block; PHPStan reports a missing arm as an unhandled match value.
};
```

## Documentation

Expand Down
7 changes: 0 additions & 7 deletions src/Exception/PanelViewMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,6 @@ enum PanelViewMessage: string
*/
case COLUMN_STYLE_KEY_INVALID = 'Debug panel column styles must be keyed by an existing column index.';

/**
* Indicates that an entry passed to a composite block was not built by the matching factory.
*
* Format: "Debug panel %s entries must be built with PanelView::%s()."
*/
case ENTRY_INVALID = 'Debug panel %s entries must be built with PanelView::%s().';

/**
* Indicates that an inline value is neither a scalar, `null`, nor a shape this class produces.
*
Expand Down
Loading
Loading