Skip to content

Commit 7c5ac0b

Browse files
committed
Improve StubPhpDocProvider error handling
1 parent 008f324 commit 7c5ac0b

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/PhpDoc/StubPhpDocProvider.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -223,15 +223,17 @@ private function initializeKnownElements(): void
223223

224224
$this->initializing = true;
225225

226-
foreach ($this->stubFiles as $stubFile) {
227-
$nodes = $this->parser->parseFile($stubFile);
228-
foreach ($nodes as $node) {
229-
$this->initializeKnownElementNode($stubFile, $node);
226+
try {
227+
foreach ($this->stubFiles as $stubFile) {
228+
$nodes = $this->parser->parseFile($stubFile);
229+
foreach ($nodes as $node) {
230+
$this->initializeKnownElementNode($stubFile, $node);
231+
}
230232
}
233+
} finally {
234+
$this->initializing = false;
235+
$this->initialized = true;
231236
}
232-
233-
$this->initializing = false;
234-
$this->initialized = true;
235237
}
236238

237239
private function initializeKnownElementNode(string $stubFile, Node $node): void

0 commit comments

Comments
 (0)