phpstan: Error without leading backslash?
Hello,
I have a problem with my classes. It seems that phpstan marks as errors the class names like these:
/**
* Verifies the token and returns the associated user.
*
* @param string $accessToken
*
* @return AppBundle\Model\SocialUser
*/
public function verifyToken($idTokenString)
{
//
}
Line src/AppBundle/Service/FacebookHelper.php
------ --------------------------------------------------------------------------------------------
34 Return typehint of method AppBundle\Service\FacebookHelper::verifyToken() has invalid type
AppBundle\Service\AppBundle\Model\SocialUser.
If I put a leading slash then the error is silenced. Should I change all the classes?
Thanks.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 16 (9 by maintainers)
From now on, you should run the
vendor/bin/phpunit, not your globalphpunitfrom system.You’re welcome.
Yep, names without the leading backslash are appended to the current namespace or looked up in the used names. That’s the standard behaviour of all typehints and phpDocs.