In the bible the following is stated
Matthew 2 verse 12-15
[12] And being warned of God in a dream that they should not return to Herod, they departed into their own country another way.
[13] And when they were departed, behold, the angel of the Lord appeareth to Joseph in a dream, saying...