Skip to content

Commit 6f0ab6e

Browse files
committed
Fix nullable errors. Bump php-di to 7. Remove spatie data transfer
1 parent 057b875 commit 6f0ab6e

76 files changed

Lines changed: 1888 additions & 383 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/analysis.yml

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,16 @@ name: PHP Code Sniffer and Static Analysis
33
on:
44
push:
55
branches:
6-
- 4.x
6+
- 5.x
7+
- '5.0.0'
78
pull_request:
89
paths:
9-
- 'src/**.php'
10+
- 'src/**/*.php'
11+
- 'tests/phpcs.xml'
12+
- 'tests/phpstan.neon'
13+
- 'composer.json'
14+
- 'composer.lock'
15+
- '.github/workflows/analysis.yml'
1016

1117
jobs:
1218
analyze:
@@ -16,14 +22,14 @@ jobs:
1622
strategy:
1723
matrix:
1824
operating-system: [ ubuntu-latest ]
19-
php-versions: [ '8.0' ]
25+
php-versions: [ '8.2' ]
2026

2127
env:
22-
cache_version: 1 # increment to flush all caches
23-
php_extensions: tokenizer, xmlwriter, simplexml
28+
cache_version: 2
29+
php_extensions: tokenizer, xmlwriter, simplexml, mbstring
2430

2531
steps:
26-
- uses: actions/checkout@v2
32+
- uses: actions/checkout@v4
2733

2834
- name: Setup PHP extension cache
2935
id: cache-php-extensions
@@ -34,7 +40,7 @@ jobs:
3440
key: ${{ matrix.operating-system }}-${{ env.cache_version }}-phpextensions-${{ matrix.php-versions }}
3541

3642
- name: Cache PHP extensions
37-
uses: actions/cache@v2
43+
uses: actions/cache@v4
3844
with:
3945
path: ${{ steps.cache-php-extensions.outputs.dir }}
4046
key: ${{ steps.cache-php-extensions.outputs.key }}
@@ -46,24 +52,24 @@ jobs:
4652
php-version: ${{ matrix.php-versions }}
4753
extensions: ${{ env.php_extensions }}
4854
coverage: none
49-
tools: composer
55+
tools: composer:v2
5056

51-
- name: Validate composer.json and composer.lock
52-
run: composer validate
57+
- name: Validate composer.json
58+
run: composer validate --no-check-publish --no-check-lock
5359

5460
- name: Get composer cache directory
5561
id: composer-cache
56-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
62+
run: echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"
5763

58-
- name: Check for Cached Composer Dependencies
59-
id: cache-composer-dependencies
60-
uses: actions/cache@v2
64+
- name: Cache Composer dependencies
65+
uses: actions/cache@v4
6166
with:
6267
path: ${{ steps.composer-cache.outputs.dir }}
63-
key: ${{ runner.os }}-${{ env.cache_version }}-phpextensions-${{ matrix.php-versions }}-composer-${{ hashFiles('composer.json') }}
64-
restore-keys: ${{ runner.os }}-${{ env.cache_version }}-phpextensions-${{ matrix.php-versions }}-composer-
68+
key: ${{ runner.os }}-${{ env.cache_version }}-php${{ matrix.php-versions }}-composer-${{ hashFiles('composer.json', 'composer.lock') }}
69+
restore-keys: |
70+
${{ runner.os }}-${{ env.cache_version }}-php${{ matrix.php-versions }}-composer-
6571
66-
- name: Install updated composer dependencies
72+
- name: Install Composer dependencies
6773
run: composer update --prefer-stable --prefer-dist --no-interaction --optimize-autoloader
6874

6975
- name: Run PHPCS code sniffer

.github/workflows/ci.yml

Lines changed: 47 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ name: Codeception Tests
33
on:
44
push:
55
branches:
6-
- 4.x
6+
- 5.x
7+
- '5.0.0'
78
pull_request:
89

910
jobs:
@@ -14,47 +15,47 @@ jobs:
1415
strategy:
1516
matrix:
1617
operating-system: [ ubuntu-latest ]
17-
php-versions: [ '7.4', '8.0', '8.1' ]
18-
wordpress-version: [ 'latest', '5.3.12', '5.9.3' ]
19-
exclude:
20-
- php-versions: '8.0'
21-
wordpress-version: '5.3.12'
22-
- php-versions: '8.1'
23-
wordpress-version: '5.3.12'
18+
php-versions: [ '8.1', '8.2', '8.3' ]
19+
wordpress-version: [ 'latest', '6.4.5', '6.7.2' ]
2420
fail-fast: false
2521

2622
env:
27-
cache_version: 1 # increment to flush all caches
23+
cache_version: 2
2824
php_extensions: memcached, mysql, bz2, gd, igbinary, imagick, imap, mbstring, bcmath, zip, intl
2925
PROJECT_ID: square1
3026
COMPOSE_INTERACTIVE_NO_CLI: 1
3127
WP_ROOT_FOLDER: ${{ github.workspace }}/tests/wordpress
32-
WP_DOMAIN: "tribe-libs.tribe"
33-
WP_ADMIN_PATH: "/wp-admin"
34-
WP_ADMIN_USERNAME: "admin"
35-
WP_ADMIN_PASSWORD: "password"
36-
WP_URL: "http://tribe-libs.tribe"
28+
WP_DOMAIN: tribe-libs.tribe
29+
WP_ADMIN_PATH: /wp-admin
30+
WP_ADMIN_USERNAME: admin
31+
WP_ADMIN_PASSWORD: password
32+
WP_URL: http://tribe-libs.tribe
3733
TEST_DB_HOST: 127.0.0.1
38-
TEST_DB_NAME: wordpress
34+
TEST_DB_NAME: tribe_libs_test
3935
TEST_DB_USER: root
4036
TEST_DB_PASSWORD: password
41-
TABLE_PREFIX: "tribe_"
37+
TABLE_PREFIX: tribe_
4238
TEST_CONFIG_FILE: ${{ github.workspace }}/tests/wp-config-environment.php
4339

4440
services:
4541

4642
mysql:
47-
image: mariadb:10
43+
image: mariadb:10.11
4844
env:
4945
MYSQL_ROOT_PASSWORD: password
50-
MYSQL_DATABASE: wordpress
46+
MYSQL_DATABASE: tribe_libs_test
5147
ports:
5248
- 3306:3306
49+
options: >-
50+
--health-cmd="healthcheck.sh --connect --innodb_initialized"
51+
--health-interval=10s
52+
--health-timeout=5s
53+
--health-retries=5
5354
5455
steps:
5556

5657
- name: Checkout
57-
uses: actions/checkout@v2
58+
uses: actions/checkout@v4
5859

5960
- name: Setup PHP extension cache
6061
id: cache-php-extensions
@@ -65,7 +66,7 @@ jobs:
6566
key: ${{ matrix.operating-system }}-${{ env.cache_version }}-phpextensions-${{ matrix.php-versions }}-${{ matrix.wordpress-version }}
6667

6768
- name: Cache PHP extensions
68-
uses: actions/cache@v2
69+
uses: actions/cache@v4
6970
with:
7071
path: ${{ steps.cache-php-extensions.outputs.dir }}
7172
key: ${{ steps.cache-php-extensions.outputs.key }}
@@ -77,36 +78,49 @@ jobs:
7778
php-version: ${{ matrix.php-versions }}
7879
extensions: ${{ env.php_extensions }}
7980
coverage: none
80-
tools: codeception, composer
81+
tools: composer:v2
8182

8283
- name: Download WordPress
8384
working-directory: ./tests
8485
run: |
85-
wget "https://wordpress.org/wordpress-${{ matrix.wordpress-version }}.tar.gz" -O ./wordpress.tar.gz
86+
wget -q "https://wordpress.org/wordpress-${{ matrix.wordpress-version }}.tar.gz" -O ./wordpress.tar.gz
8687
tar xzf wordpress.tar.gz
8788
rm wordpress.tar.gz
8889
89-
- name: Create config files
90+
- name: Create test environment file
9091
run: |
91-
touch ./tests/.env
92+
{
93+
echo "WP_ROOT_FOLDER=${{ env.WP_ROOT_FOLDER }}"
94+
echo "WP_DOMAIN=${{ env.WP_DOMAIN }}"
95+
echo "WP_URL=${{ env.WP_URL }}"
96+
echo "WP_ADMIN_PATH=${{ env.WP_ADMIN_PATH }}"
97+
echo "WP_ADMIN_USERNAME=${{ env.WP_ADMIN_USERNAME }}"
98+
echo "WP_ADMIN_PASSWORD=${{ env.WP_ADMIN_PASSWORD }}"
99+
echo "TEST_DB_HOST=${{ env.TEST_DB_HOST }}"
100+
echo "TEST_DB_NAME=${{ env.TEST_DB_NAME }}"
101+
echo "TEST_DB_USER=${{ env.TEST_DB_USER }}"
102+
echo "TEST_DB_PASSWORD=${{ env.TEST_DB_PASSWORD }}"
103+
echo "TABLE_PREFIX=${{ env.TABLE_PREFIX }}"
104+
echo "TEST_CONFIG_FILE=${{ env.TEST_CONFIG_FILE }}"
105+
} > ./tests/.env
92106
93107
- name: Get composer cache directory
94108
id: composer-cache
95-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
109+
run: echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"
96110

97-
- name: Check for Cached Composer Dependencies
98-
id: cache-composer-dependencies
99-
uses: actions/cache@v2
111+
- name: Cache Composer dependencies
112+
uses: actions/cache@v4
100113
with:
101114
path: ${{ steps.composer-cache.outputs.dir }}
102-
key: ${{ runner.os }}-${{ env.cache_version }}-phpextensions-${{ matrix.php-versions }}-composer-${{ hashFiles('composer.json') }}
103-
restore-keys: ${{ runner.os }}-${{ env.cache_version }}-phpextensions-${{ matrix.php-versions }}-composer-
115+
key: ${{ runner.os }}-${{ env.cache_version }}-php${{ matrix.php-versions }}-composer-${{ hashFiles('composer.json', 'composer.lock') }}
116+
restore-keys: |
117+
${{ runner.os }}-${{ env.cache_version }}-php${{ matrix.php-versions }}-composer-
104118
105-
- name: Install updated composer dependencies
119+
- name: Install Composer dependencies
106120
run: composer update --prefer-stable --prefer-dist --no-interaction --optimize-autoloader
107121

108-
- name: Install test dependencies
109-
run: composer -- test:install-plugins
122+
- name: Install test plugins
123+
run: composer test:install-plugins
110124

111125
- name: Run unit tests
112126
run: composer test:unit

.github/workflows/monorepo.yml

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,35 +15,33 @@ jobs:
1515
- name: Setup PHP
1616
uses: shivammathur/setup-php@v2
1717
with:
18-
php-version: '8.0'
18+
php-version: '8.2'
1919
coverage: none
20+
tools: composer:v2
2021

2122
- name: Checkout
22-
uses: actions/checkout@v6
23+
uses: actions/checkout@v4
2324

2425
- uses: ramsey/composer-install@v3
2526

2627
- name: Set repo matrix
2728
id: set-matrix
28-
run: echo "matrix=$(php ./dev/monorepo/scripts/repo-map.php)" >> $GITHUB_OUTPUT
29+
run: echo "matrix=$(php ./dev/monorepo/scripts/repo-map.php)" >> "$GITHUB_OUTPUT"
2930

3031
split:
3132
needs: list-repos
3233
runs-on: ubuntu-latest
3334
env:
34-
# This should be changed based on the branch where this action lives to match
35-
# the versions that will be released, so for a "4.x" branch would be 4.0.0 <= 5.0.0.
36-
# Branches MUST EXIST in the sub-repos for this to work, so use the
37-
# sub-repo-branch-create.yml GitHub action to create those branches first.
38-
# If you branch from this, ensure to change the split_branch to a new major version!
39-
split_branch: '4.x'
35+
# Match the major release line for this branch (create `5.x` in sub-repos first
36+
# via sub-repo-branch-create.yml if missing).
37+
split_branch: '5.x'
4038
strategy:
4139
fail-fast: false
4240
matrix:
4341
package: ${{ fromJson(needs.list-repos.outputs.matrix) }}
4442

4543
steps:
46-
- uses: actions/checkout@v6
44+
- uses: actions/checkout@v4
4745
with:
4846
fetch-depth: 0
4947

@@ -59,4 +57,3 @@ jobs:
5957
user_name: '${{ github.actor }}'
6058
user_email: '${{ github.actor }}@users.noreply.github.com'
6159
branch: '${{ env.split_branch }}'
62-

.github/workflows/sub-repo-branch-create.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ on:
33
workflow_dispatch:
44
inputs:
55
branch:
6-
description: 'The branch name to create in all sub-repos'
6+
description: 'The branch name to create in all sub-repos (e.g. 5.x)'
77
required: true
88

99
jobs:
@@ -16,17 +16,18 @@ jobs:
1616
- name: Setup PHP
1717
uses: shivammathur/setup-php@v2
1818
with:
19-
php-version: '8.0'
19+
php-version: '8.2'
2020
coverage: none
21+
tools: composer:v2
2122

2223
- name: Checkout
23-
uses: actions/checkout@v2
24+
uses: actions/checkout@v4
2425

25-
- uses: ramsey/composer-install@v2
26+
- uses: ramsey/composer-install@v3
2627

2728
- name: Set repo matrix
2829
id: set-matrix
29-
run: echo "::set-output name=matrix::$(./monorepo.sh packages-json)"
30+
run: echo "matrix=$(./monorepo.sh packages-json)" >> "$GITHUB_OUTPUT"
3031

3132
create-sub-repo-branches:
3233
needs: list-repos
@@ -39,7 +40,7 @@ jobs:
3940

4041
steps:
4142
- name: Checkout sub-repo
42-
uses: actions/checkout@v3
43+
uses: actions/checkout@v4
4344
with:
4445
repository: ${{ env.org }}/${{ matrix.package }}
4546
token: ${{ secrets.TR1B0T_TRIBE_LIBS_MONOREPO_TOKEN }}
@@ -51,5 +52,3 @@ jobs:
5152
git config --local user.name "Tr1b0t"
5253
git checkout -b ${{ github.event.inputs.branch }}
5354
git push -u origin ${{ github.event.inputs.branch }}
54-
55-

.lando.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: tribe-libs
22
recipe: wordpress
33

44
config:
5-
php: '8.0'
5+
php: '8.2'
66
composer_version: 2-latest
77
via: nginx
88
xdebug: false

CHANGELOG.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@ All notable changes to this project will be documented in this file.
44

55
## Unreleased
66

7-
## 4.2.3 - 2025-12-02
8-
9-
## 4.2.3 - 2025-12-02
10-
11-
## 4.2.3 - 2025-12-02
12-
13-
## 4.2.3 - 2025-12-02
14-
15-
## 4.2.3 - 2025-12-02
7+
## 5.0.0 - TBD
8+
9+
- Changed: Minimum PHP version to **8.1** (`^8.1`).
10+
- Changed: Upgraded `php-di/php-di` from `^6.0` to **`^7.0`** for PHP 8 compatibility.
11+
- Changed: Removed abandoned `spatie/data-transfer-object`. Field Models use a first-party DTO layer under `Tribe\Libs\Field_Models\DTO` while keeping Spatie-compatible extension points (`castValue`, `castType`, validator property names) and class aliases under `Spatie\DataTransferObject\*` when Spatie is not installed.
12+
- Changed: Subpackage interdependencies use `self.version` (monorepo) until a 5.0 release sets mutual versions; branch alias `5.0-dev`.
13+
- Fixed: Implicit nullable parameter declarations for PHP 8.4+ (`Type $x = null``?Type $x = null`).
14+
- Changed: Dev tooling constraints (PHPUnit, PHPStan, Symfony Console) for PHP 8.1+.
15+
- Added: `composer test:functional` alias for the integration suite.
16+
- Changed: GitHub Actions for PHP 8.1–8.3, WordPress latest/6.4/6.7, modern action versions, `5.x` monorepo split branch.
1617

1718
## 4.2.2 - 2025-11-25
1819

0 commit comments

Comments
 (0)