Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

/*
* This file is part of the API Platform project.
*
* (c) Kévin Dunglas <dunglas@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

declare(strict_types=1);

namespace ApiPlatform\Symfony\Bundle\ArgumentResolver;

use Symfony\Component\HttpKernel\Controller\ArgumentValueResolverInterface;
use Symfony\Component\HttpKernel\Controller\ValueResolverInterface;

if (interface_exists(ValueResolverInterface::class)) {
/** @internal */
interface CompatibleValueResolverInterface extends ValueResolverInterface
{
}
} else {
/** @internal */
interface CompatibleValueResolverInterface extends ArgumentValueResolverInterface
{
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
use Symfony\Component\HttpKernel\Controller\ValueResolverInterface;
use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata;

final class PayloadArgumentResolver implements ValueResolverInterface
final class PayloadArgumentResolver implements CompatibleValueResolverInterface
{
use OperationRequestInitiatorTrait;

Expand Down Expand Up @@ -59,8 +59,10 @@ public function supports(Request $request, ArgumentMetadata $argument): bool

public function resolve(Request $request, ArgumentMetadata $argument): \Generator
{
if (!$this->supports($request, $argument)) {
yield [];
if (interface_exists(ValueResolverInterface::class)) {
if (!$this->supports($request, $argument)) {
yield [];
}
}

yield $request->attributes->get('data');
Expand Down