diff --git a/src/linter/block_linter.go b/src/linter/block_linter.go index c0542c05..1fa947d8 100644 --- a/src/linter/block_linter.go +++ b/src/linter/block_linter.go @@ -1538,22 +1538,24 @@ func (b *blockLinter) metaInfo() *meta.Info { func (b *blockLinter) checkDeclareStrictTypes(statement *ir.DeclareStmt) { for _, i := range statement.Consts { - switch node := i.(type) { - case *ir.ConstantStmt: - if node.ConstantName.Value != "strict_types" { - return - } - value, ok := node.Expr.(*ir.Lnumber) - if !ok { - return - } + node, ok := i.(*ir.ConstantStmt) + if !ok { + return + } - if value.Value == "1" { - return - } + if node.ConstantName.Value != "strict_types" { + return + } + value, isNumber := node.Expr.(*ir.Lnumber) + if !isNumber { + return + } - b.report(statement, LevelError, "notStrictTypes", "strict_types value is not 1") - b.walker.r.addQuickFix("notStrictTypes", b.quickfix.StrictTypes(value)) + if value.Value == "1" { + return } + + b.report(statement, LevelError, "notStrictTypes", "strict_types value is not 1") + b.walker.r.addQuickFix("notStrictTypes", b.quickfix.StrictTypes(value)) } }