-
-
Notifications
You must be signed in to change notification settings - Fork 437
Closed
Description
Hi !
when using the maker bundle to create user auth system, phpstan seem not very happy with what you get
To reproduce, do this : (I use the symfony cli on version 5.7.4)
symfony new --webapp .
symfony console make:user
with all parameters by default
The name of the security user class (e.g. User) [User]:
>
Do you want to store user data in the database (via Doctrine)? (yes/no) [yes]:
>
Enter a property name that will be the unique "display" name for the user (e.g. email, username, uuid) [email]:
>
Will this app need to hash/check user passwords? Choose No if passwords are not needed or will be checked/hashed by some other system (e.g. a single sign-on server).
Does this app need to hash/check user passwords? (yes/no) [yes]:
>
then add phpstan
composer require --dev phpstan/phpstan
and answer yes when the recipe ask execution
recipe : https://github.com/symfony/recipes-contrib/tree/main/phpstan/phpstan/1.0
this add the phpstan.dist.neon file, with "level: 6" check
finally, execute phpstan :
phpstan analyse ./src
and you got errors :
Note: Using configuration file E:\_workspace\symfony7-test\phpstan.dist.neon.
3/3 [============================] 100%
------ --------------------------------------------------------------------------------------
Line Entity\User.php
------ --------------------------------------------------------------------------------------
:22 Property App\Entity\User::$roles type has no value type specified in iterable
type array.
💡 See:
https://phpstan.org/blog/solving-phpstan-no-value-type-specified-in-iterable-type
:69 Method App\Entity\User::setRoles() has parameter $roles with no value type
specified in iterable type array.
💡 See:
https://phpstan.org/blog/solving-phpstan-no-value-type-specified-in-iterable-type
------ --------------------------------------------------------------------------------------
------ ---------------------------------------------------------------------------------
Line Repository\UserRepository.php
------ ---------------------------------------------------------------------------------
:21 PHPDoc tag @implements contains generic type
Symfony\Component\Security\Core\User\PasswordUpgraderInterface<App\Entity\User>
but interface Symfony\Component\Security\Core\User\PasswordUpgraderInterface is
not generic.
------ ---------------------------------------------------------------------------------
[ERROR] Found 3 errors
Metadata
Metadata
Assignees
Labels
No labels