Skip to content

Commit ce51abe

Browse files
committed
Remove uneeded property on Error
1 parent 7cde13f commit ce51abe

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

src/Error/Error.php

+7-11
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
*/
3939
class Error extends \Exception
4040
{
41-
private $lineno;
4241
private $rawMessage;
4342
private ?Source $source;
4443

@@ -55,7 +54,7 @@ public function __construct(string $message, int $lineno = -1, ?Source $source =
5554
{
5655
parent::__construct('', 0, $previous);
5756

58-
$this->lineno = $lineno;
57+
$this->line = $lineno;
5958
$this->source = $source;
6059
$this->rawMessage = $message;
6160
$this->updateRepr();
@@ -68,12 +67,12 @@ public function getRawMessage(): string
6867

6968
public function getTemplateLine(): int
7069
{
71-
return $this->lineno;
70+
return $this->line;
7271
}
7372

7473
public function setTemplateLine(int $lineno): void
7574
{
76-
$this->lineno = $lineno;
75+
$this->line = $lineno;
7776
$this->updateRepr();
7877
}
7978

@@ -90,7 +89,7 @@ public function setSourceContext(?Source $source = null): void
9089

9190
public function guess(): void
9291
{
93-
if ($this->lineno > -1) {
92+
if ($this->line > -1) {
9493
return;
9594
}
9695

@@ -106,9 +105,6 @@ public function appendMessage($rawMessage): void
106105

107106
private function updateRepr(): void
108107
{
109-
if ($this->lineno > 0) {
110-
$this->line = $this->lineno;
111-
}
112108
if ($this->source && $this->source->getPath()) {
113109
$this->file = $this->source->getPath();
114110
}
@@ -121,8 +117,8 @@ private function updateRepr(): void
121117
if ($this->source && $this->source->getName()) {
122118
$this->message .= \sprintf(' in "%s"', $this->source->getName());
123119
}
124-
if ($this->lineno > 0) {
125-
$this->message .= \sprintf(' at line %d', $this->lineno);
120+
if ($this->line > 0) {
121+
$this->message .= \sprintf(' at line %d', $this->line);
126122
}
127123
if ($punctuation) {
128124
$this->message .= $punctuation;
@@ -167,7 +163,7 @@ private function guessTemplateInfo(): void
167163
foreach ($template->getDebugInfo() as $codeLine => $templateLine) {
168164
if ($codeLine <= $trace['line']) {
169165
// update template line
170-
$this->lineno = $templateLine;
166+
$this->line = $templateLine;
171167

172168
return;
173169
}

0 commit comments

Comments
 (0)