Skip to content

Commit c13df4d

Browse files
committed
[Workflow] improve workflow config validation
1 parent e493a1b commit c13df4d

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -258,13 +258,12 @@ private function addWorkflowSection(ArrayNodeDefinition $rootNode)
258258
->end()
259259
->end()
260260
->validate()
261-
->always(function ($v) {
262-
if (isset($v['type']) && isset($v['service'])) {
263-
throw new \InvalidArgumentException('"type" and "service" could not be used together.');
264-
}
265-
266-
return $v;
267-
})
261+
->ifTrue(function ($v) { return isset($v['type']) && isset($v['service']); })
262+
->thenInvalid('"type" and "service" cannot be used together.')
263+
->end()
264+
->validate()
265+
->ifTrue(function ($v) { return isset($v['arguments']) && isset($v['service']); })
266+
->thenInvalid('"arguments" and "service" cannot be used together.')
268267
->end()
269268
->end()
270269
->arrayNode('supports')

0 commit comments

Comments
 (0)