forked from hhvm/hhast
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLineLintError.hack
More file actions
33 lines (28 loc) · 804 Bytes
/
Copy pathLineLintError.hack
File metadata and controls
33 lines (28 loc) · 804 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*
* Copyright (c) 2017-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
namespace Facebook\HHAST;
class LineLintError extends SingleRuleLintError {
public function __construct(
private LineLinter<LineLintError> $linter,
private string $description,
private (int, int) $position,
) {
parent::__construct($linter, $description);
}
<<__Override>>
public function getPosition(): (int, int) {
return $this->position;
}
<<__Override>>
public function getBlameCode(): ?string {
$line = $this->position[0] - 1;
invariant($line >= 0, 'line number should never be negative');
return $this->linter->getLine($line);
}
}