Skip to content

Commit a398f40

Browse files
committed
Add type declarations, cleanups, phpstan level 8 🎉
1 parent d9a308b commit a398f40

File tree

6 files changed

+275
-161
lines changed

6 files changed

+275
-161
lines changed

‎phpstan.neon.dist‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
parameters:
2-
level: 5
2+
level: 8
33

44
paths:
55
- src/
66
- tests/
7+
8+
ignoreErrors:
9+
- '/Method JsonParserTest::[a-zA-Z0-9]+\(\) has no return typehint/'

‎src/Seld/JsonLint/DuplicateKeyException.php‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,32 @@
1313

1414
class DuplicateKeyException extends ParsingException
1515
{
16+
/**
17+
* @var array{key: string, line: int}
18+
*/
19+
protected $details;
20+
1621
/**
1722
* @param string $message
1823
* @param string $key
19-
* @phpstan-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
24+
* @phpstan-param array{line: int} $details
2025
*/
21-
public function __construct($message, $key, array $details = array())
26+
public function __construct($message, $key, array $details)
2227
{
2328
$details['key'] = $key;
2429
parent::__construct($message, $details);
2530
}
2631

32+
/**
33+
* @return string
34+
*/
2735
public function getKey()
2836
{
2937
return $this->details['key'];
3038
}
3139

3240
/**
33-
* @phpstan-return array{text?: string, token?: string, line?: int, loc?: array{first_line: int, first_column: int, last_line: int, last_column: int}, expected?: string[], key: string}
41+
* @phpstan-return array{key: string, line: int}
3442
*/
3543
public function getDetails()
3644
{

0 commit comments

Comments
 (0)