Skip to content

Commit 26a479c

Browse files
committed
Removed cyclic directive dependencies
1 parent ff125eb commit 26a479c

File tree

5 files changed

+3
-91
lines changed

5 files changed

+3
-91
lines changed

src/FloatConstraintDirective.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,6 @@ protected function getFieldDefinition() : ArgumentSet
6060
]);
6161
}
6262

63-
#[\Override]
64-
protected function afterGetFieldDefinition() : void
65-
{
66-
$this->arguments['oneOf']->addDirective(
67-
$this->constraintDirectiveAccessor->getList(),
68-
['minItems' => 1],
69-
);
70-
}
71-
7263
#[\Override]
7364
protected function specificValidateValue(Value $value, ArgumentValueSet $arguments) : void
7465
{

src/IntConstraintDirective.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,6 @@ protected function getFieldDefinition() : ArgumentSet
6060
]);
6161
}
6262

63-
#[\Override]
64-
protected function afterGetFieldDefinition() : void
65-
{
66-
$this->arguments['oneOf']->addDirective(
67-
$this->constraintDirectiveAccessor->getList(),
68-
['minItems' => 1],
69-
);
70-
}
71-
7263
#[\Override]
7364
protected function specificValidateValue(Value $value, ArgumentValueSet $arguments) : void
7465
{

src/StringConstraintDirective.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,6 @@ protected function afterGetFieldDefinition() : void
8383
$this->constraintDirectiveAccessor->getInt(),
8484
['min' => 0],
8585
);
86-
$this->arguments['oneOf']->addDirective(
87-
$this->constraintDirectiveAccessor->getList(),
88-
['minItems' => 1],
89-
);
9086
}
9187

9288
#[\Override]

tests/Integration/ConstructTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,23 +191,23 @@ public function testConstruct() : void
191191
);
192192
self::assertFalse(self::getString()->isRepeatable());
193193

194-
$count = [1, 1, 0, 1];
194+
$count = [1, 1, 0, 0];
195195
$index = 0;
196196

197197
foreach (self::getString()->getArguments() as $argument) {
198198
self::assertCount($count[$index], $argument->getDirectiveUsages());
199199
$index++;
200200
}
201201

202-
$count = [0, 0, 1];
202+
$count = [0, 0, 0];
203203
$index = 0;
204204

205205
foreach (self::getInt()->getArguments() as $argument) {
206206
self::assertCount($count[$index], $argument->getDirectiveUsages());
207207
$index++;
208208
}
209209

210-
$count = [0, 0, 1];
210+
$count = [0, 0, 0];
211211
$index = 0;
212212

213213
foreach (self::getFloat()->getArguments() as $argument) {

tests/Integration/ValidateUsageTest.php

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -263,28 +263,6 @@ protected function getFieldDefinition() : ArgumentSet
263263
$type->accept(new ValidateIntegrityVisitor());
264264
}
265265

266-
public function testEmptyOneOfInt() : void
267-
{
268-
$this->expectException(MinItemsConstraintNotSatisfied::class);
269-
$this->expectExceptionMessage(MinItemsConstraintNotSatisfied::MESSAGE);
270-
271-
$type = new class extends InputType {
272-
protected const NAME = 'ConstraintInput';
273-
274-
protected function getFieldDefinition() : ArgumentSet
275-
{
276-
return new ArgumentSet([
277-
Argument::create(
278-
'arg',
279-
Container::Int(),
280-
)->addDirective(TestSchema::$intConstraint, ['oneOf' => []]),
281-
]);
282-
}
283-
};
284-
285-
$type->accept(new ValidateIntegrityVisitor());
286-
}
287-
288266
public function testInvalidOneOfInt() : void
289267
{
290268
$this->expectException(InvalidValue::class);
@@ -306,28 +284,6 @@ protected function getFieldDefinition() : ArgumentSet
306284
$type->accept(new ValidateIntegrityVisitor());
307285
}
308286

309-
public function testEmptyOneOfFloat() : void
310-
{
311-
$this->expectException(MinItemsConstraintNotSatisfied::class);
312-
$this->expectExceptionMessage(MinItemsConstraintNotSatisfied::MESSAGE);
313-
314-
$type = new class extends InputType {
315-
protected const NAME = 'ConstraintInput';
316-
317-
protected function getFieldDefinition() : ArgumentSet
318-
{
319-
return new ArgumentSet([
320-
Argument::create(
321-
'arg',
322-
Container::Float(),
323-
)->addDirective(TestSchema::$floatConstraint, ['oneOf' => []]),
324-
]);
325-
}
326-
};
327-
328-
$type->accept(new ValidateIntegrityVisitor());
329-
}
330-
331287
public function testInvalidOneOfFloat() : void
332288
{
333289
$this->expectException(InvalidValue::class);
@@ -349,28 +305,6 @@ protected function getFieldDefinition() : ArgumentSet
349305
$type->accept(new ValidateIntegrityVisitor());
350306
}
351307

352-
public function testEmptyOneOfString() : void
353-
{
354-
$this->expectException(MinItemsConstraintNotSatisfied::class);
355-
$this->expectExceptionMessage(MinItemsConstraintNotSatisfied::MESSAGE);
356-
357-
$type = new class extends InputType {
358-
protected const NAME = 'ConstraintInput';
359-
360-
protected function getFieldDefinition() : ArgumentSet
361-
{
362-
return new ArgumentSet([
363-
Argument::create(
364-
'arg',
365-
Container::String(),
366-
)->addDirective(TestSchema::$stringConstraint, ['oneOf' => []]),
367-
]);
368-
}
369-
};
370-
371-
$type->accept(new ValidateIntegrityVisitor());
372-
}
373-
374308
public function testInvalidOneOfString() : void
375309
{
376310
$this->expectException(InvalidValue::class);

0 commit comments

Comments
 (0)