original_string: protected static function isValidValue(TypeInterface $type, $value)
      {
          if ($type instanceof NonNullModifier) {
              if (NULL === $value) {
                  return FALSE;
              }
  
              return self::isValidValue($type->getWrappedType(), $value);
          }
  
          if ($value === NULL) {
              return TRUE;
          }
  
          if ($type instanceof ListModifier) {
              $itemType = $type->getWrappedType();
              if (is_array($value)) {
                  foreach ($value as $item) {
                      if (!self::isValidValue($itemType, $item)) {
                          return FALSE;
                      }
                  }
  
                  return TRUE;
              } else {
                  return self::isValidValue($itemType, $value);
              }
          }
  
          if ($type instanceof InputObjectType) {
              $fields = $type->getFields();
              foreach ($fields as $fieldName => $field) {
                  if (!self::isValidValue($field->getType(), isset($value[$fieldName]) ? $value[$fieldName] : NULL)) {
                      return FALSE;
                  }
              }
  
              return TRUE;
          }
  
          if ($type instanceof ScalarType || $type instanceof EnumType) {
              return NULL !== $type->coerce($value);
          }
  
          return FALSE;
      }
code: protected static function isValidValue(TypeInterface $type, $value)
      {
          if ($type instanceof NonNullModifier) {
              if (NULL === $value) {
                  return FALSE;
              }
  
              return self::isValidValue($type->getWrappedType(), $value);
          }
  
          if ($value === NULL) {
              return TRUE;
          }
  
          if ($type instanceof ListModifier) {
              $itemType = $type->getWrappedType();
              if (is_array($value)) {
                  foreach ($value as $item) {
                      if (!self::isValidValue($itemType, $item)) {
                          return FALSE;
                      }
                  }
  
                  return TRUE;
              } else {
                  return self::isValidValue($itemType, $value);
              }
          }
  
          if ($type instanceof InputObjectType) {
              $fields = $type->getFields();
              foreach ($fields as $fieldName => $field) {
                  if (!self::isValidValue($field->getType(), isset($value[$fieldName]) ? $value[$fieldName] : NULL)) {
                      return FALSE;
                  }
              }
  
              return TRUE;
          }
  
          if ($type instanceof ScalarType || $type instanceof EnumType) {
              return NULL !== $type->coerce($value);
          }
  
          return FALSE;
      }
code_tokens: protected static function isValidValue ( TypeInterface $ type , $ value ) { if ( $ type instanceof NonNullModifier ) { if ( NULL === $ value ) { return FALSE ; } return self :: isValidValue ( $ type -> getWrappedType ( ) , $ value ) ; } if ( $ value === NULL ) { return TRUE ; } if ( $ type instanceof ListModifier ) { $ itemType = $ type -> getWrappedType ( ) ; if ( is_array ( $ value ) ) { foreach ( $ value as $ item ) { if ( ! self :: isValidValue ( $ itemType , $ item ) ) { return FALSE ; } } return TRUE ; } else { return self :: isValidValue ( $ itemType , $ value ) ; } } if ( $ type instanceof InputObjectType ) { $ fields = $ type -> getFields ( ) ; foreach ( $ fields as $ fieldName => $ field ) { if ( ! self :: isValidValue ( $ field -> getType ( ) , isset ( $ value [ $ fieldName ] ) ? $ value [ $ fieldName ] : NULL ) ) { return FALSE ; } } return TRUE ; } if ( $ type instanceof ScalarType || $ type instanceof EnumType ) { return NULL !== $ type -> coerce ( $ value ) ; } return FALSE ; }
docstring: Given a type and any value, return true if that value is valid.
  
  @param TypeInterface $type
  @param $value
  
  @return bool
docstring_tokens: Given a type and any value return true if that value is valid .