In Shakespeare's Sonnet 18, the narrator tells his beloved that she will live forever if her description is written in "eternal lines" of poetry:
Nor shall Death brag thou wander'st in his shade,
When in eternal lines to time thou growest
These lines use two types of figurative language: personification and metaphor.
Personification is when human qualities are assigned to inanimate beings or objects. In this case, "Death" is not a person, but the poet talks about it as if it were a person who can brag and who casts a shadow when he stands in front of the sun.
Metaphor is a comparison that does not use the words like or as. Here the poet compares someone who is going to die to someone who wanders in the shade of death.
It is not surprising that personification and metaphor are used in the same phrase, because personification really is nothing more than a specific type of metaphor. For example, when we say "The sun was smiling down on the children in the park," we are actually making a comparison; we are saying that the sun was smiling at the children in the park the way a person would smile at them.
Shakespeare uses personification, punning, alliteration, and antithesis in this line, showing the richness of his technique. In personification, a non-human object or an abstract quality is given human attributes. In this case, death is personified by being likened to a person who "brags" and who owns property, probably shaded with trees, in which the beloved will not wander. Shade is a pun, a word with a double meaning. Shakespeare pictures death's abode as a shady place, but shade is also a word for a dead person. Shakespeare is famous for punning, so there's no surprise in this, and through the pun the narrator asserts the beloved will not die. Shall and shade begin with same consonants, "sh," so they provide alliteration. Finally, though it takes us out of the single line per se, this image of death is antithetical, or in opposition to, the image of growth and immortality the narrator posits for the beloved in the next line, when the speaker says the beloved will live forever in the lines of this sonnet.