-
Notifications
You must be signed in to change notification settings - Fork 95
Use stubfile extension for PasswordUpgraderInterface #335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use stubfile extension for PasswordUpgraderInterface #335
Conversation
kevinpapst
commented
Feb 19, 2023
@VincentLanglet Thank you! Works for SF 4.4. But with SF 6.2 I have other issues now.
Below output is from the SF 4.4 project, Symfony 6.2 follows later:
Below:
$ vendor/bin/phpstan analyse src -c phpstan.neon --level=5 951/951 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100% ------ -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Line Security/DoctrineUserProvider.php ------ -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 80 Parameter $user of method App\Security\DoctrineUserProvider::upgradePassword() has invalid type Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface. ------ -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ------ ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- Line Security/KimaiUserProvider.php ------ ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- 87 Parameter $user of method App\Security\KimaiUserProvider::upgradePassword() has invalid type Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface. ------ ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- [ERROR] Found 2 errors Script vendor/bin/phpstan analyse src -c phpstan.neon --level=5 handling the phpstan event returned with error code 1
Composer update:
$ composer update Loading composer repositories with package information Restricting packages listed in "symfony/symfony" to "4.4.*" Updating dependencies Lock file operations: 0 installs, 1 update, 0 removals - Upgrading phpstan/phpstan-symfony (1.2.23 => dev-PasswordAuthenticatedUserStubFilesExtension d879c1a) Writing lock file Installing dependencies from lock file (including require-dev) Package operations: 0 installs, 1 update, 0 removals - Downloading phpstan/phpstan-symfony (dev-PasswordAuthenticatedUserStubFilesExtension d879c1a) - Upgrading phpstan/phpstan-symfony (1.2.23 => dev-PasswordAuthenticatedUserStubFilesExtension d879c1a): Extracting archive Package sensio/framework-extra-bundle is abandoned, you should avoid using it. Use Symfony instead. Package symfony/debug is abandoned, you should avoid using it. Use symfony/error-handler instead. Package symfony/inflector is abandoned, you should avoid using it. Use EnglishInflector from the String component instead. Package php-cs-fixer/diff is abandoned, you should avoid using it. No replacement was suggested. Generating autoload files composer/package-versions-deprecated: Generating version class... composer/package-versions-deprecated: ...done generating version class 139 packages you are using are looking for funding. Use the `composer fund` command to find out more!
Afterwards:
$ vendor/bin/phpstan analyse src -c phpstan.neon --level=5 951/951 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100% [OK] No errors
20a2e46 to
4243db4
Compare
@VincentLanglet Thank you! Works for SF 4.4.
Great
But with SF 6.2 I have other issues now.
Certainly because I used class_exists on an interface so the stub wasn't loaded anymore.
I added a commit to fix it.
Yep 👍 The lastest commit fixed the SF 6.2 issues. And SF 4.4 still works.
I assume your branch is behind 1.2.23, right?
Because I get PHPDoc tag @extends contains generic type Symfony\Component\Security\Core\Authorization\Voter\Voter<string, App\Entity\Activity> but class Symfony\Component\Security\Core\Authorization\Voter\Voter is not generic. in SF 6.2, which worked in 1.2.23.
4243db4 to
f961a75
Compare
Yep 👍 The lastest commit fixed the SF 6.2 issues. And SF 4.4 still works.
Great !
I assume your branch is behind 1.2.23, right?
Because I get
PHPDoc tag @extends contains generic type Symfony\Component\Security\Core\Authorization\Voter\Voter<string, App\Entity\Activity> but class Symfony\Component\Security\Core\Authorization\Voter\Voter is not generic.in SF 6.2, which worked in 1.2.23.
Certainly. I rebased my branch ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, now SF 6.2 is green as well. Fixed 👍
Thank you for your quick support, very much appreciated!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Runtime concerns are irrelevant for PHPStan, you need to ask ReflectionProvider. If ReflectionProvider cannot be injected, then ask Reflector, as phpstan-doctrine does: https://github.com/phpstan/phpstan-doctrine/blob/1.3.x/src/Stubs/Doctrine/StubFilesExtensionLoader.php
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not that I understand anything about PHPStan internals, but isn't that the "same" as in : https://github.com/phpstan/phpstan-symfony/blob/1.2.x/src/Symfony/InputBagStubFilesExtension.php#L13 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is reaaaaaally old and should be fixed too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done for both StubFilesExtension.
bda236b to
c12047b
Compare
Friendly ping @ondrejmirtes, is this PR ok to you ?
Thanks.
Thank you.
I'm trying to solve #333
@kevinpapst can you try this branch ?
Closes #333