public function enterNode(Node $node)
{
if (!$this->functionAnalyzer->isFunctionCallByStaticName($node, self::$setcookieFamilyFunctions)) {
return;
}
/** @var Node\Expr\FuncCall $node */
$cookieNameArgumentValue = isset($node->args[0]) ? $node->args[0]->value : null;
$isEmptyString = $cookieNameArgumentValue && $cookieNameArgumentValue instanceof Node\Scalar\String_ && $cookieNameArgumentValue->value === '';
$isEmptyConstant = $cookieNameArgumentValue && $cookieNameArgumentValue instanceof Node\Expr\ConstFetch && in_array(strtolower($cookieNameArgumentValue->name->toString()), array('null', 'false'), true);
if ($isEmptyConstant || $isEmptyString) {
$this->addContextMessage(sprintf('Function "%s" called with an empty cookie name', $node->name->toString()), $node);
}
}