When you first buy any phone or tablet the manufacture of these devices recommends that you charge the device for at least 8 hours before using it. Normally the battery in the device will have a small charge already, this makes it possible for you to set up your phone and get it configured.
The major reason for charging your battery for 8 hours is to condition your battery so it last longer. There is a lot of talk about battery life and how you can make your battery last longer. With a new battery, it is a good practice to charge it for 8 hours when you first receive your new phone. Afterward, run the battery down to almost nothing and charge it again. Do this 3 or 4 times to condition your battery. This normally makes a battery last longer.
As for charging your phone overnight, most people do this. However, I do know quite a few people who have done this and burned up their motherboard in the phone. On cheaper models of a smartphone these days it seems that if they leave the phone charging for more than 10 hours their phones stop working or have a problem with the motherboard.
The more expensive smartphone don't have an issue with the battery charging and heating up the motherboard in the phone. However, many people manufacture cheaper smartphones and they don't have the same quality battery or motherboard inside the phone. Some of these phones have issues with leaving the phone on a charger for extended periods of time.
I would say that it depends on who manufactured your phone and when you take your phone off the charger is the phone hot. Does your charger feel warm to the touch? If this is the case, then no don't charge it overnight. I have left my phone charging overnight and into the morning. I've never had an issue with my phone ever. However, I own an iPhone 8 plus and it is a good quality phone and can support the phone charging overnight.