티스토리 수익 글 보기

티스토리 수익 글 보기

Add basic PHPStan linter by kasparsd · Pull Request #638 · WordPress/two-factor · GitHub
Skip to content

Conversation

@kasparsd
Copy link
Collaborator

What?

Introduces phpstan with WordPress core stubs through szepeviktor/phpstan-wordpress.

Why?

Fixes #618.

Static analysis helps us uncover potential bugs and edge cases. Introducing the tooling didn’t require a lot adjustments thanks to work already done in #619.

How?

Add the tooling as Composer development dependency and introduce additional lint scripts in composer.json and package.json.

Testing Instructions

  1. Install composer dependencies via composer install after checking out this branch.
  2. Run composer lint-phpstan and confirm that [OK] No errors is returned.

Screenshots or screencast

Changelog Entry

Development: Introduce PHPstan tooling for development.

/dist/
/tests/logs/
.phpunit.result.cache
phpstan.neon
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Allow local overrides.

composer.json Outdated
"scripts": {
"lint": "phpcs",
"lint-compat": "phpcs -p –standard=PHPCompatibilityWP –runtime-set testVersion 7.2- –extensions=php –ignore='tests/,dist/,includes/Yubico/,vendor/,node_modules/' .",
"lint-phpstan": "phpstan analyse –memory-limit=1G",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Running without bumping the memory limit can sometimes return passing checks when they actually didn’t run.

@kasparsd kasparsd requested a review from dd32 September 18, 2024 15:16
@kasparsd kasparsd self-assigned this Sep 18, 2024
Copy link
Member

@dd32 dd32 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kasparsd kasparsd merged commit 3f41808 into master Sep 19, 2024
@kasparsd kasparsd deleted the 618-add-phpstan branch September 19, 2024 07:20
@kasparsd kasparsd mentioned this pull request Sep 19, 2024
@jeffpaul jeffpaul added this to the 0.10.0 milestone Sep 19, 2024
@jeffpaul jeffpaul modified the milestones: 0.11.0, 0.10.0 Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Please use PHPStan

5 participants