php8: do not resolve reserved name mixed in NamespaceResolver

This commit is contained in:
Tyler Christensen 2023-04-24 12:44:02 -06:00 committed by Laytan Laats
parent 6855357aaa
commit 9281143091
2 changed files with 15 additions and 0 deletions

View File

@ -370,6 +370,8 @@ func (ns *Namespace) ResolveName(nameNode ast.Vertex, aliasType string) (string,
case "iterable":
fallthrough
case "object":
fallthrough
case "mixed": // 8.0
return part, nil
}
}

View File

@ -855,6 +855,12 @@ func TestDoNotResolveReservedNames(t *testing.T) {
},
}
nameMixed := &ast.Name{
Parts: []ast.Vertex{
&ast.NamePart{Value: []byte("mixed")},
},
}
function := &ast.StmtFunction{
Name: &ast.Identifier{Value: []byte("bar")},
Params: []ast.Vertex{
@ -900,6 +906,12 @@ func TestDoNotResolveReservedNames(t *testing.T) {
Name: &ast.Identifier{Value: []byte("Object")},
},
},
&ast.Parameter{
Type: nameMixed,
Var: &ast.ExprVariable{
Name: &ast.Identifier{Value: []byte("Mixed")},
},
},
},
}
@ -925,6 +937,7 @@ func TestDoNotResolveReservedNames(t *testing.T) {
nameVoid: "void",
nameIterable: "iterable",
nameObject: "object",
nameMixed: "mixed",
}
nsResolver := nsresolver.NewNamespaceResolver()