Skip to content

Let tag handlers describe their expected format for InvalidTag reporting#457

Open
lacatoire wants to merge 3 commits intophpDocumentor:6.xfrom
lacatoire:feat/invalid-tag-better-errors
Open

Let tag handlers describe their expected format for InvalidTag reporting#457
lacatoire wants to merge 3 commits intophpDocumentor:6.xfrom
lacatoire:feat/invalid-tag-better-errors

Conversation

@lacatoire
Copy link
Copy Markdown

Adds an ExpectedFormat interface a tag handler may opt into to advertise the syntax it expects together with a link to its canonical documentation. When StandardTagFactory falls back to InvalidTag because the handler rejected the body, it forwards those hints through the new InvalidTag::withFormatHint() method so downstream tooling (for example phpDocumentor's error reports) can surface a helpful explanation instead of only the raw exception.

Author implements the interface as a first example, since its lack of description support is a common source of confusion (see phpDocumentor/phpDocumentor#3378).

Purely additive: new interface, new methods on InvalidTag, no changes to existing public contracts.

Fixes #346

Adds an `ExpectedFormat` interface a tag handler may opt into to advertise the syntax it expects together with a link to its canonical documentation. When `StandardTagFactory` falls back to `InvalidTag` because the handler rejected the body, it forwards those hints through the new `InvalidTag::withFormatHint()` method so downstream tooling (for example phpDocumentor's error reports) can surface a helpful explanation instead of only the raw exception. `Author` implements the interface as a first example since its lack of description support is a common source of confusion (see phpDocumentor/phpDocumentor#3378).

Fixes phpDocumentor#346
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add more information when an InvalidTag occurs and a link to the phpDocumentor documentation

1 participant