File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed
Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change 55namespace Temporal \Common \EnvConfig \Client ;
66
77use Internal \Toml \Toml ;
8+ use Temporal \Common \EnvConfig \Exception \TomlParserNotFoundException ;
89
910/**
1011 * TOML configuration parser for Temporal client profiles.
@@ -57,6 +58,7 @@ public function __construct(
5758 string $ toml ,
5859 private readonly bool $ strict = true ,
5960 ) {
61+ \class_exists (Toml::class) or throw new TomlParserNotFoundException ();
6062 $ data = Toml::parseToArray ($ toml );
6163 $ this ->profiles = $ this ->parseProfiles ($ data ['profile ' ] ?? []);
6264 }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace Temporal \Common \EnvConfig \Exception ;
6+
7+ /**
8+ * Thrown when the TOML parser package is not found.
9+ */
10+ final class TomlParserNotFoundException extends ConfigException
11+ {
12+ public function __construct ()
13+ {
14+ parent ::__construct (
15+ 'The package for parsing TOML files "internal/toml" is not found. ' .
16+ 'Please install it via Composer: `composer require internal/toml`. ' ,
17+ );
18+ }
19+ }
You can’t perform that action at this time.
0 commit comments