File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -607,6 +607,38 @@ final class Second {}
607607 $ this ->assertNotContains ('App\Infrastructure\Service ' , $ nodes [1 ]->dependencies );
608608 }
609609
610+ public function testDoesNotShareNamespaceImportsOrFullyQualifiedDependenciesAcrossNamespaceBlocks (): void
611+ {
612+ $ nodes = $ this ->collectNodes (<<<'PHP'
613+ <?php
614+
615+ namespace App\First {
616+ use App\Infrastructure;
617+
618+ final class First
619+ {
620+ public function __construct(
621+ private Infrastructure\Service $service,
622+ private \App\Infrastructure\Repository $repository,
623+ ) {
624+ }
625+ }
626+ }
627+
628+ namespace App\Second {
629+ final class Second {}
630+ }
631+ PHP);
632+
633+ $ this ->assertCount (2 , $ nodes );
634+ $ this ->assertContains ('App\Infrastructure ' , $ nodes [0 ]->dependencies );
635+ $ this ->assertContains ('App\Infrastructure\Service ' , $ nodes [0 ]->dependencies );
636+ $ this ->assertContains ('App\Infrastructure\Repository ' , $ nodes [0 ]->dependencies );
637+ $ this ->assertNotContains ('App\Infrastructure ' , $ nodes [1 ]->dependencies );
638+ $ this ->assertNotContains ('App\Infrastructure\Service ' , $ nodes [1 ]->dependencies );
639+ $ this ->assertNotContains ('App\Infrastructure\Repository ' , $ nodes [1 ]->dependencies );
640+ }
641+
610642 /**
611643 * @return iterable<string, array{string, list<string>}>
612644 */
You can’t perform that action at this time.
0 commit comments