diff --git a/src/Configuration.php b/src/Configuration.php index 6294367..a1bb57d 100644 --- a/src/Configuration.php +++ b/src/Configuration.php @@ -17,7 +17,6 @@ use Dflydev\DotAccessData\DataInterface; use Dflydev\DotAccessData\Exception\DataException; use Dflydev\DotAccessData\Exception\InvalidPathException; -use Dflydev\DotAccessData\Exception\MissingPathException; use League\Config\Exception\UnknownOptionException; use League\Config\Exception\ValidationException; use Nette\Schema\Expect; @@ -117,7 +116,7 @@ public function get(string $key) $this->build(self::getTopLevelKey($key)); return $this->cache[$key] = $this->finalConfig->get($key); - } catch (InvalidPathException | MissingPathException $ex) { + } catch (InvalidPathException $ex) { throw new UnknownOptionException($ex->getMessage(), $key, (int) $ex->getCode(), $ex); } } @@ -187,10 +186,11 @@ private function build(string $topLevelKey): void $processor = new Processor(); $processed = $processor->process(Expect::structure([$topLevelKey => $schema]), $userData); + \assert($processed instanceof \stdClass); $this->raiseAnyDeprecationNotices($processor->getWarnings()); - $this->finalConfig->import((array) self::convertStdClassesToArrays($processed)); + $this->finalConfig->import(self::convertStdClassesToArrays($processed)); } catch (NetteValidationException $ex) { throw new ValidationException($ex); }