Validation on addtocart variants

I’d like to customise the way configurable products are added to the cart but I can’t find where the validation happens when I press the ‘add to basket’ button. I get ‘This value is not valid.’ if I try and add a variant combination that isn’t listed ‘list variant’ on the admin side, but I dont know where this is checked/validated. It seems to be a constraint on CartItemType/form->isValid() but I can’t find where!

Can anyone tell me which file this is checked in.

Thanks