mirror of
https://github.com/yiisoft/yii2.git
synced 2025-10-29 17:48:15 +08:00
Fix #20482: Fix deprecation of ReflectionMethod::setAccessible() in PHP 8.5
This commit is contained in:
@ -19,7 +19,13 @@ class BaseDataProviderTest extends TestCase
|
||||
{
|
||||
$rc = new \ReflectionClass(BaseDataProvider::className());
|
||||
$rp = $rc->getProperty('counter');
|
||||
$rp->setAccessible(true);
|
||||
|
||||
// @link https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_reflectionsetaccessible
|
||||
// @link https://wiki.php.net/rfc/make-reflection-setaccessible-no-op
|
||||
if (PHP_VERSION_ID < 80100) {
|
||||
$rp->setAccessible(true);
|
||||
}
|
||||
|
||||
$rp->setValue(new ConcreteDataProvider(), null);
|
||||
|
||||
$this->assertNull((new ConcreteDataProvider())->id);
|
||||
|
||||
Reference in New Issue
Block a user