diff --git a/pkg/visitor/nsresolver/namespace_resolver.go b/pkg/visitor/nsresolver/namespace_resolver.go index 865b2f4..ac3d847 100644 --- a/pkg/visitor/nsresolver/namespace_resolver.go +++ b/pkg/visitor/nsresolver/namespace_resolver.go @@ -283,6 +283,10 @@ func (nsr *NamespaceResolver) ResolveType(n ast.Vertex) { for _, nnn := range nn.Types { nsr.ResolveType(nnn) } + case *ast.Intersection: + for _, nnn := range nn.Types { + nsr.ResolveType(nnn) + } case *ast.Name: nsr.ResolveName(n, "") diff --git a/pkg/visitor/nsresolver/namespace_resolver_test.go b/pkg/visitor/nsresolver/namespace_resolver_test.go index 8220b56..7f62907 100644 --- a/pkg/visitor/nsresolver/namespace_resolver_test.go +++ b/pkg/visitor/nsresolver/namespace_resolver_test.go @@ -542,6 +542,8 @@ func TestResolveMethodName(t *testing.T) { nameBC := &ast.Name{Parts: []ast.Vertex{&ast.NamePart{Value: []byte("B")}, &ast.NamePart{Value: []byte("C")}}} nameCD := &ast.Name{Parts: []ast.Vertex{&ast.NamePart{Value: []byte("C")}, &ast.NamePart{Value: []byte("D")}}} nameDE := &ast.Name{Parts: []ast.Vertex{&ast.NamePart{Value: []byte("D")}, &ast.NamePart{Value: []byte("E")}}} + nameEF := &ast.Name{Parts: []ast.Vertex{&ast.NamePart{Value: []byte("E")}, &ast.NamePart{Value: []byte("F")}}} + nameFG := &ast.Name{Parts: []ast.Vertex{&ast.NamePart{Value: []byte("F")}, &ast.NamePart{Value: []byte("G")}}} methodNode := &ast.StmtClassMethod{ Name: &ast.Identifier{Value: []byte("A")}, @@ -554,6 +556,10 @@ func TestResolveMethodName(t *testing.T) { Type: &ast.Union{Types: []ast.Vertex{nameCD, nameDE}}, Var: &ast.ExprVariable{Name: &ast.Identifier{Value: []byte("all")}}, }, + &ast.Parameter{ + Type: &ast.Intersection{Types: []ast.Vertex{nameEF, nameFG}}, + Var: &ast.ExprVariable{Name: &ast.Identifier{Value: []byte("any")}}, + }, }, ReturnType: &ast.Nullable{Expr: nameBC}, Stmt: &ast.StmtStmtList{ @@ -566,6 +572,8 @@ func TestResolveMethodName(t *testing.T) { nameBC: "B\\C", nameCD: "C\\D", nameDE: "D\\E", + nameEF: "E\\F", + nameFG: "F\\G", } nsResolver := nsresolver.NewNamespaceResolver()