Closed
Description
Symfony version(s) affected: 4.3.5
Description
Hello, I have encountered with problem deserializing object, and eventually pointed to property-info, that my trait exists elsewhere than class itself. It seems
that getPhpTypeAndClass
is too simple for traits (?).
How to reproduce
namespace Command\Common\Traits;
use Command\Model\Payment\UserAccountDetails;
trait UserDetailsAwareTrait
{
/**
* @var UserAccountDetails
*/
protected $userAccountDetails;
public function getUserAccountDetails(): UserAccountDetails
{
return $this->userAccountDetails;
}
public function setUserAccountDetails(UserAccountDetails $userAccountDetails): void
{
$this->userAccountDetails = $userAccountDetails;
}
}
namespace Command\Bank;
use Command\Common\Traits\UserDetailsAwareTrait;
class DepositCommand
{
use UserDetailsAwareTrait;
}
namespace Command\Model\Payment;
class UserAccountDetails
{
/**
* @var bool|null
*/
private $accountVerified;
public function isAccountVerified(): ?bool
{
return $this->accountVerified;
}
public function setAccountVerified(?bool $accountVerified): UserAccountDetails
{
$this->accountVerified = $accountVerified;
return $this;
}
}
Possible Solution
It seems that another library have already resolved this issue, you can take a look and this one
Additional context
as you can see structure passed to https://github.com/phpDocumentor/ReflectionDocBlock/blob/4.3.2/src/DocBlockFactory.php#L73 within $context
variable
gives https://github.com/symfony/property-info/blob/v4.3.5/Extractor/PhpDocExtractor.php#L150
Metadata
Metadata
Assignees
Labels
Issues and PRs which are looking for volunteers to complete them.Issues and PRs which are looking for volunteers to complete them.