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\Analyzer\Pass\Expression\FunctionCall;
use PhpParser\Node\Expr\FuncCall;
use PhpParser\Node\Name;
use PHPSA\Analyzer\Helper\ResolveExpressionTrait;
use PHPSA\Compiler\Expression;
use PHPSA\Context;
class AliasCheck implements PassFunctionCallInterface
{
use ResolveExpressionTrait;
protected $map = array(
'join' => 'implode',
'sizeof' => 'count'
);
public function pass(FuncCall $funcCall, Context $context)
$functionName = $this->resolveFunctionName($funcCall, $context);
if ($functionName && isset($this->map[$functionName])) {
$context->notice(
'fcall.alias',
sprintf('%s() is an alias of function. Use %s(...).', $functionName, $this->map[$functionName]),
$funcCall
}