Skip to content

Commit 7e28add

Browse files
authored
Added phpdocs (#72)
1 parent 811ee37 commit 7e28add

4 files changed

Lines changed: 13 additions & 6 deletions

File tree

phpstan-config.neon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
parameters:
2-
level: 1
2+
level: 5
33

44
paths:
55
- src/

src/Seld/JsonLint/JsonParser.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ class JsonParser
3838
private $vstack; // semantic value stack
3939
private $lstack; // location stack
4040

41+
/**
42+
* @phpstan-var array<string, int>
43+
*/
4144
private $symbols = array(
4245
'error' => 2,
4346
'JSONString' => 3,
@@ -67,6 +70,9 @@ class JsonParser
6770
'$end' => 1,
6871
);
6972

73+
/**
74+
* @phpstan-var array<int, string>
75+
*/
7076
private $terminals_ = array(
7177
2 => "error",
7278
4 => "STRING",
@@ -127,6 +133,7 @@ public function lint($input, $flags = 0)
127133
} catch (ParsingException $e) {
128134
return $e;
129135
}
136+
return null;
130137
}
131138

132139
/**
@@ -325,8 +332,6 @@ public function parse($input, $flags = 0)
325332
return true;
326333
}
327334
}
328-
329-
return true;
330335
}
331336

332337
protected function parseError($str, $hash)

src/Seld/JsonLint/Lexer.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
class Lexer
2020
{
2121
private $EOF = 1;
22+
/**
23+
* @phpstan-var array<int, string>
24+
*/
2225
private $rules = array(
2326
0 => '/\G\s+/',
2427
1 => '/\G-?([0-9]|[1-9][0-9]+)(\.[0-9]+)?([eE][+-]?[0-9]+)?\b/',
@@ -199,7 +202,6 @@ private function performAction($avoiding_name_collisions, $YY_START)
199202
break;
200203
case 1:
201204
return 6;
202-
break;
203205
case 2:
204206
$this->yytext = substr($this->yytext, 1, $this->yyleng-2);
205207

src/Seld/JsonLint/ParsingException.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class ParsingException extends \Exception
1717

1818
/**
1919
* @param string $message
20-
* @psalm-param array{text?: string, token?: string, line?: int, loc?: array, expected?: array} $details
20+
* @psalm-param array{text?: string, token?: string, line?: int, loc?: array{first_line: int, first_column: int, last_line: int, last_column: int}, expected?: string[]} $details
2121
*/
2222
public function __construct($message, $details = array())
2323
{
@@ -26,7 +26,7 @@ public function __construct($message, $details = array())
2626
}
2727

2828
/**
29-
* @psalm-return array{text?: string, token?: string, line?: int, loc?: array, expected?: array}
29+
* @psalm-return array{text?: string, token?: string, line?: int, loc?: array{first_line: int, first_column: int, last_line: int, last_column: int}, expected?: string[]}
3030
*/
3131
public function getDetails()
3232
{

0 commit comments

Comments
 (0)