Skip to content

Commit

Permalink
review fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Hidanio committed Mar 4, 2025
1 parent 87e6a62 commit 20674a8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/linter/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -1050,7 +1050,7 @@ func (b *blockWalker) checkNullSafetyCallArgsF(args []ir.Node, fn meta.FuncInfo)
}

// If there are more arguments than declared and function is not variadic, ignore extra arguments.
if i > len(fn.Params)-1 && !haveVariadic {
if !haveVariadic && i > len(fn.Params)-1 {
return
}

Expand Down
2 changes: 1 addition & 1 deletion src/linter/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -497,12 +497,12 @@ func (d *rootWalker) parseFuncParams(params []ir.Node, docblockParams phpdoctype
minArgs := 0
parsedParams := make([]meta.FuncParam, 0, len(params))
paramHints := make(map[string]types.Map, len(params))
isVariadic := false

if closureSolver != nil && solver.IsClosureUseFunction(closureSolver.Name) {
return d.parseFuncArgsForCallback(params, sc, closureSolver)
}

isVariadic := false
for _, p := range params {
param := p.(*ir.Parameter)
paramVar := param.Variable
Expand Down
8 changes: 1 addition & 7 deletions src/types/predicates.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,10 @@ func IsAlias(s string) bool {
}

func IsTypeNullable(typ Map) bool {
isNullable := false
if typ.m == nil {
return true // We consider that if the type is not inferred, then it is mixed
}
typ.Iterate(func(t string) {
if t == "null" || strings.Contains(t, "mixed") {
isNullable = true
}
})
return isNullable
return typ.Contains("null") || typ.Contains("mixed")
}

func IsTypeMixed(typ Map) bool {
Expand Down

0 comments on commit 20674a8

Please sign in to comment.