for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace PhpToZephir\Converter\Printer\Expr;
use PhpToZephir\Logger;
use PhpParser\Node\Expr;
use PhpToZephir\ReservedWordReplacer;
use PhpToZephir\Converter\Dispatcher;
class ClosureUsePrinter
{
/**
* @var Dispatcher
*/
private $dispatcher = null;
* @var Logger
private $logger = null;
* @var ReservedWordReplacer
private $reservedWordReplacer = null;
* @param Dispatcher $dispatcher
* @param Logger $logger
* @param ReservedWordReplacer $reservedWordReplacer
public function __construct(Dispatcher $dispatcher, Logger $logger, ReservedWordReplacer $reservedWordReplacer)
$this->dispatcher = $dispatcher;
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.
To visualize
$a = "a"; $ab = "ab"; $abc = "abc";
will produce issues in the first and second line, while this second example
will produce no issues.
$this->logger = $logger;
$this->reservedWordReplacer = $reservedWordReplacer;
}
public static function getType()
return 'pExpr_ClosureUse';
* @param Expr\ClosureUse $node
*
* @return string
public function convert(Expr\ClosureUse $node)
if ($node->byRef) {
$this->logger->logNode(
'Zephir not support reference parameters for now. Stay tuned for https://github.com/phalcon/zephir/issues/203',
Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.
$node,
$this->dispatcher->getMetadata()->getClass()
);
return $this->reservedWordReplacer->replace($node->var);
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.
To visualize
will produce issues in the first and second line, while this second example
will produce no issues.