88use Jerowork \GraphqlAttributeSchema \Parser \Node \FieldNode ;
99use Jerowork \GraphqlAttributeSchema \Parser \Node \FieldNodeType ;
1010use Jerowork \GraphqlAttributeSchema \Parser \NodeParser \GetTypeTrait ;
11+ use Jerowork \GraphqlAttributeSchema \Parser \NodeParser \IsRequiredTrait ;
1112use Jerowork \GraphqlAttributeSchema \Parser \NodeParser \ParseException ;
1213use Jerowork \GraphqlAttributeSchema \Parser \NodeParser \RetrieveNameForFieldTrait ;
1314use ReflectionClass ;
1920{
2021 use RetrieveNameForFieldTrait;
2122 use GetTypeTrait;
23+ use IsRequiredTrait;
2224
2325 private const array RESERVED_METHOD_NAMES = ['__construct ' ];
2426 private const string RETURN_TYPE_VOID = 'void ' ;
@@ -53,7 +55,7 @@ public function parse(ReflectionClass $class): array
5355 $ this ->getType ($ propertyType , $ fieldAttribute ),
5456 $ fieldAttribute ->name ?? $ property ->getName (),
5557 $ fieldAttribute ->description ,
56- ! $ propertyType -> allowsNull ( ),
58+ $ this -> isRequired ( $ propertyType , $ fieldAttribute ),
5759 [],
5860 FieldNodeType::Property,
5961 null ,
@@ -80,7 +82,7 @@ public function parse(ReflectionClass $class): array
8082 $ this ->getType ($ returnType , $ fieldAttribute ),
8183 $ this ->retrieveNameForField ($ method , $ fieldAttribute ),
8284 $ fieldAttribute ->description ,
83- ! $ returnType -> allowsNull ( ),
85+ $ this -> isRequired ( $ returnType , $ fieldAttribute ),
8486 $ this ->methodArgNodesParser ->parse ($ method ),
8587 FieldNodeType::Method,
8688 $ method ->getName (),
0 commit comments