for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Fabrica\Tools;
use phpseclib3\Net\SSH2;
use Fabrica\Models\Infra\Computer;
/**
* Bash Class
*
* @class Bash
*/
class Ssh extends Bash
{
protected $computer = false;
public function __construct(Computer $computer)
$this->computer = $computer;
$computer
object<Fabrica\Models\Infra\Computer>
boolean
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..
}
public function getConnection()
if (!$this->connection) {
$this->connection = new SSH2($this->computer->host);
connection
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
class MyClass { } $x = new MyClass(); $x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:
class MyClass { public $foo; } $x = new MyClass(); $x->foo = true;
if ($this->computer->key) {
if ($this->connection->login($this->computer->username, $this->computer->key->getKey())) {
return $this->connection;
if (isset($this->computer->password) && $this->computer->password && $this->connection->login($this->computer->username, $this->computer->password)) {
exit('Login Failed');
public function exec($exec, $path = false)
if (!$path) {
$exec = 'cd '.$this->computer.' && '.$exec;
return $this->getConnection()->exec($exec);
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..