Skip to content

Commit 782b914

Browse files
authored
Merge pull request #3 from inpsyde/modernize
Modernize codebase and QA
2 parents 3521f5d + 49e9df1 commit 782b914

40 files changed

+2919
-1817
lines changed

.gitattributes

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
* text eol=lf
22

3+
/.github/ export-ignore
4+
/tests/ export-ignore
35
/.gitattributes export-ignore
46
/.gitignore export-ignore
5-
/.travis.yml export-ignore
7+
/phpcs.xml.dist export-ignore
68
/phpunit.xml.dist export-ignore
7-
/README.md export-ignore
8-
/tests/ export-ignore
9+
/psalm.xml export-ignore
10+
/CHANGELOG.md export-ignore
11+
/README.md export-ignore

.github/workflows/static-analysis.yml

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Static Analysis
2+
3+
on:
4+
push:
5+
paths:
6+
- '**workflows/static-analysis.yml'
7+
- '**.php'
8+
- '**phpcs.xml.dist'
9+
- '**psalm.xml'
10+
pull_request:
11+
paths:
12+
- '**workflows/static-analysis.yml'
13+
- '**.php'
14+
- '**phpcs.xml.dist'
15+
- '**psalm.xml'
16+
workflow_dispatch:
17+
inputs:
18+
jobs:
19+
required: true
20+
type: choice
21+
default: 'Run all'
22+
description: 'Choose jobs to run'
23+
options:
24+
- 'Run all'
25+
- 'Run PHPCS only'
26+
- 'Run Psalm only'
27+
- 'Run lint only'
28+
29+
concurrency:
30+
group: "${{ github.workflow }}-${{ github.ref }}"
31+
cancel-in-progress: true
32+
33+
jobs:
34+
lint:
35+
if: ${{ (github.event_name != 'workflow_dispatch') || ((github.event.inputs.jobs == 'Run all') || (github.event.inputs.jobs == 'Run lint only')) }}
36+
uses: inpsyde/reusable-workflows/.github/workflows/lint-php.yml@main
37+
strategy:
38+
matrix:
39+
php: [ '7.4', '8.0', '8.1', '8.2', '8.3' ]
40+
with:
41+
PHP_VERSION: ${{ matrix.php }}
42+
LINT_ARGS: '-e php --colors --show-deprecated ./inc ./src'
43+
44+
coding-standards-analysis:
45+
if: ${{ (github.event_name != 'workflow_dispatch') || ((github.event.inputs.jobs == 'Run all') || (github.event.inputs.jobs == 'Run PHPCS only')) }}
46+
uses: inpsyde/reusable-workflows/.github/workflows/coding-standards-php.yml@main
47+
with:
48+
PHP_VERSION: '8.3'
49+
50+
static-code-analysis:
51+
if: ${{ (github.event_name != 'workflow_dispatch') || ((github.event.inputs.jobs == 'Run all') || (github.event.inputs.jobs == 'Run Psalm only')) }}
52+
uses: inpsyde/reusable-workflows/.github/workflows/static-analysis-php.yml@main
53+
strategy:
54+
matrix:
55+
php: [ '7.4', '8.0', '8.1', '8.2', '8.3' ]
56+
with:
57+
PHP_VERSION: ${{ matrix.php }}
58+
PSALM_ARGS: --output-format=github --no-suggestions --no-cache --no-diff

.github/workflows/unit-tests.yml

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Unit Tests
2+
3+
on:
4+
push:
5+
paths:
6+
- '**workflows/unit-tests.yml'
7+
- '**.php'
8+
- '**phpunit.xml.dist'
9+
pull_request:
10+
paths:
11+
- '**workflows/unit-tests.yml'
12+
- '**.php'
13+
- '**phpcs.xml.dist'
14+
workflow_dispatch:
15+
16+
concurrency:
17+
group: "${{ github.workflow }}-${{ github.ref }}"
18+
cancel-in-progress: true
19+
20+
jobs:
21+
unit-tests-php:
22+
runs-on: ubuntu-latest
23+
strategy:
24+
fail-fast: false
25+
matrix:
26+
php-ver: [ '7.4', '8.0', '8.1', '8.2', '8.3' ]
27+
wp-ver: [ '5.9', '6.0', '6.1', '6.2', '6.3', '6.4', '6' ]
28+
exclude:
29+
- php-ver: '8.2'
30+
wp-ver: '5.9'
31+
- php-ver: '8.3'
32+
wp-ver: '5.9'
33+
- php-ver: '8.2'
34+
wp-ver: '6.0'
35+
- php-ver: '8.3'
36+
wp-ver: '6.0'
37+
- php-ver: '8.3'
38+
wp-ver: '6.1'
39+
- php-ver: '8.3'
40+
wp-ver: '6.2'
41+
- php-ver: '8.3'
42+
wp-ver: '6.3'
43+
steps:
44+
- name: Checkout
45+
uses: actions/checkout@v4
46+
47+
- name: Setup PHP
48+
uses: shivammathur/setup-php@v2
49+
with:
50+
php-version: ${{ matrix.php-ver }}
51+
ini-values: zend.assertions=1, error_reporting=-1, display_errors=On
52+
coverage: none
53+
54+
- name: Adjust dependencies in 'composer.json'
55+
run: |
56+
composer remove roots/wordpress-no-content inpsyde/php-coding-standards vimeo/psalm --dev --no-update
57+
composer require "roots/wordpress-no-content:~${{ matrix.wp-ver }}.0" --dev --no-update
58+
59+
- name: Install dependencies
60+
uses: ramsey/composer-install@v3
61+
62+
- name: Run unit tests
63+
run: ./vendor/bin/phpunit --no-coverage

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/coverage/
22
composer.lock
33
vendor/
4-
/phpunit.xml
4+
/phpunit.xml
5+
/.phpunit.result.cache

.travis.yml

-22
This file was deleted.

CHANGELOG.md

+18
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,29 @@
11
# Object Hooks Remover
22

3+
## Next
4+
5+
- Modernize codebase to support recent PHP versions and up-to-date Syde coding standards.
6+
- Move logic from `utils.php` file to an internal `Functions` class (all-static, only for encapsulation and autoload).
7+
- Modernize QA:
8+
- Move out from Travis to GitHub actions.
9+
- Rewrite tests, update PHPUnit version, tests now include the real WordPress functions instead of stubs.
10+
- Added static analysis.
11+
- Introduced `remove_all_object_hooks()`.
12+
- Introduced `remove_static_method_hook()` to replace the now deprecated `remove_class_hook()` (which is converted to an alias).
13+
- In `remove_closure_hook()` is now possible to use `"mixed"` as target parameter type when the closure param declare no type.
14+
- License change from MIT to GPL due to usage of WordPress functions.
15+
- README refresh.
16+
17+
---
18+
319
## v0.1.1 (2017-12-19)
420

521
### Fixed
622

723
- Fix PHP 7 compatibility when removing hook with closures declaring param types.
824

25+
---
26+
927
## v0.1.0 (2017-12-03)
1028

1129
First release.

0 commit comments

Comments
 (0)