for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Chubbyphp\Deserialization\Policy;
use Chubbyphp\Deserialization\Denormalizer\DenormalizerContextInterface;
final class CallbackPolicy implements PolicyInterface
{
/**
* @var callable
*/
private $callback;
* @param callable $callback
public function __construct(callable $callback)
$this->callback = $callback;
}
* @param DenormalizerContextInterface $context
* @param object|mixed $object
*
* @return bool
public function isCompliant(DenormalizerContextInterface $context, $object): bool
return ($this->callback)($context, $object);