OneBot: Leantime 改造版源码(BOM/Univer 表格/AI 接管/品牌替换等)

This commit is contained in:
wangruiguo
2026-09-03 18:49:20 +08:00
commit d647428529
3501 changed files with 1988906 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
<?php
namespace Leanstan\Rules;
use PhpParser\Node;
use PhpParser\Node\Expr\StaticCall;
use PHPStan\Analyser\Scope;
use PHPStan\Rules\Rule;
class FacadeRule implements Rule
{
private const ALLOWED_FACADES = ['Cache', 'Log', 'parent', 'self'];
public function getNodeType(): string
{
return StaticCall::class;
}
public function processNode(Node $node, Scope $scope): array
{
if (!$node instanceof StaticCall) {
return [];
}
if (!$node->class instanceof \PhpParser\Node\Name) {
return [];
}
$className = $node->class->toString();
// Check if it's likely a facade
$parts = $node->class->getParts();
if (strpos($className, 'Illuminate\\Support\\Facades\\') === 0 || count($parts) === 1) {
$facadeName = count($parts) === 1 ? $parts[0] : end($parts);
if (!in_array($facadeName, self::ALLOWED_FACADES)) {
return [
"Only Cache:: and Log:: facades are allowed. Consider using dependency injection or helpers instead of {$facadeName}::."
];
}
}
return [];
}
}