From 4a67d0484dc5693221802c3deed9d53c850a733f Mon Sep 17 00:00:00 2001 From: Guy Sartorelli <36352093+GuySartorelli@users.noreply.github.com> Date: Wed, 11 Sep 2024 12:15:53 +1200 Subject: [PATCH] MNT Resolve deprecation warning in test (#602) --- tests/Schema/IntegrationTest.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/Schema/IntegrationTest.php b/tests/Schema/IntegrationTest.php index c563abe4..8739567d 100644 --- a/tests/Schema/IntegrationTest.php +++ b/tests/Schema/IntegrationTest.php @@ -43,7 +43,7 @@ use GraphQL\Validator\Rules\QueryComplexity; use GraphQL\Validator\Rules\QueryDepth; use GraphQL\Validator\ValidationContext; -use ReflectionProperty; +use ReflectionClass; class IntegrationTest extends SapphireTest { @@ -1688,11 +1688,10 @@ public function testGlobalRuleNotRemoved() private function removeDocumentValidatorRule(string $ruleName): void { - $reflectionRules = new ReflectionProperty(DocumentValidator::class, 'rules'); - $reflectionRules->setAccessible(true); - $rules = $reflectionRules->getValue(); + $reflectionRules = new ReflectionClass(DocumentValidator::class); + $rules = $reflectionRules->getStaticPropertyValue('rules'); unset($rules[$ruleName]); - $reflectionRules->setValue($rules); + $reflectionRules->setStaticPropertyValue('rules', $rules); } private function createProviderForComplexityOrDepth(int $limit): array