File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed
src/Symfony/Component/Validator/Constraints Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change 12
12
namespace Symfony \Component \Validator \Constraints ;
13
13
14
14
use Symfony \Component \Validator \Constraint ;
15
+ use Symfony \Component \Validator \Exception \LogicException ;
16
+ use Symfony \Component \Yaml \Parser ;
15
17
16
18
#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE )]
17
19
class Yaml extends Constraint
@@ -28,6 +30,10 @@ public function __construct(
28
30
?array $ groups = null ,
29
31
mixed $ payload = null ,
30
32
) {
33
+ if (!class_exists (Parser::class)) {
34
+ throw new LogicException ('The Yaml component is required to use the Yaml constraint. Try running "composer require symfony/yaml". ' );
35
+ }
36
+
31
37
parent ::__construct (null , $ groups , $ payload );
32
38
}
33
39
}
You can’t perform that action at this time.
0 commit comments