Closed szepeviktor closed 1 year ago
@szepeviktor Thanks again for submitting this PR. Does PHPStan automatically apply these corrections or only notifies you on what needs to be fixed? Also are any changes related to a specific WordPress version for compatibility?
Does PHPStan automatically apply these corrections?
No. PHPStan has a learning curve. Basically this is the rule of thumb: You write code PHPStan understands ✔️ PHPStan shows a false positive 👉🏻 Write code PHPStan understands!
Also are any changes related to a specific WordPress version for compatibility?
No, these are generic fixes. This is PHPStan level 0.
I want you to be a PHPStan fan.
@szepeviktor Have I done the configuration wrong or am I missing something?
phpstan.neon
# composer require php-stubs/woocommerce-stubs php-stubs/wp-cli-stubs szepeviktor/phpstan-wordpress --dev
includes:
- vendor/szepeviktor/phpstan-wordpress/extension.neon
parameters:
paths:
- includes/
- uninstall.php
excludePaths:
- includes/cocart-deprecated-functions.php
bootstrapFiles:
- vendor/php-stubs/woocommerce-stubs/woocommerce-stubs.php
scanFiles:
- vendor/php-stubs/wp-cli-stubs/wp-cli-stubs.php
- includes/cocart-deprecated-functions.php
# For analyzing cocart-core only
- packages/admin/includes/class-cocart-admin-notices.php
- packages/products-api/includes/class-cocart-datetime.php
level: 0
If you bump into errors try debugging: vendor/bin/phpstan analyze --debug
Thanks. Got it working. Crazy how much memory it needs to work.
PHPStan has 100 developers built in!
👨💻👨💻👨💻👨💻👨💻👨💻👨💻👨💻👨💻👨💻 👨💻👨💻👨💻👨💻👨💻👨💻👨💻👨💻👨💻👨💻 👨💻👨💻👨💻👨💻👨💻👨💻👨💻👨💻👨💻👨💻 👨💻👨💻👨💻👨💻👨💻👨💻👨💻👨💻👨💻👨💻 👨💻👨💻👨💻👨💻👨💻👨💻👨💻👨💻👨💻👨💻 👨💻👨💻👨💻👨💻👨💻👨💻👨💻👨💻👨💻👨💻 👨💻👨💻👨💻👨💻👨💻👨💻👨💻👨💻👨💻👨💻 👨💻👨💻👨💻👨💻👨💻👨💻👨💻👨💻👨💻👨💻 👨💻👨💻👨💻👨💻👨💻👨💻👨💻👨💻👨💻👨💻 👨💻👨💻👨💻👨💻👨💻👨💻👨💻👨💻👨💻👨💻
Description
The clone of that fruitful PR in the packaging repository. https://github.com/co-cart/co-cart/pull/388
Types of changes
Contains critical bug fixes, and the type fixes leading up to finding those bugs during static analysis.
Checklist:
I hope you take fancy to run PHPStan as there are sure benefits.