Skip to content

Commit

Permalink
Merge pull request #1133 from aviator-ua/fix-deprecation-warning-014
Browse files Browse the repository at this point in the history
Fix deprecation warning for PHP 8.2
  • Loading branch information
mcg-web authored Oct 3, 2023
2 parents 7a7a14c + b99338b commit 150614c
Show file tree
Hide file tree
Showing 2 changed files with 8 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
1 change: 1 addition & 0 deletions src/Validator/ValidationNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
* It also contains variables of the resolver context, in which this class was
* instantiated.
*/
#[\AllowDynamicProperties]
class ValidationNode
{
private const KNOWN_VAR_NAMES = ['value', 'args', 'context', 'info'];
Expand Down

0 comments on commit 150614c

Please sign in to comment.