mirror of
https://github.com/danog/psalm.git
synced 2024-12-12 09:19:40 +01:00
Forbid empty()
This commit is contained in:
parent
eb973ab2e1
commit
4bf4d8e451
@ -17,6 +17,18 @@ class EmptyAnalyzer
|
||||
) : void {
|
||||
IssetAnalyzer::analyzeIssetVar($statements_analyzer, $stmt->expr, $context);
|
||||
|
||||
if (isset($codebase->config->forbidden_functions['empty'])) {
|
||||
if (IssueBuffer::accepts(
|
||||
new ForbiddenCode(
|
||||
'You have forbidden the use of empty',
|
||||
new CodeLocation($statements_analyzer->getSource(), $stmt)
|
||||
),
|
||||
$statements_analyzer->getSuppressedIssues()
|
||||
)) {
|
||||
// continue
|
||||
}
|
||||
}
|
||||
|
||||
if (($stmt_expr_type = $statements_analyzer->node_data->getType($stmt->expr))
|
||||
&& $stmt_expr_type->hasBool()
|
||||
&& $stmt_expr_type->isSingle()
|
||||
|
Loading…
Reference in New Issue
Block a user