Iran has declared the Strait of Hormuz closed, warning that any vessel attempting to pass through would be targeted.