for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Phpml\Tree\Node;
use Phpml\Tree\Node;
class BinaryNode implements Node
{
/**
* @var self|null
*/
private $parent;
private $left;
private $right;
public function parent(): ?self
return $this->parent;
}
public function left(): ?self
return $this->left;
public function right(): ?self
return $this->right;
public function height(): int
return 1 + max($this->left !== null ? $this->left->height() : 0, $this->right !== null ? $this->right->height() : 0);
public function balance(): int
return ($this->right !== null ? $this->right->height() : 0) - ($this->left !== null ? $this->left->height() : 0);
public function setParent(?self $node = null): void
$this->parent = $node;
public function attachLeft(self $node): void
$node->setParent($this);
$this->left = $node;
$node
object<self>
object<Phpml\Tree\Node\BinaryNode>|null
$left
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 detachLeft(): void
if ($this->left !== null) {
$this->left->setParent();
$this->left = null;
public function attachRight(self $node): void
$this->right = $node;
$right
public function detachRight(): void
if ($this->right !== null) {
$this->right->setParent();
$this->right = null;
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..