version = "1" php-version = "8.2" [source] paths = ["src", "tests"] includes = ["vendor"] [formatter] empty-line-after-opening-tag = false [linter.rules] # 库需兼容 PHP >= 7.2,禁用依赖高版本语法的规则 # 数字字面量下划线分隔符需 PHP 7.4+,库不可用 readable-literal = { enabled = false } # 文件系统尽力操作(清理、锁竞争兜底)有意使用 @ 抑制警告 no-error-control-operator = { enabled = false } too-many-methods = { threshold = 30 } too-many-properties = { threshold = 15 } cyclomatic-complexity = { threshold = 100 } literal-named-argument = { enabled = false } prefer-arrow-function = { enabled = false } strict-types = { enabled = false } # 遗留代码风格,不做强制 no-empty = { enabled = false } no-isset = { enabled = false } no-shorthand-ternary = { enabled = false } # 示例配置中的占位密钥、测试中的 fake 凭证均为误报 no-literal-password = { exclude = ["src/config", "tests"] } # 阈值放宽(AdapterAbstract 承担分片上传公共能力后方法/复杂度上升) kan-defect = { threshold = 4.0 } halstead = { effort-threshold = 20000 } [analyzer] find-unused-expressions = true analyze-dead-code = true # 遗留代码缺少类型标注,mixed 类检查噪音过大 ignore = [ "invalid-destructuring-source", # 七牛 SDK 返回 [ret, err] 无类型标注 "invalid-member-selector", # Storage::__callStatic 动态方法转发 "mismatched-array-index", # 七牛 SDK putFile docblock 标注有误 "mixed-argument", "mixed-array-access", "mixed-assignment", "mixed-method-access", "mixed-operand", "mixed-property-type-coercion", "mixed-return-statement", "possible-method-access-on-null", # webman request() 等 helper 无返回类型标注 "possibly-false-argument", "too-many-arguments", # OSS SDK 构造函数使用 func_get_args "unknown-class-instantiation", # Storage::disk 按配置动态实例化适配器 ]