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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## 0.1.1 Under development

- feat(panel-view): add filterable tables, trace frames, safe links, and SQL text styling.

## 0.1.0 September 11, 2026

- feat: initial development release.
101 changes: 101 additions & 0 deletions src/Exception/Message.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
<?php

declare(strict_types=1);

namespace PHPForge\Debug\Exception;

use function sprintf;

/**
* Exception message templates authored by this package.
*
* Use {@see Message::getMessage()} to format a template with `sprintf()` arguments.
*/
enum Message: string
{
/**
* Indicates that a column style is not a {@see \PHPForge\Debug\ColumnStyle} case.
*
* Format: "Debug panel column styles must be %s cases."
*/
case COLUMN_STYLE_INVALID = 'Debug panel column styles must be %s cases.';

/**
* Indicates that a column style is keyed by a column the table does not declare.
*
* Format: "Debug panel column styles must be keyed by an existing column index."
*/
case COLUMN_STYLE_KEY_INVALID = 'Debug panel column styles must be keyed by an existing column index.';

/**
* Indicates that an inline value is neither a scalar, `null`, nor a shape this class produces.
*
* Format: "Debug panel inline content must be a scalar, null, or a PanelView inline value. Got %s."
*/
case INLINE_CONTENT_INVALID = 'Debug panel inline content must be a scalar, null, or a PanelView inline value. '
. 'Got %s.';

/**
* Indicates that a link target carries characters a browser strips while resolving a URL.
*
* Format: "Debug panel links must not carry control characters or surrounding spaces, because a browser strips
* them while resolving the target."
*/
case LINK_TARGET_NORMALIZED = 'Debug panel links must not carry control characters or surrounding spaces, because '
. 'a browser strips them while resolving the target.';

/**
* Indicates that a link target declares a scheme the host must not follow.
*
* Format: "Debug panel links must be relative or use the http, https, or mailto scheme. Got %s."
*/
case LINK_TARGET_SCHEME_INVALID = 'Debug panel links must be relative or use the http, https, or mailto scheme. '
. 'Got %s.';

/**
* Indicates that a link target cannot be parsed as a URL.
*
* Format: "Debug panel links must be a target a browser can resolve."
*/
case LINK_TARGET_UNPARSABLE = 'Debug panel links must be a target a browser can resolve.';

/**
* Indicates that paragraph content is neither a scalar, an inline value, nor a list of them.
*
* Format: "Debug panel paragraphs must be scalars, inline values, or lists of them."
*/
case PARAGRAPH_CONTENT_INVALID = 'Debug panel paragraphs must be scalars, inline values, or lists of them.';

/**
* Indicates that a column heading is not a plain string.
*
* Format: "Debug panel table headers must be plain strings."
*/
case TABLE_HEADER_INVALID = 'Debug panel table headers must be plain strings.';

/**
* Indicates that a table row is not a list as wide as the headers.
*
* Format: "Debug panel table rows must be lists whose width matches the headers."
*/
case TABLE_ROW_WIDTH_INVALID = 'Debug panel table rows must be lists whose width matches the headers.';

/**
* Indicates that a captured trace frame is not an array of frame fields.
*
* Format: "Debug panel trace frames must be arrays of frame fields."
*/
case TRACE_FRAME_INVALID = 'Debug panel trace frames must be arrays of frame fields.';

/**
* Formats the message without changing diagnostic argument values.
*
* @param int|string ...$argument Values to insert into the message template.
*
* @return string Formatted exception message.
*/
public function getMessage(int|string ...$argument): string
{
return sprintf($this->value, ...$argument);
}
}
8 changes: 4 additions & 4 deletions src/Panel.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ abstract public function present(array $data): PanelView;
/**
* Returns the icon identifier declared by the extension.
*
* @throws InvalidArgumentException If the icon identifier is empty.
* @throws InvalidArgumentException if the icon identifier is empty.
*
* @return string Host-interpreted icon identifier.
*/
Expand All @@ -53,7 +53,7 @@ final public function icon(): string
/**
* Returns the stable panel identifier declared by the extension.
*
* @throws InvalidArgumentException If the panel identifier is empty.
* @throws InvalidArgumentException if the panel identifier is empty.
*
* @return string Identifier used to associate the panel with captured data.
*/
Expand All @@ -65,7 +65,7 @@ final public function id(): string
/**
* Returns the navigation title declared by the extension.
*
* @throws InvalidArgumentException If the panel title is empty.
* @throws InvalidArgumentException if the panel title is empty.
*
* @return string Human-readable panel title.
*/
Expand All @@ -80,7 +80,7 @@ final public function name(): string
* @param string $value Metadata value to validate.
* @param string $field Constant name included in the validation error.
*
* @throws InvalidArgumentException If the metadata value is empty.
* @throws InvalidArgumentException if the metadata value is empty.
*
* @return string Unmodified metadata value.
*/
Expand Down
Loading
Loading