2

我有一个小班:

<?php

namespace AuthenticationBundle\Entity;

/**
 * Class UserAuthentication
 *
 * @package AuthenticationBundle
 */
class UserAuthentication
{

    /**
     * @var string
     */
    private $username;

    /**
     * @var string
     */
    private $password;

    /**
     * Set username
     *
     * @param string $username
     */
    public function setUsername($username)
    {
        $this->username = $username;
    }

    /**
     * Get username
     *
     * @return string
     */
    public function getUsername()
    {
        return $this->username;
    }

    /**
     * Set password
     *
     * @param string $password
     */
    public function setPassword($password)
    {
        $this->password = $password;
    }

    /**
     * Get password
     *
     * @return string
     */
    public function getPassword()
    {
        return $this->password;
    }
}

然后我尝试检索它的属性的类型:

$this->get('property_info')->getTypes(UserAuthentication::class, 'username')

这将返回 null。知道为什么属性信息组件无法读取我的 @var 注释吗?

4

0 回答 0