Skip to content

Commit 46da169

Browse files
committed
Align array values
split: a18b4ad4e022a9c90bdfebebede2cbb8a1f052cb
1 parent c727bea commit 46da169

2 files changed

Lines changed: 11 additions & 9 deletions

File tree

Reader.php

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -916,15 +916,13 @@ protected function throwException($message)
916916
$path = $this->getPath();
917917
$exception = new ReaderException(
918918
new SourceLocation(null, $this->line, $this->offset),
919-
sprintf(
920-
"Failed to read: %s \nNear: %s%s\nLine: %s \nOffset: %s \nPosition: %s",
921-
$message,
922-
$this->peek(20),
923-
$path ? "\nFile: $path" : '',
924-
$this->line,
925-
$this->offset,
926-
$this->position
927-
)
919+
ReaderException::message($message, [
920+
'near' => $this->peek(20),
921+
'path' => $path,
922+
'line' => $this->line,
923+
'offset' => $this->offset,
924+
'position' => $this->position,
925+
])
928926
);
929927

930928
throw $exception;

ReaderException.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,8 @@
99
*/
1010
class ReaderException extends LocatedException
1111
{
12+
public static function message($message, array $details = [])
13+
{
14+
return static::getFailureMessage('read', $message, $details);
15+
}
1216
}

0 commit comments

Comments
 (0)