38
38
*/
39
39
class Error extends \Exception
40
40
{
41
- private $ lineno ;
42
41
private $ rawMessage ;
43
42
private ?Source $ source ;
44
43
@@ -55,7 +54,7 @@ public function __construct(string $message, int $lineno = -1, ?Source $source =
55
54
{
56
55
parent ::__construct ('' , 0 , $ previous );
57
56
58
- $ this ->lineno = $ lineno ;
57
+ $ this ->line = $ lineno ;
59
58
$ this ->source = $ source ;
60
59
$ this ->rawMessage = $ message ;
61
60
$ this ->updateRepr ();
@@ -68,12 +67,12 @@ public function getRawMessage(): string
68
67
69
68
public function getTemplateLine (): int
70
69
{
71
- return $ this ->lineno ;
70
+ return $ this ->line ;
72
71
}
73
72
74
73
public function setTemplateLine (int $ lineno ): void
75
74
{
76
- $ this ->lineno = $ lineno ;
75
+ $ this ->line = $ lineno ;
77
76
$ this ->updateRepr ();
78
77
}
79
78
@@ -90,7 +89,7 @@ public function setSourceContext(?Source $source = null): void
90
89
91
90
public function guess (): void
92
91
{
93
- if ($ this ->lineno > -1 ) {
92
+ if ($ this ->line > -1 ) {
94
93
return ;
95
94
}
96
95
@@ -106,9 +105,6 @@ public function appendMessage($rawMessage): void
106
105
107
106
private function updateRepr (): void
108
107
{
109
- if ($ this ->lineno > 0 ) {
110
- $ this ->line = $ this ->lineno ;
111
- }
112
108
if ($ this ->source && $ this ->source ->getPath ()) {
113
109
$ this ->file = $ this ->source ->getPath ();
114
110
}
@@ -121,8 +117,8 @@ private function updateRepr(): void
121
117
if ($ this ->source && $ this ->source ->getName ()) {
122
118
$ this ->message .= \sprintf (' in "%s" ' , $ this ->source ->getName ());
123
119
}
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 );
126
122
}
127
123
if ($ punctuation ) {
128
124
$ this ->message .= $ punctuation ;
@@ -167,7 +163,7 @@ private function guessTemplateInfo(): void
167
163
foreach ($ template ->getDebugInfo () as $ codeLine => $ templateLine ) {
168
164
if ($ codeLine <= $ trace ['line ' ]) {
169
165
// update template line
170
- $ this ->lineno = $ templateLine ;
166
+ $ this ->line = $ templateLine ;
171
167
172
168
return ;
173
169
}
0 commit comments