First of all we need to understand the real meaning of Sharia law, away from the claimed Sharia of the terrorist groups, and away from the Western media propaganda which gave people an impression that Sharia Law is mainly cutting hands of the thieves and killing the fornicators.
Real Sharia Law is the full comprehensive law which makes human life based on justice and equality to achieve peace and tranquility for individuals and societies.
This Verse has no praise to the person who was with the Prophet in the cave. In fact it has negative points against him.
1. He was feeling sad despite being with the Prophet in the same place, which was wrong feeling and the Prophet told him: Do not grieve. He was wrong in grieving.
2. Allah sent His tranquility on the Prophet only and not on that person which means that he was not entitled to get the tranquility from Allah. Allah mentioned in Quran that: He sent tranquility on the believers. (Al-Fath, 4).
The Barzakh of the prophets and Infallible Imams and their sincere followers is part of Paradise, while the Barzakh of their enemies is part of hellfire. The Hadeeth states: The grave of the believer is a garden from the gardens of the Paradise, and the grave of the non believer is a dig from the digs of Hellfire.
Wassalam