44
55namespace Graphpinator \ConstraintDirectives ;
66
7+ use Graphpinator \ConstraintDirectives \Exception \AtLeastConstraintNotSatisfied ;
8+ use Graphpinator \ConstraintDirectives \Exception \AtMostConstraintNotSatisfied ;
9+ use Graphpinator \ConstraintDirectives \Exception \ExactlyConstraintNotSatisfied ;
710use Graphpinator \Typesystem \Argument \Argument ;
811use Graphpinator \Typesystem \Argument \ArgumentSet ;
912use Graphpinator \Typesystem \Container ;
@@ -152,31 +155,31 @@ private static function resolveAtLeast(TypeValue|InputValue $value, array $atLea
152155 [$ currentCount , $ notRequested ] = self ::countFieldsType ($ value , $ atLeast );
153156
154157 if ($ currentCount + $ notRequested < $ count ) {
155- throw new Exception \ AtLeastConstraintNotSatisfied ();
158+ throw new AtLeastConstraintNotSatisfied ();
156159 }
157160
158161 return ;
159162 }
160163
161164 if (self ::countFieldsInput ($ value , $ atLeast ) < $ count ) {
162- throw new Exception \ AtLeastConstraintNotSatisfied ();
165+ throw new AtLeastConstraintNotSatisfied ();
163166 }
164167 }
165168
166169 private static function resolveAtMost (TypeValue |InputValue $ value , array $ atMost , int $ count = 1 ) : void
167170 {
168171 if ($ value instanceof TypeValue) {
169- [$ currentCount, $ notRequested ] = self ::countFieldsType ($ value , $ atMost );
172+ [$ currentCount ] = self ::countFieldsType ($ value , $ atMost );
170173
171174 if ($ currentCount > $ count ) {
172- throw new Exception \ AtMostConstraintNotSatisfied ();
175+ throw new AtMostConstraintNotSatisfied ();
173176 }
174177
175178 return ;
176179 }
177180
178181 if (self ::countFieldsInput ($ value , $ atMost ) > $ count ) {
179- throw new Exception \ AtMostConstraintNotSatisfied ();
182+ throw new AtMostConstraintNotSatisfied ();
180183 }
181184 }
182185
@@ -186,14 +189,14 @@ private static function resolveExactly(TypeValue|InputValue $value, array $exact
186189 [$ currentCount , $ notRequested ] = self ::countFieldsType ($ value , $ exactly );
187190
188191 if ($ currentCount > $ count || ($ currentCount + $ notRequested ) < $ count ) {
189- throw new Exception \ ExactlyConstraintNotSatisfied ();
192+ throw new ExactlyConstraintNotSatisfied ();
190193 }
191194
192195 return ;
193196 }
194197
195198 if (self ::countFieldsInput ($ value , $ exactly ) !== $ count ) {
196- throw new Exception \ ExactlyConstraintNotSatisfied ();
199+ throw new ExactlyConstraintNotSatisfied ();
197200 }
198201 }
199202
0 commit comments