diff --git a/build/psalm/LogicalOperatorChecker.php b/build/psalm/LogicalOperatorChecker.php new file mode 100644 index 0000000000000..93dc6a04270ee --- /dev/null +++ b/build/psalm/LogicalOperatorChecker.php @@ -0,0 +1,30 @@ +getExpr(); + if ($stmt instanceof PhpParser\Node\Expr\BinaryOp\LogicalAnd + || $stmt instanceof PhpParser\Node\Expr\BinaryOp\LogicalOr) { + IssueBuffer::maybeAdd( + new \Psalm\Issue\UnrecognizedExpression( + 'Logical binary operators AND and OR are not allowed in the Nextcloud codebase', + new CodeLocation($event->getStatementsSource()->getSource(), $stmt), + ), + $event->getStatementsSource()->getSuppressedIssues(), + ); + } + return null; + } +} diff --git a/psalm.xml b/psalm.xml index 76cd90f07b34e..f3b66f4f6e406 100644 --- a/psalm.xml +++ b/psalm.xml @@ -17,6 +17,7 @@ +