diff --git a/packages/framework/src/Framework/Exceptions/ParseException.php b/packages/framework/src/Framework/Exceptions/ParseException.php index 3452b493648..753cb870780 100644 --- a/packages/framework/src/Framework/Exceptions/ParseException.php +++ b/packages/framework/src/Framework/Exceptions/ParseException.php @@ -23,6 +23,11 @@ public function __construct(string $file = '', ?Throwable $previous = null) parent::__construct($this->formatMessage($file, $previous), previous: $previous); } + protected function formatMessage(string $file, ?Throwable $previous): string + { + return rtrim(sprintf("Invalid %s in file: '%s' %s", $this->getTypeLabel($file), $file, $this->getContext($previous))); + } + protected function getTypeLabel(string $file): string { return match (Arr::last(explode('.', $file))) { @@ -37,9 +42,4 @@ protected function getContext(?Throwable $previous): string { return ($previous && $previous->getMessage()) ? sprintf('(%s)', rtrim($previous->getMessage(), '.')) : ''; } - - protected function formatMessage(string $file, ?Throwable $previous): string - { - return rtrim(sprintf("Invalid %s in file: '%s' %s", $this->getTypeLabel($file), $file, $this->getContext($previous))); - } }