The detention in Pennsylvania can be regarded as an investigatory stop, a person being detained in other words. If for example, a police officer stops someone walking down the street who's acting suspiciously to ask him or her questions, that would be regarded as a detention. The person isn't free to leave, but they're not under arrest until the police officer were to develop probable cause and were to impose a more significant restriction on the person's movement or freedom. For example, the classic example of a person being handcuffed and advised that they're under arrest.
A detention cannot be any longer than necessary. It needs to be brief and cursory. There's no bright-line rule as to when a detention becomes an arrest. Courts would consider a variety of factors and the totality of the circumstances to determine whether a person was in fact detained or arrested.
An experienced Pennsylvania criminal defense attorney should be in your corner from as early as possible in the process. They'll be your best ally to help you protect and exercise your rights.