For comparison purposes, here's the PA stand your ground/castle doctrine statute. The most relevant portions are in red and bolded. There is also another statute that provides civil immunity for using force under this law.
As
RB quite correctly stated above, the PA law that governs police use of force is not substantially different in the core principles from this one. It just specifically addresses the issue of using force in an arrest or to prevent escape, suicide, etc.
18 Pa.C.S.A. § 505
(a) Use of force justifiable for protection of the person.--The use of force upon or toward another person is justifiable when the actor believes that such force is immediately necessary for the purpose of protecting himself against the use of unlawful force by such other person on the present occasion.
(b) Limitations on justifying necessity for use of force.--
(1) The use of force is not justifiable under this section:
(i) to resist an arrest which the actor knows is being made by a peace officer, although the arrest is unlawful; or
(ii) to resist force used by the occupier or possessor of property or by another person on his behalf, where the actor knows that the person using the force is doing so under a claim of right to protect the property, except that this limitation shall not apply if:
(A) the actor is a public officer acting in the performance of his duties or a person lawfully assisting him therein or a person making or assisting in a lawful arrest;
(B) the actor has been unlawfully dispossessed of the property and is making a reentry or recaption justified by section 507 of this title (relating to use of force for the protection of property); or
(C) the actor believes that such force is necessary to protect himself against death or serious bodily injury.
(2) The use of deadly force is not justifiable under this section unless the actor believes that such force is necessary to protect himself against death, serious bodily injury, kidnapping or sexual intercourse compelled by force or threat; nor is it justifiable if:
(i) the actor, with the intent of causing death or serious bodily injury, provoked the use of force against himself in the same encounter; or
(ii) the actor knows that he can avoid the necessity of using such force with complete safety by retreating, except the actor is not obliged to retreat from his dwelling or place of work, unless he was the initial aggressor or is assailed in his place of work by another person whose place of work the actor knows it to be.
(2.1) Except as otherwise provided in paragraph (2.2), an actor is presumed to have a reasonable belief that deadly force is immediately necessary to protect himself against death, serious bodily injury, kidnapping or sexual intercourse compelled by force or threat if both of the following conditions exist:
(i) The person against whom the force is used is in the process of unlawfully and forcefully entering, or has unlawfully and forcefully entered and is present within, a dwelling, residence or occupied vehicle; or the person against whom the force is used is or is attempting to unlawfully and forcefully remove another against that other's will from the dwelling, residence or occupied vehicle.
(ii) The actor knows or has reason to believe that the unlawful and forceful entry or act is occurring or has occurred.
(2.2) The presumption set forth in paragraph (2.1) does not apply if:
(i) the person against whom the force is used has the right to be in or is a lawful resident of the dwelling, residence or vehicle, such as an owner or lessee;
(ii) the person sought to be removed is a child or grandchild or is otherwise in the lawful custody or under the lawful guardianship of the person against whom the protective force is used;
(iii) the actor is engaged in a criminal activity or is using the dwelling, residence or occupied vehicle to further a criminal activity; or
(iv) the person against whom the force is used is a peace officer acting in the performance of his official duties and the actor using force knew or reasonably should have known that the person was a peace officer.
(2.3) An actor who is not engaged in a criminal activity, who is not in illegal possession of a firearm and who is attacked in any place where the actor would have a duty to retreat under paragraph (2)(ii) has no duty to retreat and has the right to stand his ground and use force, including deadly force, if:
(i) the actor has a right to be in the place where he was attacked;
(ii) the actor believes it is immediately necessary to do so to protect himself against death, serious bodily injury, kidnapping or sexual intercourse by force or threat; and
(iii) the person against whom the force is used displays or otherwise uses:
(A) a firearm or replica of a firearm as defined in 42 Pa.C.S. § 9712 (relating to sentences for offenses committed with firearms); or
(B) any other weapon readily or apparently capable of lethal use.
(2.4) The exception to the duty to retreat set forth under paragraph (2.3) does not apply if the person against whom the force is used is a peace officer acting in the performance of his official duties and the actor using force knew or reasonably should have known that the person was a peace officer.
(2.5) Unless one of the exceptions under paragraph (2.2) applies, a person who unlawfully and by force enters or attempts to enter an actor's dwelling, residence or occupied vehicle or removes or attempts to remove another against that other's will from the actor's dwelling, residence or occupied vehicle is presumed to be doing so with the intent to commit:
(i) an act resulting in death or serious bodily injury; or
(ii) kidnapping or sexual intercourse by force or threat.
(2.6) A public officer justified in using force in the performance of his duties or a person justified in using force in his assistance or a person justified in using force in making an arrest or preventing an escape is not obliged to desist from efforts to perform such duty, effect such arrest or prevent such escape because of resistance or threatened resistance by or on behalf of the person against whom such action is directed.
(3) Except as otherwise required by this subsection, a person employing protective force may estimate the necessity thereof under the circumstances as he believes them to be when the force is used, without retreating, surrendering possession, doing any other act which he has no legal duty to do or abstaining from any lawful action.
(c) Use of confinement as protective force.--The justification afforded by this section extends to the use of confinement as protective force only if the actor takes all reasonable measures to terminate the confinement as soon as he knows that he safely can, unless the person confined has been arrested on a charge of crime.
(d) Definition.--As used in this section, the term “criminal activity” means conduct which is a misdemeanor or felony, is not justifiable under this chapter and is related to the confrontation between an actor and the person against whom force is used.