@@ -52,21 +52,28 @@ final class Configuration
5252 *
5353 * @var list<IncludeConfiguration>
5454 */
55- public private(set) array $ build ;
55+ public private(set) array $ build = [] ;
5656
5757 /**
5858 * PHP INI settings to be applied during compilation.
5959 *
6060 * @var array<non-empty-string, scalar>
6161 */
62- public private(set) array $ ini ;
62+ public private(set) array $ ini = [] ;
6363
6464 /**
6565 * List of mount directories.
6666 *
6767 * @var list<non-empty-string>
6868 */
69- public private(set) array $ mount ;
69+ public private(set) array $ mount = [];
70+
71+ /**
72+ * List of required compile target PHP extensions.
73+ *
74+ * @var list<non-empty-string>
75+ */
76+ public private(set) array $ extensions = [];
7077
7178 /**
7279 * List of compilation targets.
@@ -195,9 +202,6 @@ final class Configuration
195202 }
196203
197204 /**
198- * @param iterable<mixed, IncludeConfiguration> $build
199- * @param iterable<non-empty-string, scalar> $ini
200- * @param iterable<mixed, non-empty-string> $mount
201205 * @param non-empty-string|null $output
202206 * @param non-empty-string|null $root
203207 */
@@ -216,14 +220,8 @@ public function __construct(
216220 public private(set ) string $ boxVersion = self ::DEFAULT_BOX_VERSION ,
217221 ?string $ output = self ::DEFAULT_BUILD_DIRECTORY ,
218222 ?string $ root = self ::DEFAULT_APP_DIRECTORY ,
219- iterable $ build = [],
220- iterable $ ini = [],
221- iterable $ mount = [],
222223 public private(set ) int $ timestamp = \PHP_INT_MAX ,
223224 ) {
224- $ this ->build = \iterator_to_array ($ build , false );
225- $ this ->ini = \iterator_to_array ($ ini , true );
226- $ this ->mount = \iterator_to_array ($ mount , false );
227225 $ this ->output = $ output ;
228226 $ this ->root = $ root ;
229227 }
@@ -349,6 +347,20 @@ public function withAddedTarget(TargetInterface $target): self
349347 return $ self ;
350348 }
351349
350+ /**
351+ * Returns copy of an instance with an additional required compilation
352+ * target PHP extension.
353+ *
354+ * @param non-empty-string $extension
355+ */
356+ public function withAddedExtension (string $ extension ): self
357+ {
358+ $ self = clone $ this ;
359+ $ self ->extensions [] = $ extension ;
360+
361+ return $ self ;
362+ }
363+
352364 /**
353365 * Returns copy of an instance with an additional config's timestamp.
354366 */
0 commit comments