Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Deprecated Functionality: Use of \"parent\" in callables is deprecated in /app/vendor/graycore/magento2-graphql-introspection-cache/Executor/ReferenceExecutor.php on line 22", #9

Open
jburnumHVT opened this issue Aug 2, 2023 · 4 comments

Comments

@jburnumHVT
Copy link

"Deprecated Functionality: Use of "parent" in callables is deprecated in /app/vendor/graycore/magento2-graphql-introspection-cache/Executor/ReferenceExecutor.php on line 22",

@damienwebdev Is this a weird error to be getting or an expected one? The only place I'm seeing it so far is my local environment, but it definitely sounds like an error which we would expect to see everywhere.

@jburnumHVT
Copy link
Author

I'm seeing unclear discussions as to whether this was deprecated in PHP 8.1 or in 8.2. Either way, that seems like evidence for it to be an error we will expect to see everywhere once everywhere gets on a high enough php version.

@jburnumHVT
Copy link
Author

It seems clearer now. The function was deprecated in PHP 8.2. I accidentally updated my local Docker container to run on 8.2, and therefore I'm seeing the error. No one else is, because they're all on 8.1. So this will require updating, but probably not until later.

@damienwebdev
Copy link
Member

@jburnumHVT thanks for the notice. I'll work to get support for v8.2 started!

@IgorsKolcins
Copy link

I've made a patch which works for me with PHP 8.3 and webonyx/graphql-php "15.18.1"

From 7efb5634cafe01453384f4d42a092c6fbfffff10 Mon Sep 17 00:00:00 2001
From: Igors Kolcins <igors.kolcins@gmail.com>
Date: Tue, 3 Dec 2024 15:00:30 +0200
Subject: [PATCH] your message

---
 Executor/ReferenceExecutor.php | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/Executor/ReferenceExecutor.php b/Executor/ReferenceExecutor.php
index a64522b..0aeeb36 100644
--- a/Executor/ReferenceExecutor.php
+++ b/Executor/ReferenceExecutor.php
@@ -4,6 +4,7 @@ namespace Graycore\GraphQlIntrospectionCache\Executor;
 
 use GraphQL\Executor\ExecutionContext;
 use GraphQL\Executor\ExecutionResult;
+use GraphQL\Executor\Executor;
 use GraphQL\Executor\ExecutorImplementation;
 use GraphQL\Executor\Promise\Promise;
 use GraphQL\Executor\Promise\PromiseAdapter;
@@ -17,9 +18,9 @@ use SplObjectStorage;
 
 class ReferenceExecutor extends \GraphQL\Executor\ReferenceExecutor
 {
-    protected function __construct(ExecutionContext $context)
+    public function __construct(ExecutionContext $context)
     {
-        if (is_callable('parent::__construct')) {
+        if (method_exists(parent::class, '__construct')) {
             parent::__construct($context);
         } else {
             $this->setExecutorPrivateProp('UNDEFINED', Utils::undefined(), true);
@@ -43,9 +44,10 @@ class ReferenceExecutor extends \GraphQL\Executor\ReferenceExecutor
         DocumentNode $documentNode,
         $rootValue,
         $contextValue,
-        $variableValues,
+        array $variableValues,
         ?string $operationName,
-        callable $fieldResolver
+        callable $fieldResolver,
+        ?callable $argsMapper = null, // TODO make non-optional in next major release
     ) : ExecutorImplementation {
         $reflectionMethod = new ReflectionMethod(\GraphQL\Executor\ReferenceExecutor::class, 'buildExecutionContext');
         if ($reflectionMethod->isPrivate()) {
@@ -61,7 +63,8 @@ class ReferenceExecutor extends \GraphQL\Executor\ReferenceExecutor
             $variableValues,
             $operationName,
             $fieldResolver,
-            $promiseAdapter
+            $argsMapper ?? Executor::getDefaultArgsMapper(),
+            $promiseAdapter,
         );
 
         if (is_array($exeContext)) {
@@ -84,7 +87,7 @@ class ReferenceExecutor extends \GraphQL\Executor\ReferenceExecutor
 
         return ObjectManager::getInstance()->create(
             ReferenceExecutor::class,
-            ['context' => $exeContext]
+            ['context' => $exeContext],
         );
     }
 }
-- 
2.39.5 (Apple Git-154)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants