for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* @author Patsura Dmitry https://github.com/ovr <[email protected]>
*/
namespace PHPSA;
use PHPSA\Compiler\Expression;
use PHPSA\Compiler\Statement;
use PhpParser\Node;
* @param $stmt
* @return Expression|Statement
function nodeVisitorFactory($stmt, Context $context)
{
if ($stmt instanceof Node\Stmt) {
$visitor = new Statement($stmt, $context);
return $visitor;
}
$visitor = new Expression($context);
return $visitor->compile($stmt);