for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Chrl\AppBundle\GameAction;
class NextAction extends BaseGameAction implements GameActionInterface
{
public function run($message, $user)
$game = $this->gameService->findGame($game);
$game
This error can happen if you refactor code and forget to move the variable initialization.
Let’s take a look at a simple example:
function someFunction() { $x = 5; echo $x; }
The above code is perfectly fine. Now imagine that we re-order the statements:
function someFunction() { echo $x; $x = 5; }
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.
$x
$this->botApi->sendMessage(
$game->chatId,
'Ok, changing question.',
'markdown'
);
$this->gameService->em->persist($game);
$this->gameService->em->flush();
$this->gameService->askQuestion($game);
}
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.