@@ -34,7 +34,7 @@ final class Factory
3434 public function __construct (
3535 ?ContainerInterface $ container = null ,
3636 array $ definitions = [],
37- private bool $ validate = true
37+ private bool $ validate = true ,
3838 ) {
3939 $ this ->validateDefinitions ($ definitions );
4040 $ this ->internalContainer = new FactoryInternalContainer ($ container , $ definitions );
@@ -54,21 +54,6 @@ public function withDefinitions(array $definitions): self
5454 return $ new ;
5555 }
5656
57- /**
58- * @param array $definitions Definitions to validate.
59- * @psalm-param array<string, mixed> $definitions
60- *
61- * @throws InvalidConfigException
62- */
63- private function validateDefinitions (array $ definitions ): void
64- {
65- if ($ this ->validate ) {
66- foreach ($ definitions as $ id => $ definition ) {
67- DefinitionValidator::validate ($ definition , $ id );
68- }
69- }
70- }
71-
7257 /**
7358 * Creates a new object using the given configuration.
7459 *
@@ -140,6 +125,21 @@ public function create(mixed $config): mixed
140125 return $ this ->internalContainer ->create ($ definition );
141126 }
142127
128+ /**
129+ * @param array $definitions Definitions to validate.
130+ * @psalm-param array<string, mixed> $definitions
131+ *
132+ * @throws InvalidConfigException
133+ */
134+ private function validateDefinitions (array $ definitions ): void
135+ {
136+ if ($ this ->validate ) {
137+ foreach ($ definitions as $ id => $ definition ) {
138+ DefinitionValidator::validate ($ definition , $ id );
139+ }
140+ }
141+ }
142+
143143 /**
144144 * @throws InvalidConfigException
145145 */
@@ -155,7 +155,7 @@ private function createDefinition(mixed $config): DefinitionInterface
155155 ) {
156156 $ definition = $ this ->mergeDefinitions (
157157 $ containerDefinition ,
158- $ definition
158+ $ definition,
159159 );
160160 }
161161
0 commit comments