Skip to content

Commit 95f9ffd

Browse files
committed
fix: upgrade to PHP 8.0+ to resolve PHP-DI compatibility issue
- Upgrade PHP-DI from 6.4.0 to 7.1.1 - Update PHP requirement from ^7.4 to ^8.0 - Update composer platform config to PHP 8.0.0 - Update PSR Container from 1.1.2 to 2.0.2 - Remove php-di/phpdoc-reader (no longer needed) - Update plugin headers to require PHP 8.0 - Update developer documentation to PHP 8.0 - Update GitHub Actions CI to use PHP 8.0 - Add Woocommerce_Gateway_Monei stub to PHPStan bootstrap This fixes fatal error reported by customer running PHP 8.1.33: "Declaration of DI\Container::has(name) must be compatible with Psr::has(stringid): bool" PHP-DI 6.4.0 is incompatible with PHP 8.0+ due to PSR-11 method signature mismatches. PHP-DI 7.0+ requires PHP 8.0 minimum and provides full PHP 8.x compatibility. No code changes required - existing DI container usage (autowire, create, get, factory) is fully compatible with PHP-DI 7. BREAKING CHANGE: PHP 7.4 users cannot upgrade. PHP 8.0 is now the minimum required version. PHP 7.4 reached end-of-life in November 2022. WordPress 6.8 officially supports PHP 8.0-8.3.
1 parent 0f00bdd commit 95f9ffd

File tree

8 files changed

+408
-202
lines changed

8 files changed

+408
-202
lines changed

.github/workflows/code-quality.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- name: Setup PHP
1919
uses: shivammathur/setup-php@v2
2020
with:
21-
php-version: '7.4'
21+
php-version: '8.0'
2222
coverage: none
2323
tools: composer
2424

DEVELOPER.md

Lines changed: 105 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -5,36 +5,40 @@ Official WordPress plugin for accepting payments through MONEI's payment gateway
55
## Description
66

77
MONEI is an e-commerce payment gateway for WooCommerce that enables merchants to accept:
8-
- Credit/Debit Cards (230+ currencies)
9-
- Apple Pay & Google Pay
10-
- Bizum (Spain)
11-
- PayPal
12-
- SEPA Direct Debit (EU)
13-
- Multibanco & MBWay (Portugal)
8+
9+
- Credit/Debit Cards (230+ currencies)
10+
- Apple Pay & Google Pay
11+
- Bizum (Spain)
12+
- PayPal
13+
- SEPA Direct Debit (EU)
14+
- Multibanco & MBWay (Portugal)
1415

1516
## Development Setup
1617

1718
### Prerequisites
1819

19-
- PHP 7.4 or higher
20-
- Node.js 18 or higher
21-
- Composer
22-
- Yarn 4 (managed via Corepack)
20+
- PHP 8.0 or higher
21+
- Node.js 18 or higher
22+
- Composer
23+
- Yarn 4 (managed via Corepack)
2324

2425
### Installation
2526

2627
1. Clone the repository:
28+
2729
```bash
2830
git clone git@github.com:MONEI/MONEI-WooCommerce.git
2931
cd MONEI-WooCommerce
3032
```
3133

3234
2. Install PHP dependencies:
35+
3336
```bash
3437
composer install
3538
```
3639

3740
3. Install Node dependencies and build assets:
41+
3842
```bash
3943
yarn install
4044
yarn build
@@ -54,18 +58,20 @@ This project uses **conventional commits** to enable automated changelog generat
5458
```
5559

5660
**Types:**
57-
- `feat:` - New feature
58-
- `fix:` - Bug fix
59-
- `docs:` - Documentation changes
60-
- `style:` - Code style changes (formatting, etc.)
61-
- `refactor:` - Code refactoring
62-
- `perf:` - Performance improvements
63-
- `test:` - Adding or updating tests
64-
- `build:` - Build system changes
65-
- `ci:` - CI/CD changes
66-
- `chore:` - Other changes (dependencies, etc.)
61+
62+
- `feat:` - New feature
63+
- `fix:` - Bug fix
64+
- `docs:` - Documentation changes
65+
- `style:` - Code style changes (formatting, etc.)
66+
- `refactor:` - Code refactoring
67+
- `perf:` - Performance improvements
68+
- `test:` - Adding or updating tests
69+
- `build:` - Build system changes
70+
- `ci:` - CI/CD changes
71+
- `chore:` - Other changes (dependencies, etc.)
6772

6873
**Examples:**
74+
6975
```bash
7076
git commit -m "feat: add support for new payment method"
7177
git commit -m "fix: resolve checkout error on mobile devices"
@@ -89,48 +95,54 @@ yarn build
8995
### Automated Release with Conventional Commits
9096

9197
1. **Ensure all changes are committed** with proper conventional commit messages:
98+
9299
```bash
93100
git add .
94101
git commit -m "feat: add new payment gateway"
95102
git push
96103
```
97104

98105
2. **Run the release command**:
106+
99107
```bash
100108
yarn release
101109
```
102110

103111
This will automatically:
104-
- ✅ Bump version in `package.json`, `readme.txt`, `.readme-template`, `woocommerce-gateway-monei.php`, and `class-woocommerce-gateway-monei.php`
105-
- ✅ Generate changelog from git conventional commits
106-
- ✅ Update `readme.txt` with new changelog entries above manual entries
107-
- ✅ Generate `CHANGELOG.md` with full git history
108-
- ✅ Create git tag (e.g., `6.3.9`)
109-
- ✅ Generate GitHub release notes
110-
- ✅ Push changes and tags to GitHub
112+
113+
- ✅ Bump version in `package.json`, `readme.txt`, `.readme-template`, `woocommerce-gateway-monei.php`, and `class-woocommerce-gateway-monei.php`
114+
- ✅ Generate changelog from git conventional commits
115+
- ✅ Update `readme.txt` with new changelog entries above manual entries
116+
- ✅ Generate `CHANGELOG.md` with full git history
117+
- ✅ Create git tag (e.g., `6.3.9`)
118+
- ✅ Generate GitHub release notes
119+
- ✅ Push changes and tags to GitHub
111120

112121
**Changelog System:**
113-
- New releases with conventional commits → auto-generated entries at the top
114-
- Historical releases → manual entries preserved below
115-
- `.readme-template` contains `{{__PLUGIN_CHANGELOG__}}` placeholder
116-
- `generate-wp-readme` replaces placeholder with git commit history
117-
- Manual changelog entries remain intact below the auto-generated section
122+
123+
- New releases with conventional commits → auto-generated entries at the top
124+
- Historical releases → manual entries preserved below
125+
- `.readme-template` contains `{{__PLUGIN_CHANGELOG__}}` placeholder
126+
- `generate-wp-readme` replaces placeholder with git commit history
127+
- Manual changelog entries remain intact below the auto-generated section
118128

119129
3. **CI/CD takes over**:
120-
- GitHub Actions builds the plugin
121-
- Deploys to WordPress.org
122-
- Attaches plugin ZIP to GitHub release
130+
- GitHub Actions builds the plugin
131+
- Deploys to WordPress.org
132+
- Attaches plugin ZIP to GitHub release
123133

124134
### Dry Run (Testing)
125135

126136
Test the release process without making changes:
137+
127138
```bash
128139
yarn release --dry-run
129140
```
130141

131142
### Manual Version Bump
132143

133144
To specify a version manually:
145+
134146
```bash
135147
yarn release --increment patch # 6.3.8 → 6.3.9
136148
yarn release --increment minor # 6.3.8 → 6.4.0
@@ -164,25 +176,28 @@ yarn release 6.4.0 # Specific version
164176

165177
The project uses automated linting and code quality tools to maintain consistent code style and catch bugs early:
166178

167-
- **JavaScript/CSS**: ESLint + Stylelint (via `@wordpress/scripts`)
168-
- **PHP**: PHPCS (WordPress Coding Standards) + PHPStan (static analysis)
169-
- **Git Hooks**: Husky + lint-staged for automatic fixing
170-
- **Commit Messages**: Commitlint (conventional commits)
179+
- **JavaScript/CSS**: ESLint + Stylelint (via `@wordpress/scripts`)
180+
- **PHP**: PHPCS (WordPress Coding Standards) + PHPStan (static analysis)
181+
- **Git Hooks**: Husky + lint-staged for automatic fixing
182+
- **Commit Messages**: Commitlint (conventional commits)
171183

172184
### Git Hooks
173185

174186
**Pre-commit Hook**:
175-
- Auto-fixes staged files with `lint-staged`
176-
- PHP: `phpcbf` (auto-fix code style) + `phpstan` (static analysis)
177-
- JavaScript: `eslint --fix`
178-
- CSS: `stylelint --fix`
179-
- **Prevents committing broken code** by running PHPStan
187+
188+
- Auto-fixes staged files with `lint-staged`
189+
- PHP: `phpcbf` (auto-fix code style) + `phpstan` (static analysis)
190+
- JavaScript: `eslint --fix`
191+
- CSS: `stylelint --fix`
192+
- **Prevents committing broken code** by running PHPStan
180193

181194
**Commit-msg Hook**:
182-
- Validates commit message format (conventional commits)
195+
196+
- Validates commit message format (conventional commits)
183197

184198
**Pre-push Hook**:
185-
- **Branch Protection**: Blocks direct pushes to `master`/`main` branches
199+
200+
- **Branch Protection**: Blocks direct pushes to `master`/`main` branches
186201

187202
### Linting Commands
188203

@@ -213,13 +228,13 @@ yarn lint:php:phpstan # Check PHP static analysis only
213228

214229
### Configuration Files
215230

216-
- `.lintstagedrc.json` - Auto-fix configuration for staged files
217-
- `.eslintrc.js` - JavaScript linting rules
218-
- `.eslintignore` - Exclude `public/` build outputs from JS linting
219-
- `.stylelintignore` - Exclude `public/` build outputs from CSS linting
220-
- `phpcs.xml` - PHP code style rules (WordPress standards)
221-
- `phpstan.neon` - PHP static analysis configuration (Level 4)
222-
- `commitlint.config.js` - Commit message validation rules
231+
- `.lintstagedrc.json` - Auto-fix configuration for staged files
232+
- `.eslintrc.js` - JavaScript linting rules
233+
- `.eslintignore` - Exclude `public/` build outputs from JS linting
234+
- `.stylelintignore` - Exclude `public/` build outputs from CSS linting
235+
- `phpcs.xml` - PHP code style rules (WordPress standards)
236+
- `phpstan.neon` - PHP static analysis configuration (Level 4)
237+
- `commitlint.config.js` - Commit message validation rules
223238

224239
### PHPStan (Static Analysis)
225240

@@ -234,14 +249,16 @@ yarn lint:php:phpstan
234249
```
235250

236251
**Common PHPStan errors:**
237-
- Missing type hints in docblocks
238-
- Calling undefined methods
239-
- Type mismatches in function parameters
240-
- Unreachable code
252+
253+
- Missing type hints in docblocks
254+
- Calling undefined methods
255+
- Type mismatches in function parameters
256+
- Unreachable code
241257

242258
**Configuration**: `phpstan.neon` (Level 4)
243-
- WordPress/WooCommerce function stubs included
244-
- Bootstrap file for plugin constants
259+
260+
- WordPress/WooCommerce function stubs included
261+
- Bootstrap file for plugin constants
245262

246263
### PHPCS (Code Style)
247264

@@ -258,9 +275,10 @@ yarn lint:php:fix
258275
```
259276

260277
**Configuration**: `phpcs.xml`
261-
- WordPress-Core ruleset
262-
- Tabs for indentation
263-
- PSR-4 autoloading compatible
278+
279+
- WordPress-Core ruleset
280+
- Tabs for indentation
281+
- PSR-4 autoloading compatible
264282

265283
### Branch Protection
266284

@@ -279,38 +297,39 @@ git push origin feat/my-feature
279297

280298
## Scripts
281299

282-
- `yarn build` - Build production assets
283-
- `yarn start` - Development build with watch mode
284-
- `yarn release` - Create new release (automated versioning)
285-
- `yarn lint` - Lint all files (JS + CSS + PHP)
286-
- `yarn lint:fix` - Auto-fix all linting issues
287-
- `yarn lint:js` - Lint JavaScript
288-
- `yarn lint:js-fix` - Fix JavaScript linting issues
289-
- `yarn lint:css` - Lint CSS
290-
- `yarn lint:css-fix` - Fix CSS linting issues
291-
- `yarn lint:php` - Lint PHP (PHPCS + PHPStan)
292-
- `yarn lint:php:fix` - Fix PHP code style issues
300+
- `yarn build` - Build production assets
301+
- `yarn start` - Development build with watch mode
302+
- `yarn release` - Create new release (automated versioning)
303+
- `yarn lint` - Lint all files (JS + CSS + PHP)
304+
- `yarn lint:fix` - Auto-fix all linting issues
305+
- `yarn lint:js` - Lint JavaScript
306+
- `yarn lint:js-fix` - Fix JavaScript linting issues
307+
- `yarn lint:css` - Lint CSS
308+
- `yarn lint:css-fix` - Fix CSS linting issues
309+
- `yarn lint:php` - Lint PHP (PHPCS + PHPStan)
310+
- `yarn lint:php:fix` - Fix PHP code style issues
293311

294312
## Tech Stack
295313

296-
- **Build Tool**: Webpack (via @wordpress/scripts)
297-
- **Package Manager**: Yarn 4 (Berry)
298-
- **Commit Linting**: Commitlint + Husky
299-
- **Release Automation**: release-it + generate-wp-readme
300-
- **Changelog**: Auto-generated from conventional commits
314+
- **Build Tool**: Webpack (via @wordpress/scripts)
315+
- **Package Manager**: Yarn 4 (Berry)
316+
- **Commit Linting**: Commitlint + Husky
317+
- **Release Automation**: release-it + generate-wp-readme
318+
- **Changelog**: Auto-generated from conventional commits
301319

302320
## CI/CD
303321

304322
### GitHub Actions Workflows
305323

306324
1. **WordPress.org Deployment** (`.github/workflows/main.yml`)
307-
- Triggers on GitHub release creation
308-
- Builds assets, deploys to WordPress.org
309-
- Attaches ZIP to GitHub release
325+
326+
- Triggers on GitHub release creation
327+
- Builds assets, deploys to WordPress.org
328+
- Attaches ZIP to GitHub release
310329

311330
2. **Manual Package Creation** (`.github/workflows/create-package.yml`)
312-
- Manually triggered via Actions UI
313-
- Creates installable plugin ZIP
331+
- Manually triggered via Actions UI
332+
- Creates installable plugin ZIP
314333

315334
## Contributing
316335

@@ -321,9 +340,9 @@ git push origin feat/my-feature
321340

322341
## Support
323342

324-
- Documentation: https://support.monei.com
325-
- Email: support@monei.com
326-
- WordPress.org: https://wordpress.org/plugins/monei/
343+
- Documentation: https://support.monei.com
344+
- Email: support@monei.com
345+
- WordPress.org: https://wordpress.org/plugins/monei/
327346

328347
## License
329348

0 commit comments

Comments
 (0)