diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-06-05 03:17:01 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-06-05 03:17:01 +0900 |
| commit | 53800ab77565de1c16fb8a95e047eba1cb3a160c (patch) | |
| tree | 9dbfa9f098f7c2b75651c16220d3c57a9bbbd1a1 /crates/shirabe | |
| parent | 9a25fcfc82b72f60facd381786ca5490acca032c (diff) | |
| download | php-shirabe-53800ab77565de1c16fb8a95e047eba1cb3a160c.tar.gz php-shirabe-53800ab77565de1c16fb8a95e047eba1cb3a160c.tar.zst php-shirabe-53800ab77565de1c16fb8a95e047eba1cb3a160c.zip | |
feat(json-lint): port ParsingException details into a typed struct
Replace the Phase B stub that discarded ParsingException details with a
dedicated ParsingExceptionDetails struct (text/token/line/loc/expected),
modeling the PHP string|int token union as a ParsingExceptionToken enum.
Wire JsonFile::validate_syntax to forward the source details and let
Application read the error line from the typed accessor.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe')
| -rw-r--r-- | crates/shirabe/src/console/application.rs | 10 | ||||
| -rw-r--r-- | crates/shirabe/src/json/json_file.rs | 4 |
2 files changed, 4 insertions, 10 deletions
diff --git a/crates/shirabe/src/console/application.rs b/crates/shirabe/src/console/application.rs index f27ed79..8bd34ad 100644 --- a/crates/shirabe/src/console/application.rs +++ b/crates/shirabe/src/console/application.rs @@ -448,17 +448,11 @@ impl Application { if e.downcast_ref::<NoSslException>().is_some() { // suppress these as they are not relevant at this point } else if let Some(pe) = e.downcast_ref::<ParsingException>() { - // TODO(phase-b): ParsingException::get_details is not yet ported. - let details: IndexMap<String, PhpMixed> = IndexMap::new(); + let details = pe.get_details(); let file = realpath(&Factory::get_composer_file().unwrap_or_default()); - let mut line: Option<i64> = None; - if !details.is_empty() { - if let Some(l) = details.get("line").and_then(|v| v.as_int()) { - line = Some(l); - } - } + let line = details.line; let mut ghe = GithubActionError::new(self.io.clone()); ghe.emit(&pe.message, file.as_deref(), line); diff --git a/crates/shirabe/src/json/json_file.rs b/crates/shirabe/src/json/json_file.rs index 33496df..0b1b010 100644 --- a/crates/shirabe/src/json/json_file.rs +++ b/crates/shirabe/src/json/json_file.rs @@ -535,7 +535,7 @@ impl JsonFile { "The input does not contain valid JSON\n{}", result.get_message() ), - None, + result.get_details().clone(), ), Some(f) => ParsingException::new( format!( @@ -543,7 +543,7 @@ impl JsonFile { f, result.get_message() ), - None, + result.get_details().clone(), ), } .into()) |
