Skip to content

Commit a6e42bd

Browse files
X2NXchr-hertel
authored andcommitted
fix: because the cached discoveryState does not use ->setDiscoveryState(), it is found that the discoveryState cannot be used
1 parent e5a4cb5 commit a6e42bd

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

src/Capability/Discovery/Discoverer.php

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,7 @@ public function discover(string $basePath, array $directories, array $excludeDir
9595
'base_path' => $basePath,
9696
]);
9797

98-
$emptyState = new DiscoveryState();
99-
$this->registry->setDiscoveryState($emptyState);
100-
101-
return $emptyState;
98+
return new DiscoveryState();
10299
}
103100

104101
$finder->files()
@@ -125,11 +122,7 @@ public function discover(string $basePath, array $directories, array $excludeDir
125122
'resourceTemplates' => $discoveredCount['resourceTemplates'],
126123
]);
127124

128-
$discoveryState = new DiscoveryState($tools, $resources, $prompts, $resourceTemplates);
129-
130-
$this->registry->setDiscoveryState($discoveryState);
131-
132-
return $discoveryState;
125+
return new DiscoveryState($tools, $resources, $prompts, $resourceTemplates);
133126
}
134127

135128
/**

src/Capability/Registry/Loader/DiscoveryLoader.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ public function load(ReferenceRegistryInterface $registry): void
4444
? new CachedDiscoverer($discoverer, $this->cache, $this->logger)
4545
: $discoverer;
4646

47-
$cachedDiscoverer->discover($this->basePath, $this->scanDirs, $this->excludeDirs);
47+
$discoveryState = $cachedDiscoverer->discover($this->basePath, $this->scanDirs, $this->excludeDirs);
48+
49+
$registry->setDiscoveryState($discoveryState);
4850
}
4951
}

0 commit comments

Comments
 (0)