The German rules in the BigBox5 from 2014 have this special case included:
Sonderfall: Grenzt ein Spieler eine Wiese komplett durch Straßen oder Stadmauern ein, wird für diese Wiese sofort die Aktion "Herde in den Stall treiben" ausgelöst.
rough translation:
Special case: If a player surrounded a farm completely with roads or city walls, then the action "Herd the flock into the stable" triggers immediately for the shepherds farm.
------------------
That means when a farm is surrounded and "closed" with roads and cities - and it can't expand anymore. Then the score for the shepherd takes place.
The player earns points for the sheep, the sheeps go to the bag and the shepherd goes to the players supply.
-------------------
The English BigBox rule is different than the German rule, because this special case was put in the German rule from the wishes of the correction readers for the German rule - short time before printing.
-------------------
Topic at BGG:
Problem: closed field by an opponentLinkback: https://www.carcassonnecentral.com/community/index.php?topic=2227.0