for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
Checks property assignments for possibly missing type casts.
* Class FormTurn. Turn on/off model for application object
* @package Apps\Model\Admin\Application
class FormTurn extends Model
* FormTurn constructor. Pass app object inside.
* @param App $record
public function __construct(App $record)
$this->_record = $record;
* Switch app status to inverse
public function update()
$status = $this->_record->disabled;
$this->_record->disabled = (int)!$status; // magic inside: bool to int and reverse - 0 => 1, 1 => 0
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.
$answer = 42;
$correct = false;
$correct = (bool) $answer;