[Payum] Preserve PaymentSecurityToken BC (revert details to untyped, use custom ObjectType)

This commit is contained in:
Grzegorz Sadowski 2026-06-17 11:53:00 +02:00
parent 3aad5d6fd7
commit 209016df32
No known key found for this signature in database
GPG key ID: EF87FF4E6E3BD364
2 changed files with 3 additions and 23 deletions

View file

@ -101,7 +101,6 @@
"Payum\\Core\\Security\\TokenInterface",
"Payum\\Core\\Security\\Util\\Random",
"Payum\\Core\\Storage\\AbstractStorage",
"Payum\\Core\\Storage\\IdentityInterface",
"PHPUnit\\Framework\\ExpectationFailedException",
"PHPUnit\\Framework\\MockObject\\MockObject",
"PHPUnit\\Framework\\TestCase",

View file

@ -13,17 +13,15 @@ declare(strict_types=1);
namespace Sylius\Bundle\PayumBundle\Model;
use Payum\Core\Model\Identity;
use Payum\Core\Security\Util\Random;
use Payum\Core\Storage\IdentityInterface;
class PaymentSecurityToken implements PaymentSecurityTokenInterface
{
/** @var string */
protected $hash;
/** @var array<string, mixed>|null */
protected ?array $details = null;
/** @var object|null */
protected $details;
/** @var string|null */
protected $afterUrl;
@ -46,28 +44,11 @@ class PaymentSecurityToken implements PaymentSecurityTokenInterface
public function setDetails($details): void
{
if ($details instanceof IdentityInterface) {
$this->details = ['id' => $details->getId(), 'class' => $details->getClass()];
return;
}
if (is_object($details)) {
$this->details = (array) $details;
return;
}
$this->details = $details;
}
/** @return IdentityInterface|array<string, mixed>|null */
public function getDetails(): array|IdentityInterface|null
public function getDetails()
{
if (is_array($this->details) && isset($this->details['id'], $this->details['class'])) {
return new Identity($this->details['id'], $this->details['class']);
}
return $this->details;
}