Skip to content

Commit

Permalink
Merge pull request #1126 from aviator-ua/fix-deprecation-warning
Browse files Browse the repository at this point in the history
Fix Deprecation warning for PHP 8.2
  • Loading branch information
Vincz authored Jul 17, 2023
2 parents d0e1ce2 + 22eb89a commit e1facd3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Controller/ProfilerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\HttpKernel\Profiler\Profiler;
use Symfony\Component\Routing\RouterInterface;
use Twig\Environment;
Expand Down Expand Up @@ -52,6 +53,11 @@ public function __invoke(Request $request, string $token): Response
$this->profiler->disable();

$profile = $this->profiler->loadProfile($token);
// Type hint as int for the $limit argument of the find method was updated in Symfony 5.4.22 and 6.2.8
// @phpstan-ignore-next-line
$limit = (Kernel::VERSION_ID >= 60208 || (Kernel::MAJOR_VERSION === 5 && Kernel::VERSION_ID >= 50422))
? 100
: '100';

$tokens = array_map(function ($tokenData) {
$profile = $this->profiler->loadProfile($tokenData['token']);
Expand All @@ -61,7 +67,7 @@ public function __invoke(Request $request, string $token): Response
$tokenData['graphql'] = $profile->getCollector('graphql');

return $tokenData;
}, $this->profiler->find(null, $this->queryMatch ?: $this->endpointUrl, '100', 'POST', null, null, null)); // @phpstan-ignore-line
}, $this->profiler->find(null, $this->queryMatch ?: $this->endpointUrl, $limit, 'POST', null, null, null)); // @phpstan-ignore-line

$schemas = [];
foreach ($this->requestExecutor->getSchemasNames() as $schemaName) {
Expand Down
3 changes: 3 additions & 0 deletions src/Validator/ValidationNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Overblog\GraphQLBundle\Validator;

use AllowDynamicProperties;
use GraphQL\Type\Definition\InputObjectType;
use GraphQL\Type\Definition\ObjectType;
use GraphQL\Type\Definition\ResolveInfo;
Expand All @@ -22,6 +23,8 @@
* It also contains variables of the resolver context, in which this class was
* instantiated.
*/
/* @phpstan-ignore-next-line */
#[AllowDynamicProperties]
class ValidationNode
{
private const KNOWN_VAR_NAMES = ['value', 'args', 'context', 'info'];
Expand Down

0 comments on commit e1facd3

Please sign in to comment.