Skip to content

Commit 975e899

Browse files
committed
Avoid deprecation warning for static properties
Use ReflectionClass::setStaticPropertyValue to set static properties Bug: T352060 Change-Id: Ifed1422cc985e608f886192224e6611477827e36
1 parent 975c15c commit 975e899

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/TestingAccessWrapper.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,12 @@ public function __set( $name, $value ) {
127127
. ': Cannot set non-static property when wrapping static class' );
128128
}
129129

130-
$propertyReflection->setValue( $this->object, $value );
130+
if ( $this->isStatic() ) {
131+
$class = new ReflectionClass( $this->object );
132+
$class->setStaticPropertyValue( $name, $value );
133+
} else {
134+
$propertyReflection->setValue( $this->object, $value );
135+
}
131136
}
132137

133138
/**

0 commit comments

Comments
 (0)