You must do this in a hook_form_FORM_ID_alter().
You wouldn't use hook_form_alter() unless you are checking on a dynamic form ID. In this case it's better to use hook_form_FORM_ID_alter().
The reason for this, is that hook_form_alter() is called on every form render and hook_form_FORM_ID_alter() is only called when that specific form is being rendered.
The package that triggers the error is drupalcommerce/project-base. If you check the composer information for that package you see:
As you see, it requires PHP 7.0.8 or higher. You have ...
You can do that by Implements hook_form_BASE_FORM_ID_alter but that would allow passing the step if the user enters any random string inside the coupon field.
To avoid this confusion you need to use the form alter to make coupon field required and also add custom validation to check if the coupon is valid.
if the coupon is not valid, then the user will ...