php8.1: do not resolve reserved name never
in NamespaceResolver
This commit is contained in:
parent
9281143091
commit
e3aaf7bd13
@ -372,6 +372,8 @@ func (ns *Namespace) ResolveName(nameNode ast.Vertex, aliasType string) (string,
|
||||
case "object":
|
||||
fallthrough
|
||||
case "mixed": // 8.0
|
||||
fallthrough
|
||||
case "never": // 8.1
|
||||
return part, nil
|
||||
}
|
||||
}
|
||||
|
@ -861,6 +861,12 @@ func TestDoNotResolveReservedNames(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
nameNever := &ast.Name{
|
||||
Parts: []ast.Vertex{
|
||||
&ast.NamePart{Value: []byte("never")},
|
||||
},
|
||||
}
|
||||
|
||||
function := &ast.StmtFunction{
|
||||
Name: &ast.Identifier{Value: []byte("bar")},
|
||||
Params: []ast.Vertex{
|
||||
@ -912,6 +918,12 @@ func TestDoNotResolveReservedNames(t *testing.T) {
|
||||
Name: &ast.Identifier{Value: []byte("Mixed")},
|
||||
},
|
||||
},
|
||||
&ast.Parameter{
|
||||
Type: nameNever,
|
||||
Var: &ast.ExprVariable{
|
||||
Name: &ast.Identifier{Value: []byte("Never")},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@ -938,6 +950,7 @@ func TestDoNotResolveReservedNames(t *testing.T) {
|
||||
nameIterable: "iterable",
|
||||
nameObject: "object",
|
||||
nameMixed: "mixed",
|
||||
nameNever: "never",
|
||||
}
|
||||
|
||||
nsResolver := nsresolver.NewNamespaceResolver()
|
||||
|
Loading…
Reference in New Issue
Block a user