PHPSA\Analyzer\Pass\Expression\FunctionCall\RegularExpressions::pass PHP Метод

pass() публичный Метод

public pass ( PhpParser\Node\Expr\FuncCall $funcCall, Context $context ) : mixed
$funcCall PhpParser\Node\Expr\FuncCall
$context PHPSA\Context
Результат mixed
    public function pass(FuncCall $funcCall, Context $context)
    {
        $functionName = $this->resolveFunctionName($funcCall, $context);
        if ($functionName && isset(self::$map[$functionName])) {
            $pattern = $context->getExpressionCompiler()->compile($funcCall->args[0]);
            if ($pattern->isString() && $pattern->isCorrectValue()) {
                $guard = \RegexGuard\Factory::getGuard();
                if (!$guard->isRegexValid($pattern->getValue())) {
                    $context->notice('regex.invalid', sprintf('Regular expression %s is not valid', $pattern->getValue()), $funcCall->args[0], Check::CHECK_ALPHA);
                }
            }
        }
    }
RegularExpressions