Skip to content
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

PES-2371: PHPstan - Packetery/Module lvl 2 and Packetery/Core strict rules #647

Merged
merged 27 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
62306e5
PES-2325: Move phpstan from its own composer to main composer
Karpec Nov 6, 2024
d4f1861
PES-2325: Change phpstan bootstrap path in unit tests
Karpec Nov 6, 2024
f1610a6
PES-2325: Remove composer from phpstan folder, we don't need it anymore
Karpec Nov 6, 2024
02c19d6
PES-2325: Remove phpstan/vendor from .gitignore, its unnecessary
Karpec Nov 6, 2024
6e34fa9
PES-2325: Change path to woocommerce stubs in phpstan config
Karpec Nov 6, 2024
fe0539f
PES-2325: Split phpstan configurations so we can check different leve…
Karpec Nov 6, 2024
a043c22
PES-2325: Fix phpstan errors in Packetery/Module on level 1
Karpec Nov 6, 2024
8d22f96
PES-2325: Fix phpstan errors in Packetery/Module on level 2
Karpec Nov 7, 2024
61a702d
PES-2325: Set level 2 for Packetery/Module directory
Karpec Nov 7, 2024
d7194bb
PES-2325: Add phpstan/phpstan-strict-rules
Karpec Nov 7, 2024
7e57562
PES-2325: Fix phpstan error in Packetery/Core with strict rules
Karpec Nov 7, 2024
44f88bc
PES-2325: Add phpstan strict rules in config for Packetery/Core and d…
Karpec Nov 8, 2024
925d798
PES-2325: Remove phpstan/vendor from .ecrc
Karpec Nov 8, 2024
ac57e02
PES-2325: PHPStan composer from github action
Karpec Nov 8, 2024
8127a67
PES-2325: Update PHPStan newer version
Karpec Nov 8, 2024
be9a338
PES-2325: Add phpstan var type for array
Karpec Nov 11, 2024
738a554
PES-2325: Add src/Packetery/Core scan directory
Karpec Nov 11, 2024
6d962fd
PES-2325: Update .lock
Karpec Nov 11, 2024
492b017
PES-2371: Add latest woocommerce stubs
Karpec Nov 11, 2024
260e68c
PES-2371: PHPStan doesnt need to scan deps and bootstrap files for Pa…
Karpec Nov 12, 2024
b3aa486
PES-2371: More readable code in the isPacketaShippingMethodActive method
Karpec Nov 12, 2024
86e910b
PES-2371: Use constant instead string
Karpec Nov 12, 2024
10f1c1c
PES-2371: Shortened if isset notation
Karpec Nov 12, 2024
8fe2835
PES-2371: Revert the changes to the dashboard widget to avoid unneces…
Karpec Nov 12, 2024
8602835
PES-2371: Removing unnecessary variable
Karpec Nov 12, 2024
f7326e5
PES-2371: Nicer formating function setStoredUntil
Karpec Nov 15, 2024
7250956
PES-2371: Use of shorthand if statements instead longer
Karpec Nov 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .ecrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"^.git\/",
"^deps\/",
"^tests-coverage\/",
"^phpstan\/vendor\/",
"^public\/libs\/",
"^public\/block\/index.asset.php",
"^public\/block\/index.js",
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/run-phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ jobs:
run: php -v

- name: Install Composer dependencies
working-directory: phpstan
run: composer install

- name: Run PHPStan with php version 7.2
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/run-phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,5 @@ jobs:
- name: Install Composer dependencies
run: composer install

- name: Install Composer dev dependencies
working-directory: phpstan
run: composer install

- name: Run PHPUnit
run: composer run tests-unit
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/.idea/
/vendor
/phpcs/vendor
/phpstan/vendor
/temp/*
!/temp/.gitignore
/log/
Expand Down
53 changes: 44 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@
"composer/composer": "^2.6",
"wpify/scoper": "3.2.13",
"phpunit/phpunit": "10.4.2",
"php-stubs/woocommerce-stubs": "^9.1",
"php-stubs/woocommerce-stubs": "^9.3",
"editorconfig-checker/editorconfig-checker": "^10.6",
"slevomat/coding-standard": "^8.15",
"wp-cli/wp-cli-bundle": "^2.11"
"wp-cli/wp-cli-bundle": "^2.11",
"phpstan/extension-installer": "^1.4",
"szepeviktor/phpstan-wordpress": "^1.3",
"phpstan/phpstan-strict-rules": "^1.6",
"phpstan/phpstan": "^1.2"
},
"scripts": {
"build:deps": "bash build-deps.sh",
Expand All @@ -19,12 +23,42 @@
"wpify-scoper": "wpify-scoper",
"check:phpcs": "vendor/bin/phpcs",
"fix:phpcbf": "vendor/bin/phpcbf",
"phpstan:php72": "phpstan/vendor/bin/phpstan -cphpstan/php72.neon analyse",
"phpstan:php74": "phpstan/vendor/bin/phpstan -cphpstan/php74.neon analyse",
"phpstan:php80": "phpstan/vendor/bin/phpstan -cphpstan/php80.neon analyse",
"phpstan:php81": "phpstan/vendor/bin/phpstan -cphpstan/php81.neon analyse",
"phpstan:php82": "phpstan/vendor/bin/phpstan -cphpstan/php82.neon analyse",
"phpstan:php83": "phpstan/vendor/bin/phpstan -cphpstan/php83.neon analyse",
"phpstan:php72": [
"@phpstan:php72-core",
"@phpstan:php72-module"
],
"phpstan:php74": [
"@phpstan:php74-core",
"@phpstan:php74-module"
],
"phpstan:php80": [
"@phpstan:php80-core",
"@phpstan:php80-module"
],
"phpstan:php81": [
"@phpstan:php81-core",
"@phpstan:php81-module"
],
"phpstan:php82": [
"@phpstan:php82-core",
"@phpstan:php82-module"
],
"phpstan:php83": [
"@phpstan:php83-core",
"@phpstan:php83-module"
],
"phpstan:php72-core": "phpstan analyse -c phpstan/php72-core.neon",
"phpstan:php74-core": "phpstan analyse -c phpstan/php74-core.neon",
"phpstan:php80-core": "phpstan analyse -c phpstan/php80-core.neon",
"phpstan:php81-core": "phpstan analyse -c phpstan/php81-core.neon",
"phpstan:php82-core": "phpstan analyse -c phpstan/php82-core.neon",
"phpstan:php83-core": "phpstan analyse -c phpstan/php83-core.neon",
"phpstan:php72-module": "phpstan analyse -c phpstan/php72-module.neon --memory-limit 2G",
"phpstan:php74-module": "phpstan analyse -c phpstan/php74-module.neon --memory-limit 2G",
"phpstan:php80-module": "phpstan analyse -c phpstan/php80-module.neon --memory-limit 2G",
"phpstan:php81-module": "phpstan analyse -c phpstan/php81-module.neon --memory-limit 2G",
"phpstan:php82-module": "phpstan analyse -c phpstan/php82-module.neon --memory-limit 2G",
"phpstan:php83-module": "phpstan analyse -c phpstan/php83-module.neon --memory-limit 2G",
"tests-unit": "vendor/bin/phpunit tests",
"tests-coverage": "export XDEBUG_MODE=coverage && php -d memory_limit=200M ./vendor/bin/phpunit tests --coverage-html ./tests-coverage",
"check:all": [
Expand All @@ -45,7 +79,8 @@
},
"allow-plugins": {
"wpify/scoper": true,
"dealerdirect/phpcodesniffer-composer-installer": true
"dealerdirect/phpcodesniffer-composer-installer": true,
"phpstan/extension-installer": true
}
},
"autoload": {
Expand Down
220 changes: 219 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 2 additions & 6 deletions phpstan/base.neon
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
parameters:
bootstrapFiles:
- vendor/php-stubs/woocommerce-stubs/woocommerce-stubs.php
- vendor/php-stubs/woocommerce-stubs/woocommerce-packages-stubs.php
- ../vendor/php-stubs/woocommerce-stubs/woocommerce-stubs.php
- ../vendor/php-stubs/woocommerce-stubs/woocommerce-packages-stubs.php
- ../constants.php
level: 8
fileExtensions:
- php
paths:
- ../src/Packetery/Core
scanDirectories:
- ../deps
- ../src/Packetery/Module
15 changes: 0 additions & 15 deletions phpstan/composer.json

This file was deleted.

Loading
Loading