From 00ea0afa643b3b4383a5cd1a322656c989ade498 Mon Sep 17 00:00:00 2001 From: David Grudl Date: Wed, 20 Sep 2023 13:54:43 +0200 Subject: [PATCH] Option 'class' is allowed again Partially reverts commit 046f89cc334ec08b6b2e04803bce011bbe6522f1. --- src/DI/Extensions/DefinitionSchema.php | 3 +-- tests/DI/files/compiler.services.create.neon | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/DI/Extensions/DefinitionSchema.php b/src/DI/Extensions/DefinitionSchema.php index e2f28c75b..77146ebd0 100644 --- a/src/DI/Extensions/DefinitionSchema.php +++ b/src/DI/Extensions/DefinitionSchema.php @@ -108,11 +108,10 @@ public function normalize($def, Context $context) if ( isset($def['class']) && !isset($def['type']) - && !isset($def['create']) && !isset($def['dynamic']) && !isset($def['imported']) ) { - $def['create'] = $def['class']; + $def[isset($def['create']) ? 'type' : 'create'] = $def['class']; unset($def['class']); } diff --git a/tests/DI/files/compiler.services.create.neon b/tests/DI/files/compiler.services.create.neon index 2b87a94e0..d86fdb440 100644 --- a/tests/DI/files/compiler.services.create.neon +++ b/tests/DI/files/compiler.services.create.neon @@ -23,7 +23,7 @@ services: factory: %class%(1) three: - type: Lorem + class: Lorem factory: Factory::createLorem arguments: [1, 2]