File tree Expand file tree Collapse file tree
src/TypeSystem/Scope/ModuleScope
test/Unit/TypeSystem/Scope/ModuleScope Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -33,13 +33,13 @@ final class ModuleScope implements ScopeInterface
3333 public function __construct (
3434 private readonly LoaderInterface $ loader ,
3535 private readonly ModuleNode $ moduleNode ,
36- private readonly ? ScopeInterface $ parentScope
36+ private readonly ScopeInterface $ parentScope
3737 ) {
3838 }
3939
4040 public function lookupTypeFor (string $ name ): ?TypeInterface
4141 {
42- return $ this ->parentScope ? ->lookupTypeFor($ name ) ?? null ;
42+ return $ this ->parentScope ->lookupTypeFor ($ name );
4343 }
4444
4545 public function resolveTypeReference (TypeReferenceNode $ typeReferenceNode ): TypeInterface
@@ -48,10 +48,6 @@ public function resolveTypeReference(TypeReferenceNode $typeReferenceNode): Type
4848 return $ this ->loader ->resolveTypeOfImport ($ importNode );
4949 }
5050
51- if ($ this ->parentScope ) {
52- return $ this ->parentScope ->resolveTypeReference ($ typeReferenceNode );
53- }
54-
55- throw new \Exception ('@TODO: Unknown Type ' . $ typeReferenceNode ->name );
51+ return $ this ->parentScope ->resolveTypeReference ($ typeReferenceNode );
5652 }
5753}
Original file line number Diff line number Diff line change 2727use PackageFactory \ComponentEngine \Test \Unit \Module \Loader \Fixtures \DummyLoader ;
2828use PackageFactory \ComponentEngine \Test \Unit \TypeSystem \Scope \Fixtures \DummyScope ;
2929use PackageFactory \ComponentEngine \TypeSystem \Scope \ModuleScope \ModuleScope ;
30- use PackageFactory \ComponentEngine \TypeSystem \Scope \GlobalScope \GlobalScope ;
3130use PackageFactory \ComponentEngine \TypeSystem \TypeInterface ;
3231use PHPUnit \Framework \TestCase ;
3332
@@ -55,7 +54,7 @@ public function resolvesTypeReferencesForModuleImports(): void
5554 ],
5655 ]),
5756 moduleNode: $ moduleNode ,
58- parentScope: null
57+ parentScope: new DummyScope ()
5958 );
6059
6160 $ this ->assertSame (
@@ -100,4 +99,4 @@ public function fallsBackToParentScopeWhenProvidingTypesForValues(): void
10099 $ moduleScope ->lookupTypeFor ('foo ' )
101100 );
102101 }
103- }
102+ }
You can’t perform that action at this time.
0 commit comments