for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Cycle\ORM\Promise\Visitor;
use PhpParser\Node;
use PhpParser\NodeVisitorAbstract;
/**
* Declare proxy class, add extends and implements declarations
*/
class DeclareClass extends NodeVisitorAbstract
{
/** @var string */
private $name;
private $extends;
public function __construct(string $name, string $extends)
$this->name = $name;
$this->extends = $extends;
}
* {@inheritdoc}
public function leaveNode(Node $node)
if ($node instanceof Node\Stmt\Class_) {
$node->extends = new Node\Name($this->extends);
$node->name->name = $this->name;
return null;