The literary device used to describe Johnny’s mugging is idiom.
When Ponyboy is walking home, he is thinking about how his friend Johnny got jumped when he was sixteen. Johnny is a greaser like Ponyboy. He was jumped by a group called the Socs, or the socialites—the rich kids.
I had never been jumped, but I had seen Johnny after four Socs got hold of him, and it wasn't pretty. Johnny was scared of his own shadow after that. (ch 1, p. 4)
An idiom is a figure of speech that uses a metaphor or simile, but is so commonly used that it has entered into regular speech. Since it is a common expression, people usually know what it means. In this case, being afraid of one’s shadow means that someone is particularly nervous or jumpy. Johnny is jumpy due to the fact that he was jumped.
Johnny’s jumpiness foreshadows the fight he will have later with the Socs when he kills one of them and has to go on the run.