WordPress / two-factor

Two-Factor Authentication for WordPress.
https://wordpress.org/plugins/two-factor/
GNU General Public License v2.0
719 stars 150 forks source link

Please use PHPStan #618

Open szepeviktor opened 1 month ago

szepeviktor commented 1 month ago

Describe the bug

There are nasty things in the code, e.g. return parent::__construct();

Steps to Reproduce

The simplest way.

composer require --dev szepeviktor/phpstan-wordpress
vendor/bin/phpstan analyze -c vendor/szepeviktor/phpstan-wordpress/extension.neon includes/ providers/ class-*.php two-factor.php --level=0
dd32 commented 1 month ago

Hi!

Can you double-check the command provided?

$ composer require --dev szepeviktor/phpstan-wordpress

./composer.json has been updated
Running composer update szepeviktor/phpstan-wordpress
Loading composer repositories with package information
Updating dependencies
Lock file operations: 3 installs, 0 updates, 0 removals
  - Locking php-stubs/wordpress-stubs (v6.5.3)
  - Locking phpstan/phpstan (1.11.7)
  - Locking szepeviktor/phpstan-wordpress (v1.3.5)
Writing lock file

$ vendor/bin/phpstan analyze -c vendor/szepeviktor/phpstan-wordpress/extension.neon includes/ providers/ class-*.php two-factor.php --level=0
 14/14 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

 [OK] No errors

$ git remote -v
origin  git@github.com:WordPress/two-factor.git (fetch)
origin  git@github.com:WordPress/two-factor.git (push)

$ git branch
* master
szepeviktor commented 1 month ago

This is surreal. 14/14: all files are checked 😲

I cannot find the reason why there are no errors.

dd32 commented 1 month ago

I fully suspect it's related to my environment somehow :)

Thank you for the PR, it should be enough to review the changes and have them merged without issue.

(we'll need to get the GitHub actions working prior to merge however, to ensure no regressions. I'm not requesting you do that, unless you feel like it!)

szepeviktor commented 1 month ago

I'm contributing to PHPStan for years and I have no clue what is going on!