You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class AssertEmptyIsDiscouragedRule implements Rule
{
public function getNodeType(): string
{
return CallLike::class;
}
public function processNode(Node $node, Scope $scope): array
{
if ($node->isFirstClassCallable() || count($node->getArgs()) < 1) {
return [];
}
if ($node instanceof MethodCall || $node instanceof StaticCall) {
if (!$node->name instanceof Identifier || !in_array($node->name->toLowerString(), ['assertempty', 'assertnotempty'], true)) {
return [];
}
if (!AssertRuleHelper::isMethodOrStaticCallOnAssert($node, $scope)) {
return [];
}
} elseif ($node instanceof FuncCall) {
if (!$node->name instanceof Name || !in_array(strtolower($scope->resolveName($node->name)), ['phpunit\\framework\\assertempty', 'phpunit\\framework\\assertnotempty'], true)) {
return [];
}
} else {
return [];
}
return [
RuleErrorBuilder::message(sprintf(
'%s() is not allowed. Use more strict assertion.',