Skip to content

Commit 8d9ab90

Browse files
authored
Workflows
1 parent bb3cc93 commit 8d9ab90

File tree

3 files changed

+91
-8
lines changed

3 files changed

+91
-8
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
title: "PHPStan for WordPress Analysis Failed - PHP {{ env.PHP_VERSION }}"
3+
labels: ["bug", "phpstan", "static-analysis", "wordpress"]
4+
assignees: []
5+
---
6+
7+
## PHPStan for WordPress Static Analysis Failure
8+
9+
**PHP Version:** {{ env.PHP_VERSION }}
10+
**Workflow Run:** [{{ env.RUN_ID }}]({{ env.WORKFLOW_URL }})
11+
**Date:** {{ date | date('YYYY-MM-DD') }}
12+
13+
### Description
14+
The PHPStan for WordPress static analysis check has failed during the automated testing process.
15+
16+
### What happened?
17+
PHPStan for WordPress detected potential code issues during static analysis. This could indicate:
18+
19+
- Type safety issues specific to WordPress APIs
20+
- Potential bugs or inconsistencies in WordPress plugin code
21+
- WordPress coding standard violations
22+
- Incorrect usage of WordPress functions or hooks
23+
24+
### Next Steps
25+
1. Review the workflow logs at the link above
26+
2. Check the specific PHPStan error messages
27+
3. Fix any identified code issues
28+
4. Ensure WordPress-specific type annotations are correct
29+
5. Re-run the workflow to verify fixes
30+
31+
### Additional Information
32+
- This check uses WordPress-specific PHPStan rules
33+
- The analysis helps catch WordPress-related coding issues early
34+
- Consider updating code to follow WordPress best practices
35+
36+
---
37+
*This issue was automatically created by the PHPStan for WordPress workflow failure.*

.github/workflows/wordpress-plugin-check.yml

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,15 @@ jobs:
592592
- name: Security Check for known vulnerabilities in dependencies
593593
uses: symfonycorp/security-checker-action@v5
594594

595+
- name: WordPress Vulnerability Scanner
596+
uses: jazzsequence/action-wordpress-vulnerability-scanner@1.0.1
597+
598+
- name: WordPress Vulnerability Check
599+
uses: umutphp/wp-vulnerability-check-github-action@v18
600+
with:
601+
path: '.'
602+
token: ${{ secrets.GITHUB_TOKEN }}
603+
595604
- name: Create issue on security vulnerability
596605
if: ${{ failure() }}
597606
uses: JasonEtco/create-an-issue@v2
@@ -610,7 +619,7 @@ jobs:
610619
strategy:
611620
matrix:
612621
php-version: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
613-
wp-version: ['6.0', '6.1', '6.2', '6.3', '6.4', '6.5', '6.6', '6.7', 'latest', 'nightly']
622+
wp-version: ['6.0', 'latest', 'nightly']
614623
fail-fast: false
615624

616625
services:
@@ -771,7 +780,9 @@ jobs:
771780
fi
772781
fi
773782
783+
# First, ensure database doesn't exist (ignore errors)
774784
mysql --user="$DB_USER" --password="$DB_PASS"$EXTRA -e "DROP DATABASE IF EXISTS $DB_NAME" || true
785+
# Now create fresh database with force flag
775786
mysqladmin create $DB_NAME --user="$DB_USER" --password="$DB_PASS"$EXTRA --force
776787
}
777788
@@ -882,3 +893,38 @@ jobs:
882893
with:
883894
filename: .github/ISSUE_TEMPLATE/wp-version-test-failure.md
884895
update_existing: false
896+
897+
phpstan-wordpress:
898+
name: PHPStan for WordPress (PHP ${{ matrix.php-version }})
899+
runs-on: ubuntu-latest
900+
strategy:
901+
matrix:
902+
php-version: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
903+
fail-fast: false
904+
905+
steps:
906+
- name: Checkout code
907+
uses: actions/checkout@v4
908+
909+
- name: Setup PHP ${{ matrix.php-version }}
910+
uses: shivammathur/setup-php@v2
911+
with:
912+
php-version: ${{ matrix.php-version }}
913+
extensions: mysqli, curl, zip, intl, gd, mbstring, fileinfo, xml
914+
coverage: none
915+
tools: composer:v2
916+
917+
- name: PHPStan for WordPress
918+
uses: dingo-d/phpstan-wp-action@v2
919+
920+
- name: Create issue on PHPStan failure
921+
if: ${{ failure() }}
922+
uses: JasonEtco/create-an-issue@v2
923+
env:
924+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
925+
PHP_VERSION: ${{ matrix.php-version }}
926+
RUN_ID: ${{ github.run_id }}
927+
WORKFLOW_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
928+
with:
929+
filename: .github/ISSUE_TEMPLATE/phpstan-failure.md
930+
update_existing: false

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Simple WP Optimizer
22

33
![GitHub License](https://img.shields.io/github/license/EngineScript/Simple-WP-Optimizer)
4-
![WordPress Plugin Version](https://img.shields.io/badge/version-1.5.4-blue)
4+
![WordPress Plugin Version](https://img.shields.io/badge/version-1.5.5-blue)
55
![WordPress Plugin Required PHP Version](https://img.shields.io/badge/php-7.4--8.4-green)
6-
![WordPress Plugin: Tested WP Version](https://img.shields.io/badge/wordpress-5.0--6.4-green)
6+
![WordPress Plugin: Tested WP Version](https://img.shields.io/badge/wordpress-6.0--6.8-green)
77

88
A lightweight WordPress plugin designed to optimize your website by removing unnecessary scripts, styles, and header elements that can slow down your site.
99

@@ -67,7 +67,7 @@ Yes, hiding the WordPress version can provide a minor security benefit by making
6767
### Requirements
6868

6969
- PHP 7.4 or higher
70-
- WordPress 5.6 or higher
70+
- WordPress 6.0 or higher
7171
- Composer (for development and testing)
7272

7373
### Setting up the development environment
@@ -79,13 +79,13 @@ Yes, hiding the WordPress version can provide a minor security benefit by making
7979

8080
### PHP 8.x Compatibility
8181

82-
This plugin is fully compatible with PHP versions 7.4 through 8.2. For testing with PHP 8.x, we provide a custom PHPUnit runner script that helps avoid common compatibility issues between PHPUnit and newer PHP versions:
82+
This plugin is fully compatible with PHP versions 7.4 through 8.4. For testing with PHP 8.x, we provide a custom PHPUnit runner script that helps avoid common compatibility issues between PHPUnit and newer PHP versions:
8383

8484
```bash
8585
# For PHP 7.4 (standard testing)
8686
composer test
8787

88-
# For PHP 8.0, 8.1, and 8.2 (using the custom runner)
88+
# For PHP 8.0, 8.1, 8.2, 8.3, and 8.4 (using the custom runner)
8989
composer test:php8
9090
```
9191

@@ -107,8 +107,8 @@ This ensures our plugin stays up-to-date with the latest WordPress versions with
107107

108108
The plugin includes a comprehensive PHPUnit test suite that runs automatically on GitHub Actions. Our testing matrix includes:
109109

110-
- PHP versions: 7.4, 8.0, 8.1, 8.2
111-
- Latest WordPress version
110+
- PHP versions: 7.4, 8.0, 8.1, 8.2, 8.3, 8.4
111+
- WordPress versions: 6.0, latest, nightly
112112
- Both single site and multisite installations
113113

114114
This ensures code quality and compatibility across different PHP versions and WordPress configurations.

0 commit comments

Comments
 (0)