From 04b60d1d76fc0bbbf35e877c35070d9a6aa96eea Mon Sep 17 00:00:00 2001 From: Renato Alves <19148962+renatonascalves@users.noreply.github.com> Date: Mon, 14 Oct 2024 10:31:56 -0300 Subject: [PATCH 1/4] WIP: issue-1165 From 927e64eb52a4728dccd8cb8754a7bdf741054466 Mon Sep 17 00:00:00 2001 From: Renato Alves <19148962+renatonascalves@users.noreply.github.com> Date: Mon, 14 Oct 2024 10:35:07 -0300 Subject: [PATCH 2/4] Set up and configure PHPStan --- .github/workflows/phpcs.yml | 10 +++++----- composer.json | 5 ++++- phpstan.neon | 10 ++++++++++ 3 files changed, 19 insertions(+), 6 deletions(-) create mode 100644 phpstan.neon diff --git a/.github/workflows/phpcs.yml b/.github/workflows/phpcs.yml index 8e988688..20dfd6d2 100644 --- a/.github/workflows/phpcs.yml +++ b/.github/workflows/phpcs.yml @@ -13,10 +13,10 @@ on: jobs: phpcs: - strategy: - matrix: - php: [ '8.3' ] if: github.event.pull_request.draft == false - uses: alleyinteractive/.github/.github/workflows/php-coding-standards.yml@main + uses: alleyinteractive/.github/.github/workflows/php-composer-command.yml@main with: - php: ${{ matrix.php }} + php: '8.3' + command: | + phpcs + # phpstan diff --git a/composer.json b/composer.json index 1c586170..f218f5fe 100644 --- a/composer.json +++ b/composer.json @@ -12,14 +12,17 @@ "alleyinteractive/alley-coding-standards": "^2.0.1", "mantle-framework/testkit": "^0.12.7", "phpspec/prophecy": "^1.17.0", - "yoast/phpunit-polyfills": "^2.0" + "yoast/phpunit-polyfills": "^2.0", + "szepeviktor/phpstan-wordpress": "^1.3" }, "scripts": { "phpcbf" : "phpcbf .", "phpcs" : "phpcs .", "phpunit" : "phpunit", + "phpstan": "phpstan --memory-limit=1024M", "test": [ "@phpcs", + "@phpstan", "@phpunit" ], "test-release": "rsync -rc --exclude-from=.distignore ./ ~/Desktop/publish-to-apple-news/ --delete --delete-excluded" diff --git a/phpstan.neon b/phpstan.neon new file mode 100644 index 00000000..a5380a48 --- /dev/null +++ b/phpstan.neon @@ -0,0 +1,10 @@ +includes: + - vendor/szepeviktor/phpstan-wordpress/extension.neon + +parameters: + # Level 9 is the highest level + level: max + + paths: + # - admin + - includes From 7ea9702e58330788459454b20ccf176847da6746 Mon Sep 17 00:00:00 2001 From: Renato Alves <19148962+renatonascalves@users.noreply.github.com> Date: Mon, 14 Oct 2024 10:35:23 -0300 Subject: [PATCH 3/4] Ready for review From 10543274bba45bdcec57542655ac7bdded0b8c0e Mon Sep 17 00:00:00 2001 From: Renato Alves <19148962+renatonascalves@users.noreply.github.com> Date: Mon, 14 Oct 2024 10:37:35 -0300 Subject: [PATCH 4/4] Remove `phpstan` --- .github/workflows/phpcs.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/phpcs.yml b/.github/workflows/phpcs.yml index 20dfd6d2..1846a1b8 100644 --- a/.github/workflows/phpcs.yml +++ b/.github/workflows/phpcs.yml @@ -19,4 +19,3 @@ jobs: php: '8.3' command: | phpcs - # phpstan