The ".has-error" class is added to the select2 span element when it is removed from the parent div. Notice in the image below, the select2 span has class ".has-error" while it's parent element has class ".has-success" instead. This may be a race condition, though it has proven to be consistent for me so far.
Steps to reproduce:
Add a select2 widget to an ActiveForm with the clear option enabled
Add Yii2 validation so the select2 field is required
Select an item
Clear the item so the required error appears
Select an item again
At this point, you should see something like the screenshot included if you inspect element.
The ".has-error" class is added to the select2 span element when it is removed from the parent div. Notice in the image below, the select2 span has class ".has-error" while it's parent element has class ".has-success" instead. This may be a race condition, though it has proven to be consistent for me so far.
Steps to reproduce:
At this point, you should see something like the screenshot included if you inspect element.