1 | <?php |
||
19 | class PragmaResolver extends BasePragmas implements ResolverInterface |
||
20 | { |
||
21 | /** |
||
22 | * @param Readable $readable |
||
23 | * @param TokenInterface $token |
||
24 | * @throws \Railt\Io\Exception\ExternalFileException |
||
25 | */ |
||
26 | public function resolve(Readable $readable, TokenInterface $token): void |
||
38 | } |
||
39 |
This error can happen if you refactor code and forget to move the variable initialization.
Let’s take a look at a simple example:
The above code is perfectly fine. Now imagine that we re-order the statements:
In that case,
$x
would be read before it is initialized. This was a very basic example, however the principle is the same for the found issue.