These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | declare( strict_types = 1 ); |
||
4 | |||
5 | namespace Wikibase\JsonDumpReader\Reader; |
||
6 | |||
7 | use Wikibase\JsonDumpReader\DumpReader; |
||
8 | |||
9 | /** |
||
10 | * Package public |
||
11 | * @since 1.0.0 |
||
12 | * |
||
13 | * @licence GNU GPL v2+ |
||
14 | * @author Jeroen De Dauw < [email protected] > |
||
15 | */ |
||
16 | class FakeDumpReader implements DumpReader { |
||
17 | |||
18 | /** |
||
19 | * @var string[] |
||
20 | */ |
||
21 | private $lines; |
||
22 | |||
23 | /** |
||
24 | * @param string $lines |
||
25 | */ |
||
26 | 5 | public function __construct( $lines ) { |
|
27 | 5 | $this->lines = $lines; |
|
0 ignored issues
–
show
|
|||
28 | 5 | $this->rewind(); |
|
29 | 5 | } |
|
30 | |||
31 | 5 | public function rewind(): void { |
|
32 | 5 | reset( $this->lines ); |
|
33 | 5 | } |
|
34 | |||
35 | /** |
||
36 | * @return string|null |
||
37 | */ |
||
38 | 5 | public function nextJsonLine(): ?string { |
|
39 | 5 | $current = current( $this->lines ); |
|
40 | |||
41 | 5 | if ( $current === false ) { |
|
42 | 2 | return null; |
|
43 | } |
||
44 | else { |
||
45 | 5 | next( $this->lines ); |
|
46 | 5 | return $current; |
|
47 | } |
||
48 | } |
||
49 | |||
50 | } |
||
51 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..